diff options
author | stuconnolly <stuart02@gmail.com> | 2011-03-17 19:25:56 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2011-03-17 19:25:56 +0000 |
commit | b2a0af91eae18b6490ddeafd2708d256b0d53cb3 (patch) | |
tree | 6fffce3be41ecf2f9a902f7bf795eb9471d81382 | |
parent | 1632c45fdd9d0b8fe1e0aef3e891e8bd5704df29 (diff) | |
download | sequelpro-b2a0af91eae18b6490ddeafd2708d256b0d53cb3.tar.gz sequelpro-b2a0af91eae18b6490ddeafd2708d256b0d53cb3.tar.bz2 sequelpro-b2a0af91eae18b6490ddeafd2708d256b0d53cb3.zip |
Bind the default favorites drop down menu pref to the new favorites data file, with sub-menus representing groups (still a bit buggy).
-rw-r--r-- | Interfaces/English.lproj/Preferences.xib | 128 | ||||
-rw-r--r-- | Source/SPAppController.h | 2 | ||||
-rw-r--r-- | Source/SPGeneralPreferencePane.h | 2 | ||||
-rw-r--r-- | Source/SPGeneralPreferencePane.m | 68 | ||||
-rw-r--r-- | Source/SPTreeNode.m | 14 |
5 files changed, 110 insertions, 104 deletions
diff --git a/Interfaces/English.lproj/Preferences.xib b/Interfaces/English.lproj/Preferences.xib index 6e90ea65..871bf8a9 100644 --- a/Interfaces/English.lproj/Preferences.xib +++ b/Interfaces/English.lproj/Preferences.xib @@ -21,8 +21,6 @@ </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="641"/> - <integer value="802"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -68,44 +66,6 @@ <object class="NSUserDefaultsController" id="151174232"> <bool key="NSSharedInstance">YES</bool> </object> - <object class="NSArrayController" id="937123943"> - <object class="NSMutableArray" key="NSDeclaredKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>name</string> - <string>fav</string> - <string>host</string> - <string>user</string> - <string>database</string> - <string>socket</string> - <string>port</string> - <string>useSSH</string> - <string>sshHost</string> - <string>sshUser</string> - <string>sshPort</string> - <object class="NSMutableString"> - <characters key="NS.bytes">selectedFavoritePassword</characters> - </object> - <string>DisplayTableViewVerticalGridlines</string> - <string>type</string> - <string>TableRowCountQueryLevel</string> - <string>sshKeyLocationEnabled</string> - <string>sshKeyLocation</string> - <string>useSSL</string> - <string>sslKeyFileLocation</string> - <string>sslKeyFileLocationEnabled</string> - <string>sslCertificateFileLocation</string> - <string>sslCertificateFileLocationEnabled</string> - <string>sslCACertFileLocation</string> - <string>sslCACertFileLocationEnabled</string> - <string>CustomQuerySoftIndentWidth</string> - </object> - <bool key="NSEditable">YES</bool> - <bool key="NSAutomaticallyPreparesContent">YES</bool> - <object class="_NSManagedProxy" key="_NSManagedProxy"/> - <bool key="NSSelectsInsertedObjects">YES</bool> - <bool key="NSFilterRestrictsInsertion">YES</bool> - <bool key="NSClearsFilterPredicateOnInsertion">YES</bool> - </object> <object class="NSWindowTemplate" id="1005"> <int key="NSWindowStyleMask">4107</int> <int key="NSWindowBacking">2</int> @@ -2398,6 +2358,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{17, 56}, {204, 17}}</string> <reference key="NSSuperview" ref="769132533"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="1057393276"> <int key="NSCellFlags">67239488</int> @@ -2414,6 +2375,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{224, 19}, {338, 18}}</string> <reference key="NSSuperview" ref="769132533"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="151662644"> <int key="NSCellFlags">-2080244224</int> @@ -2436,6 +2398,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{226, 54}, {50, 22}}</string> <reference key="NSSuperview" ref="769132533"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="170658213"> <int key="NSCellFlags">-1804468671</int> @@ -2498,6 +2461,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{281, 57}, {282, 17}}</string> <reference key="NSSuperview" ref="769132533"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="619604330"> <int key="NSCellFlags">67239488</int> @@ -2514,6 +2478,7 @@ AQAAAAA</bytes> <int key="NSvFlags">12</int> <string key="NSFrame">{{226, 43}, {334, 5}}</string> <reference key="NSSuperview" ref="769132533"/> + <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -2534,6 +2499,7 @@ AQAAAAA</bytes> </object> <string key="NSFrameSize">{580, 93}</string> <reference key="NSSuperview"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="1033452264"> @@ -2546,6 +2512,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{437, 251}, {15, 22}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSStepperCell" key="NSCell" id="241334663"> <int key="NSCellFlags">68025888</int> @@ -2564,6 +2531,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{407, 253}, {23, 19}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="546511116"> <int key="NSCellFlags">-1804468671</int> @@ -2633,6 +2601,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{270, 254}, {131, 18}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="1729"> <int key="NSCellFlags">-2080244224</int> @@ -2655,6 +2624,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{144, 21}, {101, 14}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="983858855"> <int key="NSCellFlags">68288064</int> @@ -2671,6 +2641,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{49, 21}, {93, 14}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="133660147"> <int key="NSCellFlags">68288064</int> @@ -2697,6 +2668,7 @@ AQAAAAA</bytes> <int key="NSvFlags">256</int> <string key="NSFrameSize">{220, 249}</string> <reference key="NSSuperview" ref="25515031"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="_NSCornerView" key="NSCornerView"> <nil key="NSNextResponder"/> @@ -2779,6 +2751,7 @@ AQAAAAA</bytes> </object> <string key="NSFrame">{{1, 1}, {220, 249}}</string> <reference key="NSSuperview" ref="288292400"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="953919633"/> <reference key="NSDocView" ref="953919633"/> <reference key="NSBGColor" ref="887465699"/> @@ -2789,6 +2762,7 @@ AQAAAAA</bytes> <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-100, -100}, {15, 102}}</string> <reference key="NSSuperview" ref="288292400"/> + <reference key="NSWindow"/> <reference key="NSTarget" ref="288292400"/> <string key="NSAction">_doScroller:</string> <double key="NSPercent">0.99658703804016113</double> @@ -2798,6 +2772,7 @@ AQAAAAA</bytes> <int key="NSvFlags">-2147483392</int> <string key="NSFrame">{{-100, -100}, {223, 15}}</string> <reference key="NSSuperview" ref="288292400"/> + <reference key="NSWindow"/> <int key="NSsFlags">1</int> <reference key="NSTarget" ref="288292400"/> <string key="NSAction">_doScroller:</string> @@ -2806,6 +2781,7 @@ AQAAAAA</bytes> </object> <string key="NSFrame">{{20, 47}, {222, 251}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="25515031"/> <int key="NSsFlags">2</int> <reference key="NSVScroller" ref="662661535"/> @@ -2818,6 +2794,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{20, 16}, {24, 24}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="373813305"> <int key="NSCellFlags">71433792</int> @@ -2942,6 +2919,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{407, 19}, {23, 19}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="248584789"> <int key="NSCellFlags">-1804468671</int> @@ -3014,6 +2992,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{269, 21}, {133, 17}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="273262177"> <int key="NSCellFlags">68288064</int> @@ -3030,6 +3009,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{437, 17}, {15, 22}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSStepperCell" key="NSCell" id="93125704"> <int key="NSCellFlags">68025888</int> @@ -3048,6 +3028,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{17, 322}, {182, 17}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="10706281"> <int key="NSCellFlags">68288064</int> @@ -3064,6 +3045,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{433, 313}, {133, 32}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="345790946"> <int key="NSCellFlags">67239424</int> @@ -3084,6 +3066,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{204, 320}, {207, 22}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="66452133"> <int key="NSCellFlags">-2076049856</int> @@ -3101,6 +3084,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{270, 282}, {292, 18}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="823431848"> <int key="NSCellFlags">-2080244224</int> @@ -3123,6 +3107,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{270, 227}, {292, 18}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="743257684"> <int key="NSCellFlags">-2080244224</int> @@ -3145,6 +3130,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{270, 169}, {292, 18}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="231642073"> <int key="NSCellFlags">67239424</int> @@ -3167,6 +3153,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{270, 198}, {292, 18}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="491730308"> <int key="NSCellFlags">-2080244224</int> @@ -3189,6 +3176,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{270, 122}, {292, 18}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="496801621"> <int key="NSCellFlags">-2080244224</int> @@ -3211,6 +3199,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{270, 45}, {292, 18}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="131748905"> <int key="NSCellFlags">67239424</int> @@ -3233,6 +3222,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{270, 94}, {292, 18}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="92164221"> <int key="NSCellFlags">67239424</int> @@ -3255,6 +3245,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{370, 69}, {29, 19}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="409964321"> <int key="NSCellFlags">-1538130368</int> @@ -3328,6 +3319,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{269, 71}, {96, 14}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="1060023867"> <int key="NSCellFlags">605158976</int> @@ -3344,6 +3336,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{405, 67}, {15, 22}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSStepperCell" key="NSCell" id="171005061"> <int key="NSCellFlags">604896800</int> @@ -3362,6 +3355,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{423, 71}, {140, 14}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="201150384"> <int key="NSCellFlags">605158976</int> @@ -3378,6 +3372,7 @@ AQAAAAA</bytes> <int key="NSvFlags">-2147483380</int> <string key="NSFrame">{{270, 0}, {292, 18}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="420702000"> <int key="NSCellFlags">-1543373312</int> @@ -3400,6 +3395,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{370, 144}, {29, 19}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="992523117"> <int key="NSCellFlags">-1538130368</int> @@ -3473,6 +3469,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{269, 146}, {96, 14}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="499174965"> <int key="NSCellFlags">605158976</int> @@ -3489,6 +3486,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{405, 142}, {15, 22}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSStepperCell" key="NSCell" id="266600395"> <int key="NSCellFlags">604896800</int> @@ -3507,6 +3505,7 @@ AQAAAAA</bytes> <int key="NSvFlags">268</int> <string key="NSFrame">{{423, 146}, {140, 14}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="516695546"> <int key="NSCellFlags">605158976</int> @@ -3523,6 +3522,7 @@ AQAAAAA</bytes> <int key="NSvFlags">12</int> <string key="NSFrame">{{204, 309}, {356, 5}}</string> <reference key="NSSuperview" ref="1033452264"/> + <reference key="NSWindow"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> @@ -3543,6 +3543,7 @@ AQAAAAA</bytes> </object> <string key="NSFrameSize">{580, 360}</string> <reference key="NSSuperview"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="301032184"> @@ -3971,35 +3972,6 @@ AQAAAAA</bytes> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> - <string key="label">contentArray: values.favorites</string> - <reference key="source" ref="937123943"/> - <reference key="destination" ref="151174232"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="937123943"/> - <reference key="NSDestination" ref="151174232"/> - <string key="NSLabel">contentArray: values.favorites</string> - <string key="NSBinding">contentArray</string> - <string key="NSKeyPath">values.favorites</string> - <object class="NSDictionary" key="NSOptions"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys"> - <bool key="EncodedWithXMLCoder">YES</bool> - <string>NSDeletesObjectsOnRemove</string> - <string>NSHandlesContentAsCompoundValue</string> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - <boolean value="YES"/> - <boolean value="YES"/> - </object> - </object> - <int key="NSNibBindingConnectorVersion">2</int> - </object> - </object> - <int key="connectionID">782</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> <string key="label">value: values.CustomQueryMaxHistoryItems</string> <reference key="source" ref="155059"/> <reference key="destination" ref="151174232"/> @@ -4838,14 +4810,6 @@ AQAAAAA</bytes> </object> <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> - <string key="label">favoritesController</string> - <reference key="source" ref="343720994"/> - <reference key="destination" ref="937123943"/> - </object> - <int key="connectionID">2078</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBOutletConnection" key="connection"> <string key="label">defaultFavoritePopup</string> <reference key="source" ref="343720994"/> <reference key="destination" ref="331339372"/> @@ -5608,12 +5572,6 @@ AQAAAAA</bytes> <reference key="parent" ref="0"/> </object> <object class="IBObjectRecord"> - <int key="objectID">254</int> - <reference key="object" ref="937123943"/> - <reference key="parent" ref="0"/> - <string key="objectName">Favorites</string> - </object> - <object class="IBObjectRecord"> <int key="objectID">331</int> <reference key="object" ref="721264488"/> <reference key="parent" ref="0"/> @@ -7688,7 +7646,6 @@ AQAAAAA</bytes> <string>24.IBPluginDependency</string> <string>24.ImportedFromIB2</string> <string>25.IBPluginDependency</string> - <string>254.IBPluginDependency</string> <string>26.IBEditorWindowLastContentRect</string> <string>26.IBPluginDependency</string> <string>26.ImportedFromIB2</string> @@ -8148,7 +8105,6 @@ AQAAAAA</bytes> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{646, 14}, {276, 433}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> @@ -8352,7 +8308,7 @@ AQAAAAA</bytes> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <boolean value="YES"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{314, 523}, {580, 360}}</string> + <string>{{406, 257}, {580, 360}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <object class="NSMutableArray"> <bool key="EncodedWithXMLCoder">YES</bool> diff --git a/Source/SPAppController.h b/Source/SPAppController.h index fe80e2d9..5d12be48 100644 --- a/Source/SPAppController.h +++ b/Source/SPAppController.h @@ -30,7 +30,6 @@ @interface SPAppController : NSObject <FRFeedbackReporterDelegate> { - IBOutlet NSWindow* bundleEditorWindow; BOOL isNewFavorite; @@ -55,7 +54,6 @@ NSMutableArray *runningActivitiesArray; NSString *lastBundleBlobFilesDirectory; - } @property (readwrite, retain) NSString *lastBundleBlobFilesDirectory; diff --git a/Source/SPGeneralPreferencePane.h b/Source/SPGeneralPreferencePane.h index ab7ef949..7d14492e 100644 --- a/Source/SPGeneralPreferencePane.h +++ b/Source/SPGeneralPreferencePane.h @@ -35,8 +35,6 @@ @interface SPGeneralPreferencePane : SPPreferencePane <SPPreferencePaneProtocol> { IBOutlet NSPopUpButton *defaultFavoritePopup; - - IBOutlet NSArrayController *favoritesController; } - (IBAction)updateDefaultFavorite:(id)sender; diff --git a/Source/SPGeneralPreferencePane.m b/Source/SPGeneralPreferencePane.m index 36cbed9f..ecc3172a 100644 --- a/Source/SPGeneralPreferencePane.m +++ b/Source/SPGeneralPreferencePane.m @@ -24,6 +24,16 @@ // More info at <http://code.google.com/p/sequel-pro/> #import "SPGeneralPreferencePane.h" +#import "SPFavoritesController.h" +#import "SPTreeNode.h" +#import "SPFavoriteNode.h" +#import "SPGroupNode.h" + +@interface SPGeneralPreferencePane () + +- (NSMenuItem *)_constructMenuItemForNode:(SPTreeNode *)node; + +@end @implementation SPGeneralPreferencePane @@ -37,7 +47,7 @@ { [prefs setBool:([defaultFavoritePopup indexOfSelectedItem] == 0) forKey:SPSelectLastFavoriteUsed]; - [prefs setInteger:[[sender selectedItem] tag] forKey:SPDefaultFavorite]; + [prefs setInteger:[sender tag] forKey:SPDefaultFavorite]; } #pragma mark - @@ -55,15 +65,13 @@ [[defaultFavoritePopup menu] addItem:[NSMenuItem separatorItem]]; // Add all favorites to the menu - for (NSDictionary *favorite in [favoritesController arrangedObjects]) + for (SPTreeNode *node in [[[[[SPFavoritesController sharedFavoritesController] favoritesTree] childNodes] objectAtIndex:0] childNodes]) { - NSMenuItem *favoriteMenuItem = [[NSMenuItem alloc] initWithTitle:[favorite objectForKey:SPFavoriteNameKey] action:NULL keyEquivalent:@""]; - - [favoriteMenuItem setTag:[[favorite objectForKey:SPFavoriteIDKey] integerValue]]; + NSMenuItem *menuItem = [self _constructMenuItemForNode:node]; - [[defaultFavoritePopup menu] addItem:favoriteMenuItem]; + [[defaultFavoritePopup menu] addItem:menuItem]; - [favoriteMenuItem release]; + [menuItem release]; } // Select the default favorite from prefs @@ -76,6 +84,52 @@ } #pragma mark - +#pragma mark Private API + +/** + * Builds a menu item and sub-menu (if required) of the supplied tree node. + * + * @param node The node to build the menu item for + * + * @return The menu item + */ +- (NSMenuItem *)_constructMenuItemForNode:(SPTreeNode *)node +{ + NSMenuItem *menuItem = nil; + + if ([node isGroup]) { + + SPGroupNode *groupNode = (SPGroupNode *)[node representedObject]; + + menuItem = [[NSMenuItem alloc] initWithTitle:[groupNode nodeName] action:NULL keyEquivalent:@""]; + + NSMenu *subMenu = [[NSMenu alloc] initWithTitle:[groupNode nodeName]]; + + for (SPTreeNode *childNode in [node childNodes]) + { + NSMenuItem *innerItem = [self _constructMenuItemForNode:childNode]; + + [subMenu addItem:innerItem]; + + [innerItem release]; + } + + [menuItem setSubmenu:subMenu]; + } + else { + NSDictionary *favorite = [(SPFavoriteNode *)[node representedObject] nodeFavorite]; + + menuItem = [[NSMenuItem alloc] initWithTitle:[favorite objectForKey:SPFavoriteNameKey] action:@selector(updateDefaultFavorite:) keyEquivalent:@""]; + + [menuItem setTag:[[favorite objectForKey:SPFavoriteIDKey] integerValue]]; + + [menuItem setTarget:self]; + } + + return menuItem; +} + +#pragma mark - #pragma mark Preference pane protocol methods - (NSView *)preferencePaneView diff --git a/Source/SPTreeNode.m b/Source/SPTreeNode.m index e197d180..d93db01b 100644 --- a/Source/SPTreeNode.m +++ b/Source/SPTreeNode.m @@ -69,7 +69,7 @@ static NSString *SPTreeNodeIsGroupKey = @"SPTreeNodeIsGroup"; return; } - if (![node isLeaf]) { + if ([node isGroup]) { [node removeObjectFromChildren:object]; } } @@ -88,7 +88,7 @@ static NSString *SPTreeNodeIsGroupKey = @"SPTreeNodeIsGroup"; { [descendants addObject:node]; - if (![node isLeaf]) { + if ([node isGroup]) { [descendants addObjectsFromArray:[node descendants]]; } } @@ -107,7 +107,7 @@ static NSString *SPTreeNodeIsGroupKey = @"SPTreeNodeIsGroup"; for (SPTreeNode *node in [self childNodes]) { - if ([node isLeaf]) { + if (![node isGroup]) { [childLeafs addObject:node]; } } @@ -127,7 +127,7 @@ static NSString *SPTreeNodeIsGroupKey = @"SPTreeNodeIsGroup"; for (SPTreeNode *node in [self childNodes]) { - if ([node isLeaf]) { + if (![node isGroup]) { [childLeafs addObject:node]; } else { @@ -149,7 +149,7 @@ static NSString *SPTreeNodeIsGroupKey = @"SPTreeNodeIsGroup"; for (SPTreeNode *node in [self childNodes]) { - if (![node isLeaf]) { + if ([node isGroup]) { [groupChildren addObject:node]; } } @@ -177,7 +177,7 @@ static NSString *SPTreeNodeIsGroupKey = @"SPTreeNodeIsGroup"; break; } - if (![node isLeaf]) { + if ([node isGroup]) { SPTreeNode *innerNode = [self parentFromArray:[node childNodes]]; if (innerNode) { @@ -205,7 +205,7 @@ static NSString *SPTreeNodeIsGroupKey = @"SPTreeNodeIsGroup"; if (node == self) return YES; // Check all the sub-nodes - if (![node isLeaf]) { + if ([node isGroup]) { if ([self isDescendantOfOrOneOfNodes:[node childNodes]]) { return YES; } |