From 1d1017534b1559dd31a55c2bb4e2b2085d7ae272 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sat, 7 Jul 2012 17:58:52 +0000 Subject: [PATCH] #4953 Launching/quitting Growl should update options in preferences --- macosx/PrefsController.m | 40 ++++++++++++++++-------- macosx/en.lproj/PrefsWindow.xib | 54 +++++++++++++++++++-------------- 2 files changed, 58 insertions(+), 36 deletions(-) diff --git a/macosx/PrefsController.m b/macosx/PrefsController.m index 58800e4dc..15f12e9fc 100644 --- a/macosx/PrefsController.m +++ b/macosx/PrefsController.m @@ -61,6 +61,8 @@ - (void) setPrefView: (id) sender; +- (void) updateGrowlButton; + - (void) setKeychainPassword: (const char *) password forService: (const char *) service username: (const char *) username; @end @@ -175,19 +177,8 @@ [self setPrefView: nil]; - if ([GrowlApplicationBridge isGrowlRunning]) - { - [fBuiltInGrowlButton setHidden: YES]; - [fGrowlAppButton setHidden: NO]; -#warning remove NO - [fGrowlAppButton setEnabled:NO && [GrowlApplicationBridge isGrowlURLSchemeAvailable]]; - } - else - { - [fBuiltInGrowlButton setHidden: NO]; - [fGrowlAppButton setHidden: YES]; - [fBuiltInGrowlButton setState: [fDefaults boolForKey: @"DisplayNotifications"]]; - } + //make sure proper notification settings are shown + [self updateGrowlButton]; //set download folder [fFolderPopUp selectItemAtIndex: [fDefaults boolForKey: @"DownloadLocationConstant"] ? DOWNLOAD_FOLDER : DOWNLOAD_TORRENT]; @@ -338,6 +329,12 @@ return [self toolbarAllowedItemIdentifiers: toolbar]; } +- (void) windowDidBecomeMain: (NSNotification *) notification +{ + //this is a good place to see if Growl was quit/launched + [self updateGrowlButton]; +} + + (void) restoreWindowWithIdentifier: (NSString *) identifier state: (NSCoder *) state completionHandler: (void (^)(NSWindow *, NSError *)) completionHandler { NSWindow * window = [[(Controller *)[NSApp delegate] prefsController] window]; @@ -1453,6 +1450,23 @@ } } +- (void) updateGrowlButton +{ + if ([GrowlApplicationBridge isGrowlRunning]) + { + [fBuiltInGrowlButton setHidden: YES]; + [fGrowlAppButton setHidden: NO]; +#warning remove NO + [fGrowlAppButton setEnabled:NO && [GrowlApplicationBridge isGrowlURLSchemeAvailable]]; + } + else + { + [fBuiltInGrowlButton setHidden: NO]; + [fGrowlAppButton setHidden: YES]; + [fBuiltInGrowlButton setState: [fDefaults boolForKey: @"DisplayNotifications"]]; + } +} + - (void) setKeychainPassword: (const char *) password forService: (const char *) service username: (const char *) username { SecKeychainItemRef item = NULL; diff --git a/macosx/en.lproj/PrefsWindow.xib b/macosx/en.lproj/PrefsWindow.xib index 7837ec596..7696de8b8 100644 --- a/macosx/en.lproj/PrefsWindow.xib +++ b/macosx/en.lproj/PrefsWindow.xib @@ -78,7 +78,7 @@ - {{0, 0}, {2560, 1418}} + {{0, 0}, {2560, 1440}} {10000000000000, 10000000000000} YES @@ -1810,7 +1810,7 @@ {{363, 259}, {55, 17}} - + YES 67239424 @@ -1959,20 +1959,20 @@ 25 - + 264 {{91, 235}, {367, 18}} - + YES - + 67239424 0 Remove from the transfer list when seeding completes - + 1211912703 2 @@ -1983,7 +1983,7 @@ 25 - + 264 {{109, 217}, {180, 14}} @@ -1991,12 +1991,12 @@ YES - + 67239424 272760832 Applies to newly added transfers - + @@ -5455,10 +5455,18 @@ AAABAAAAAQ setLPD: - + 2120 + + + delegate + + + + 2126 + value: values.CheckQuit @@ -7674,10 +7682,10 @@ AAABAAAAAQ value: values.RemoveWhenFinishSeeding - + - + value: values.RemoveWhenFinishSeeding value @@ -8003,8 +8011,8 @@ AAABAAAAAQ - - + + @@ -10315,29 +10323,29 @@ AAABAAAAAQ 2118 - + - + 2119 - - + + 2122 - + - + 2123 - - + + @@ -10759,7 +10767,7 @@ AAABAAAAAQ - 2125 + 2126