#4953 Launching/quitting Growl should update options in preferences

This commit is contained in:
Mitchell Livingston 2012-07-07 17:58:52 +00:00
parent 2586396a11
commit 1d1017534b
2 changed files with 58 additions and 36 deletions

View File

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

View File

@ -78,7 +78,7 @@
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
</object>
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
<string key="NSScreenRect">{{0, 0}, {2560, 1440}}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
@ -1810,7 +1810,7 @@
<string key="NSFrame">{{363, 259}, {55, 17}}</string>
<reference key="NSSuperview" ref="159788047"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="466216419"/>
<reference key="NSNextKeyView" ref="754675227"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="517021610">
<int key="NSCellFlags">67239424</int>
@ -1959,20 +1959,20 @@
<int key="NSPeriodicInterval">25</int>
</object>
</object>
<object class="NSButton" id="466216419">
<object class="NSButton" id="754675227">
<reference key="NSNextResponder" ref="159788047"/>
<int key="NSvFlags">264</int>
<string key="NSFrame">{{91, 235}, {367, 18}}</string>
<reference key="NSSuperview" ref="159788047"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1040184697"/>
<reference key="NSNextKeyView" ref="653956150"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="140497183">
<object class="NSButtonCell" key="NSCell" id="608056912">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Remove from the transfer list when seeding completes</string>
<reference key="NSSupport" ref="86725571"/>
<reference key="NSControlView" ref="466216419"/>
<reference key="NSControlView" ref="754675227"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="1001726176"/>
@ -1983,7 +1983,7 @@
<int key="NSPeriodicInterval">25</int>
</object>
</object>
<object class="NSTextField" id="1040184697">
<object class="NSTextField" id="653956150">
<reference key="NSNextResponder" ref="159788047"/>
<int key="NSvFlags">264</int>
<string key="NSFrame">{{109, 217}, {180, 14}}</string>
@ -1991,12 +1991,12 @@
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="977701368"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="1020816654">
<object class="NSTextFieldCell" key="NSCell" id="591915608">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">272760832</int>
<string key="NSContents">Applies to newly added transfers</string>
<reference key="NSSupport" ref="26"/>
<reference key="NSControlView" ref="1040184697"/>
<reference key="NSControlView" ref="653956150"/>
<reference key="NSBackgroundColor" ref="977951849"/>
<reference key="NSTextColor" ref="540507142"/>
</object>
@ -5455,10 +5455,18 @@ AAABAAAAAQ</bytes>
<object class="IBActionConnection" key="connection">
<string key="label">setLPD:</string>
<reference key="source" ref="511492310"/>
<reference key="destination" ref="466216419"/>
<reference key="destination" ref="754675227"/>
</object>
<int key="connectionID">2120</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="359484234"/>
<reference key="destination" ref="511492310"/>
</object>
<int key="connectionID">2126</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">value: values.CheckQuit</string>
@ -7674,10 +7682,10 @@ AAABAAAAAQ</bytes>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">value: values.RemoveWhenFinishSeeding</string>
<reference key="source" ref="466216419"/>
<reference key="source" ref="754675227"/>
<reference key="destination" ref="356871564"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="466216419"/>
<reference key="NSSource" ref="754675227"/>
<reference key="NSDestination" ref="356871564"/>
<string key="NSLabel">value: values.RemoveWhenFinishSeeding</string>
<string key="NSBinding">value</string>
@ -8003,8 +8011,8 @@ AAABAAAAAQ</bytes>
<reference ref="338014056"/>
<reference ref="658629919"/>
<reference ref="58756917"/>
<reference ref="466216419"/>
<reference ref="1040184697"/>
<reference ref="754675227"/>
<reference ref="653956150"/>
</array>
<reference key="parent" ref="298493360"/>
</object>
@ -10315,29 +10323,29 @@ AAABAAAAAQ</bytes>
</object>
<object class="IBObjectRecord">
<int key="objectID">2118</int>
<reference key="object" ref="466216419"/>
<reference key="object" ref="754675227"/>
<array class="NSMutableArray" key="children">
<reference ref="140497183"/>
<reference ref="608056912"/>
</array>
<reference key="parent" ref="159788047"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2119</int>
<reference key="object" ref="140497183"/>
<reference key="parent" ref="466216419"/>
<reference key="object" ref="608056912"/>
<reference key="parent" ref="754675227"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2122</int>
<reference key="object" ref="1040184697"/>
<reference key="object" ref="653956150"/>
<array class="NSMutableArray" key="children">
<reference ref="1020816654"/>
<reference ref="591915608"/>
</array>
<reference key="parent" ref="159788047"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2123</int>
<reference key="object" ref="1020816654"/>
<reference key="parent" ref="1040184697"/>
<reference key="object" ref="591915608"/>
<reference key="parent" ref="653956150"/>
</object>
</array>
</object>
@ -10759,7 +10767,7 @@ AAABAAAAAQ</bytes>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">2125</int>
<int key="maxID">2126</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">