]> granicus.if.org Git - transmission/commitdiff
#4953 Launching/quitting Growl should update options in preferences
authorMitchell Livingston <livings124@transmissionbt.com>
Sat, 7 Jul 2012 17:58:52 +0000 (17:58 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Sat, 7 Jul 2012 17:58:52 +0000 (17:58 +0000)
macosx/PrefsController.m
macosx/en.lproj/PrefsWindow.xib

index 58800e4dc9173df6eefbf6ec67fb454b062b63f3..15f12e9fc472ab3709af865aac043cd62957a354 100644 (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
     
     [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];
     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];
     }
 }
 
+- (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;
index 7837ec596aef9fad44b7b3cf1c3ba3b32e232f88..7696de8b8b0d0ba61aca627a92745e8ef324e7e6 100644 (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>
                                                                                        <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>
                                                                                                <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"/>
                                                                                                <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>
                                                                                        <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">