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:
stuart.morgan%alumni.case.edu 2007-02-07 18:46:58 +00:00
Родитель 7f9813c0e4
Коммит 657cac0fef
3 изменённых файлов: 23 добавлений и 12 удалений

Просмотреть файл

@ -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