diff options
author | stuconnolly <stuart02@gmail.com> | 2012-05-27 07:43:33 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-05-27 07:43:33 +0000 |
commit | 0ce6000b7a0959b84379564fa9ca685e112cd4c8 (patch) | |
tree | cad538e8368601e5469d30ac86ce1058bd80afd3 | |
parent | 2767d17a562316ec7ae1eb5af2d2bd7ad2ed918b (diff) | |
download | sequelpro-0ce6000b7a0959b84379564fa9ca685e112cd4c8.tar.gz sequelpro-0ce6000b7a0959b84379564fa9ca685e112cd4c8.tar.bz2 sequelpro-0ce6000b7a0959b84379564fa9ca685e112cd4c8.zip |
Improve default favorite popup button handling when there are no favorites.
-rw-r--r-- | Interfaces/English.lproj/Preferences.xib | 55 | ||||
-rw-r--r-- | Source/SPGeneralPreferencePane.m | 22 |
2 files changed, 65 insertions, 12 deletions
diff --git a/Interfaces/English.lproj/Preferences.xib b/Interfaces/English.lproj/Preferences.xib index 7cd53b12..d9374c1e 100644 --- a/Interfaces/English.lproj/Preferences.xib +++ b/Interfaces/English.lproj/Preferences.xib @@ -21,6 +21,7 @@ </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> + <integer value="571"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -498,7 +499,7 @@ <string key="NSMaxSize">{264, 296}</string> </object> <object class="NSCustomView" id="594324362"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder"/> <int key="NSvFlags">268</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -926,6 +927,7 @@ <object class="NSMutableArray" key="NSMenuItems"> <bool key="EncodedWithXMLCoder">YES</bool> </object> + <bool key="NSNoAutoenable">YES</bool> </object> <int key="NSSelectedIndex">-1</int> <int key="NSPreferredEdge">1</int> @@ -1345,6 +1347,7 @@ </object> </object> <string key="NSFrameSize">{580, 280}</string> + <reference key="NSSuperview"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="395894064"> @@ -1891,7 +1894,7 @@ <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="593732956"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder"/> <int key="NSvFlags">274</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -1915,6 +1918,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{-1, -1}, {32, 25}}</string> <reference key="NSSuperview" ref="1068562664"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="907732055"> <int key="NSCellFlags">67239424</int> @@ -1939,6 +1943,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{30, -1}, {32, 24}}</string> <reference key="NSSuperview" ref="1068562664"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="BWAnchoredPopUpButtonCell" key="NSCell" id="858997662"> <int key="NSCellFlags">71433792</int> @@ -2084,6 +2089,7 @@ </object> <string key="NSFrameSize">{229, 23}</string> <reference key="NSSuperview" ref="984943037"/> + <reference key="NSWindow"/> <bool key="BWABBIsResizable">YES</bool> <bool key="BWABBIsAtBottom">YES</bool> <bool key="BWABBHandleIsRightAligned">NO</bool> @@ -2104,6 +2110,7 @@ <int key="NSvFlags">4370</int> <string key="NSFrameSize">{231, 358}</string> <reference key="NSSuperview" ref="253139122"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="_NSCornerView" key="NSCornerView"> <nil key="NSNextResponder"/> @@ -2168,6 +2175,7 @@ </object> <string key="NSFrame">{{1, 1}, {230, 358}}</string> <reference key="NSSuperview" ref="533802223"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="279932544"/> <reference key="NSDocView" ref="279932544"/> <reference key="NSBGColor" ref="887465699"/> @@ -2178,6 +2186,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{183, 1}, {11, 317}}</string> <reference key="NSSuperview" ref="533802223"/> + <reference key="NSWindow"/> <int key="NSsFlags">256</int> <reference key="NSTarget" ref="533802223"/> <string key="NSAction">_doScroller:</string> @@ -2189,6 +2198,7 @@ <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-100, -100}, {311, 15}}</string> <reference key="NSSuperview" ref="533802223"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="533802223"/> @@ -2198,6 +2208,7 @@ </object> <string key="NSFrame">{{-2, 22}, {232, 360}}</string> <reference key="NSSuperview" ref="984943037"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="253139122"/> <int key="NSsFlags">658</int> <reference key="NSVScroller" ref="940130901"/> @@ -2208,6 +2219,7 @@ </object> <string key="NSFrameSize">{229, 381}</string> <reference key="NSSuperview" ref="141072039"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="343315962"> @@ -2220,6 +2232,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{-7, 34}, {370, 282}}</string> <reference key="NSSuperview" ref="343315962"/> + <reference key="NSWindow"/> <object class="NSMutableArray" key="NSTabViewItems"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTabViewItem" id="912523923"> @@ -2972,6 +2985,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 33}, {159, 19}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="816035036"> <int key="NSCellFlags">-2073952703</int> @@ -2992,6 +3006,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 35}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="141835735"> <int key="NSCellFlags">68288064</int> @@ -3008,6 +3023,7 @@ <int key="NSvFlags">265</int> <string key="NSFrame">{{277, 32}, {25, 21}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="735666174"> <int key="NSCellFlags">67239424</int> @@ -3029,6 +3045,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 59}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="882064965"> <int key="NSCellFlags">-1804468671</int> @@ -3046,6 +3063,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 33}, {159, 19}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="996160392"> <int key="NSCellFlags">-1804468671</int> @@ -3063,6 +3081,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 85}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="782045166"> <int key="NSCellFlags">-1804468671</int> @@ -3080,6 +3099,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 7}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="160881703"> <int key="NSCellFlags">-1804468671</int> @@ -3098,6 +3118,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 61}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="544940669"> <int key="NSCellFlags">68288064</int> @@ -3114,6 +3135,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 35}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="26059905"> <int key="NSCellFlags">68288064</int> @@ -3130,6 +3152,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 87}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="642636551"> <int key="NSCellFlags">68288064</int> @@ -3146,6 +3169,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 9}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="646676137"> <int key="NSCellFlags">68288064</int> @@ -3162,6 +3186,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 153}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="98025404"> <int key="NSCellFlags">-1804468671</int> @@ -3180,6 +3205,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 180}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSSecureTextFieldCell" key="NSCell" id="682598366"> <int key="NSCellFlags">343014976</int> @@ -3201,6 +3227,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 207}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="983072894"> <int key="NSCellFlags">-1804468671</int> @@ -3218,6 +3245,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 126}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="1015235520"> <int key="NSCellFlags">-1804468671</int> @@ -3236,6 +3264,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{119, 234}, {183, 19}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="153943465"> <int key="NSCellFlags">-1804468671</int> @@ -3253,6 +3282,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 236}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="528636141"> <int key="NSCellFlags">68288064</int> @@ -3269,6 +3299,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 209}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="1047551041"> <int key="NSCellFlags">68288064</int> @@ -3285,6 +3316,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 155}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="860519796"> <int key="NSCellFlags">68288064</int> @@ -3301,6 +3333,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 182}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="33269254"> <int key="NSCellFlags">68288064</int> @@ -3317,6 +3350,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{5, 128}, {109, 14}}</string> <reference key="NSSuperview" ref="404987940"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="596887118"> <int key="NSCellFlags">68288064</int> @@ -3331,6 +3365,7 @@ </object> <string key="NSFrame">{{10, 7}, {335, 262}}</string> <reference key="NSSuperview" ref="961025550"/> + <reference key="NSWindow"/> </object> <string key="NSLabel">SSH</string> <reference key="NSColor" ref="700609571"/> @@ -3351,6 +3386,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{112, 342}, {218, 19}}</string> <reference key="NSSuperview" ref="343315962"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="570809913"> <int key="NSCellFlags">-1804468671</int> @@ -3368,6 +3404,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{9, 344}, {98, 14}}</string> <reference key="NSSuperview" ref="343315962"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="299715951"> <int key="NSCellFlags">68288064</int> @@ -3384,6 +3421,7 @@ <int key="NSvFlags">266</int> <string key="NSFrame">{{109, 313}, {224, 22}}</string> <reference key="NSSuperview" ref="343315962"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="658054386"> <int key="NSCellFlags">-2076049856</int> @@ -3450,6 +3488,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{9, 318}, {98, 14}}</string> <reference key="NSSuperview" ref="343315962"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="761091734"> <int key="NSCellFlags">68288064</int> @@ -3464,16 +3503,20 @@ </object> <string key="NSFrame">{{230, 0}, {350, 381}}</string> <reference key="NSSuperview" ref="141072039"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> </object> <string key="NSFrameSize">{580, 381}</string> <reference key="NSSuperview" ref="593732956"/> + <reference key="NSWindow"/> <bool key="NSIsVertical">YES</bool> <int key="NSDividerStyle">2</int> </object> </object> <string key="NSFrameSize">{580, 381}</string> + <reference key="NSSuperview"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="1041614321"> @@ -11541,7 +11584,7 @@ AQAAAAA</bytes> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{549, 529}, {580, 280}}</string> + <string>{{482, 529}, {580, 280}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSMutableArray"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -11846,7 +11889,7 @@ AQAAAAA</bytes> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> - <string>{{469, 18}, {580, 381}}</string> + <string>{{469, 35}, {580, 381}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -12011,7 +12054,7 @@ AQAAAAA</bytes> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{646, 556}, {254, 6}}</string> + <string>{{672, 785}, {254, 6}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{381, 612}, {175, 53}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -13673,7 +13716,7 @@ AQAAAAA</bytes> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>{16, 8}</string> - <string>{15, 15}</string> + <string>{10, 10}</string> <string>{32, 32}</string> <string>{9, 8}</string> <string>{7, 2}</string> diff --git a/Source/SPGeneralPreferencePane.m b/Source/SPGeneralPreferencePane.m index b43aefb3..094dff70 100644 --- a/Source/SPGeneralPreferencePane.m +++ b/Source/SPGeneralPreferencePane.m @@ -84,16 +84,26 @@ static NSString *SPDatabaseImage = @"database-small"; [defaultFavoritePopup addItemWithTitle:NSLocalizedString(@"Last Used", @"Last Used entry in favorites menu")]; [[defaultFavoritePopup menu] addItem:[NSMenuItem separatorItem]]; - // Add all favorites to the menu - for (SPTreeNode *node in [[[[[SPFavoritesController sharedFavoritesController] favoritesTree] childNodes] objectAtIndex:0] childNodes]) - { - NSArray *items = [self _constructMenuItemsForNode:node atLevel:0]; + NSArray *favorites = [[[[[SPFavoritesController sharedFavoritesController] favoritesTree] childNodes] objectAtIndex:0] childNodes]; + + if ([favorites count] > 0) { - for (NSMenuItem *item in items) + // Add all favorites to the menu + for (SPTreeNode *node in favorites) { - [[defaultFavoritePopup menu] addItem:item]; + NSArray *items = [self _constructMenuItemsForNode:node atLevel:0]; + + for (NSMenuItem *item in items) + { + [[defaultFavoritePopup menu] addItem:item]; + } } } + else { + [defaultFavoritePopup addItemWithTitle:NSLocalizedString(@"No Favorties", @"No favorites entry in favorites menu")]; + + [[defaultFavoritePopup itemAtIndex:2] setEnabled:NO]; + } // Select the default favorite from prefs [defaultFavoritePopup selectItemWithTag:[prefs boolForKey:SPSelectLastFavoriteUsed] ? 0 : [prefs integerForKey:SPDefaultFavorite]]; |