Camino only - Bug 368354: Don't offer to restore session if there is no saved session. r=stridey sr=pink
This commit is contained in:
Родитель
7f9813c0e4
Коммит
657cac0fef
|
@ -269,18 +269,20 @@ NSString* const kPreviousSessionTerminatedNormallyKey = @"PreviousSessionTermina
|
|||
// Obey the camino.remember_window_state preference unless Camino crashed
|
||||
// last time, in which case the user is asked what to do.
|
||||
BOOL shouldRestoreWindowState = NO;
|
||||
if ([self previousSessionTerminatedNormally]) {
|
||||
shouldRestoreWindowState = [prefManager getBooleanPref:"camino.remember_window_state" withSuccess:NULL];
|
||||
}
|
||||
else if ([prefManager getBooleanPref:"browser.sessionstore.resume_from_crash" withSuccess:NULL]) {
|
||||
NSAlert* restoreAfterCrashAlert = [[[NSAlert alloc] init] autorelease];
|
||||
[restoreAfterCrashAlert addButtonWithTitle:NSLocalizedString(@"RestoreAfterCrashActionButton", nil)];
|
||||
[restoreAfterCrashAlert addButtonWithTitle:NSLocalizedString(@"RestoreAfterCrashCancelButton", nil)];
|
||||
[restoreAfterCrashAlert setMessageText:NSLocalizedString(@"RestoreAfterCrashTitle", nil)];
|
||||
[restoreAfterCrashAlert setInformativeText:NSLocalizedString(@"RestoreAfterCrashMessage", nil)];
|
||||
[restoreAfterCrashAlert setAlertStyle:NSWarningAlertStyle];
|
||||
if ([restoreAfterCrashAlert runModal] == NSAlertFirstButtonReturn)
|
||||
shouldRestoreWindowState = YES;
|
||||
if ([[SessionManager sharedInstance] hasSavedState]) {
|
||||
if ([self previousSessionTerminatedNormally]) {
|
||||
shouldRestoreWindowState = [prefManager getBooleanPref:"camino.remember_window_state" withSuccess:NULL];
|
||||
}
|
||||
else if ([prefManager getBooleanPref:"browser.sessionstore.resume_from_crash" withSuccess:NULL]) {
|
||||
NSAlert* restoreAfterCrashAlert = [[[NSAlert alloc] init] autorelease];
|
||||
[restoreAfterCrashAlert addButtonWithTitle:NSLocalizedString(@"RestoreAfterCrashActionButton", nil)];
|
||||
[restoreAfterCrashAlert addButtonWithTitle:NSLocalizedString(@"RestoreAfterCrashCancelButton", nil)];
|
||||
[restoreAfterCrashAlert setMessageText:NSLocalizedString(@"RestoreAfterCrashTitle", nil)];
|
||||
[restoreAfterCrashAlert setInformativeText:NSLocalizedString(@"RestoreAfterCrashMessage", nil)];
|
||||
[restoreAfterCrashAlert setAlertStyle:NSWarningAlertStyle];
|
||||
if ([restoreAfterCrashAlert runModal] == NSAlertFirstButtonReturn)
|
||||
shouldRestoreWindowState = YES;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldRestoreWindowState) {
|
||||
|
|
|
@ -66,4 +66,7 @@
|
|||
// Deletes the window state file from the profile directory.
|
||||
- (void)clearSavedState;
|
||||
|
||||
// Indicates whether there is persisted state available to restore.
|
||||
- (BOOL)hasSavedState;
|
||||
|
||||
@end
|
||||
|
|
|
@ -246,4 +246,10 @@ const NSTimeInterval kPersistDelay = 60.0;
|
|||
[self saveWindowState];
|
||||
}
|
||||
|
||||
- (BOOL)hasSavedState
|
||||
{
|
||||
NSFileManager* fileManager = [NSFileManager defaultManager];
|
||||
return [fileManager fileExistsAtPath:mSessionStatePath];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Загрузка…
Ссылка в новой задаче