diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/MainController.m | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/MainController.m b/Source/MainController.m index d446444a..a0b69ffd 100644 --- a/Source/MainController.m +++ b/Source/MainController.m @@ -28,6 +28,8 @@ #import "TableDocument.h" #import "SPPreferenceController.h" +#import <Sparkle/Sparkle.h> + #define SEQUEL_PRO_HOME_PAGE_URL @"http://www.sequelpro.com/" #define SEQUEL_PRO_DONATIONS_URL @"http://www.sequelpro.com/donate.html" #define SEQUEL_PRO_FAQ_URL @"http://www.sequelpro.com/frequently-asked-questions.html" @@ -177,6 +179,26 @@ } /** + * Sparkle updater delegate method. Called just before the updater relaunches Sequel Pro and we need to make + * sure that no sheets are currently open, which will prevent the app from being quit. + */ +- (void)updaterWillRelaunchApplication:(SUUpdater *)updater +{ + // Get all the currently open windows and their attached sheets if any + NSArray *windows = [NSApp windows]; + + for (NSWindow *window in windows) + { + NSWindow *attachedSheet = [window attachedSheet]; + + if (attachedSheet) { + [NSApp endSheet:window returnCode:0]; + [window orderOut:nil]; + } + } +} + +/** * Deallocate prefs controller */ - (void)dealloc |