aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-06-21 14:55:04 +0000
committerstuconnolly <stuart02@gmail.com>2009-06-21 14:55:04 +0000
commit873774069986e899c61e10319336b8ac67ba7ebf (patch)
treec39bcbaefd546d3971a7d6c9f53fcde02d924853 /Source
parentcdf316bb4000fc904a0fac500e506c74db07bebe (diff)
downloadsequelpro-873774069986e899c61e10319336b8ac67ba7ebf.tar.gz
sequelpro-873774069986e899c61e10319336b8ac67ba7ebf.tar.bz2
sequelpro-873774069986e899c61e10319336b8ac67ba7ebf.zip
Fix for issue #305. Close all sheets attached to all open windows just before Sparkle relaunches the app.
Diffstat (limited to 'Source')
-rw-r--r--Source/MainController.m22
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