aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPPreferenceController.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-04-16 13:55:04 +0000
committerrowanbeentje <rowan@beent.je>2009-04-16 13:55:04 +0000
commit02cc3edfc5a0c64de768812220e78aba26aab81f (patch)
tree97627a337962cfc88fd52af6d98ef1b52aff1d7d /Source/SPPreferenceController.m
parent20c46135604cfd3a38c55647438264e5360c80a4 (diff)
downloadsequelpro-02cc3edfc5a0c64de768812220e78aba26aab81f.tar.gz
sequelpro-02cc3edfc5a0c64de768812220e78aba26aab81f.tar.bz2
sequelpro-02cc3edfc5a0c64de768812220e78aba26aab81f.zip
- The connection sheet Edit button now opens the favourites list in preferences and selects appropriately; this resolves the initially planned changes for Issue #232.
- Move updateDefaultFavoritePopup in SPPreferenceController to a public method and set TableDocument to update it when adding favorites
Diffstat (limited to 'Source/SPPreferenceController.m')
-rw-r--r--Source/SPPreferenceController.m88
1 files changed, 48 insertions, 40 deletions
diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m
index dc4b98c7..80f32e36 100644
--- a/Source/SPPreferenceController.m
+++ b/Source/SPPreferenceController.m
@@ -41,7 +41,6 @@
- (void)_setupToolbar;
- (void)_resizeWindowForContentView:(NSView *)view;
-- (void)_updateDefaultFavoritePopup;
@end
@@ -82,7 +81,7 @@
[favoritesTableView selectRowIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
[favoritesTableView reloadData];
- [self _updateDefaultFavoritePopup];
+ [self updateDefaultFavoritePopup];
}
#pragma mark -
@@ -236,7 +235,7 @@
[favoritesController addObject:favorite];
[favoritesTableView reloadData];
- [self _updateDefaultFavoritePopup];
+ [self updateDefaultFavoritePopup];
}
// -------------------------------------------------------------------------------
@@ -272,7 +271,7 @@
[favoritesController removeObjectAtArrangedObjectIndex:[favoritesTableView selectedRow]];
[favoritesTableView reloadData];
- [self _updateDefaultFavoritePopup];
+ [self updateDefaultFavoritePopup];
}
}
@@ -308,7 +307,7 @@
[favoritesController addObject:favorite];
[favoritesTableView reloadData];
- [self _updateDefaultFavoritePopup];
+ [self updateDefaultFavoritePopup];
}
}
@@ -501,7 +500,7 @@
if ([prefs integerForKey:@"DefaultFavorite"] == originalRow) {
[prefs setInteger:destinationRow forKey:@"DefaultFavorite"];
}
- [self _updateDefaultFavoritePopup];
+ [self updateDefaultFavoritePopup];
return YES;
}
@@ -685,6 +684,49 @@
}
+#pragma mark -
+#pragma mark Other
+
+
+// -------------------------------------------------------------------------------
+// updateDefaultFavoritePopup:
+//
+// Build the default favorite popup button
+// -------------------------------------------------------------------------------
+- (void)updateDefaultFavoritePopup;
+{
+ [defaultFavoritePopup removeAllItems];
+
+ // Use the last used favorite
+ [defaultFavoritePopup addItemWithTitle:@"Last Used"];
+ [[defaultFavoritePopup menu] addItem:[NSMenuItem separatorItem]];
+
+ // Load in current favorites
+ [defaultFavoritePopup addItemsWithTitles:[[favoritesController arrangedObjects] valueForKeyPath:@"name"]];
+
+ // Add item to switch to edit favorites pane
+ [[defaultFavoritePopup menu] addItem:[NSMenuItem separatorItem]];
+ [defaultFavoritePopup addItemWithTitle:@"Edit Favorites…"];
+ [[[defaultFavoritePopup menu] itemWithTitle:@"Edit Favorites…"] setAction:@selector(displayFavoritePreferences:)];
+ [[[defaultFavoritePopup menu] itemWithTitle:@"Edit Favorites…"] setTarget:self];
+
+ // Select the default favorite from prefs
+ if (![prefs boolForKey:@"SelectLastFavoriteUsed"]) {
+ [defaultFavoritePopup selectItemAtIndex:[prefs integerForKey:@"DefaultFavorite"] + 2];
+ } else {
+ [defaultFavoritePopup selectItemAtIndex:0];
+ }
+}
+
+// -------------------------------------------------------------------------------
+// selectFavorite:
+//
+// Selects the specified favorite(s) in the favorites list
+// -------------------------------------------------------------------------------
+- (void)selectFavorites:(NSArray *)favorites
+{
+ [favoritesController setSelectedObjects:favorites];
+}
@end
@@ -783,38 +825,4 @@
[view setFrameOrigin:NSMakePoint(0, 0)];
}
-
-
-// -------------------------------------------------------------------------------
-// _updateDefaultFavoritePopup:
-//
-// Build the default favorite popup button
-// -------------------------------------------------------------------------------
-- (void)_updateDefaultFavoritePopup;
-{
- [defaultFavoritePopup removeAllItems];
-
- // Use the last used favorite
- [defaultFavoritePopup addItemWithTitle:@"Last Used"];
- [[defaultFavoritePopup menu] addItem:[NSMenuItem separatorItem]];
-
- // Load in current favorites
- [defaultFavoritePopup addItemsWithTitles:[[favoritesController arrangedObjects] valueForKeyPath:@"name"]];
-
- // Add item to switch to edit favorites pane
- [[defaultFavoritePopup menu] addItem:[NSMenuItem separatorItem]];
- [defaultFavoritePopup addItemWithTitle:@"Edit Favorites…"];
- [[[defaultFavoritePopup menu] itemWithTitle:@"Edit Favorites…"] setAction:@selector(displayFavoritePreferences:)];
- [[[defaultFavoritePopup menu] itemWithTitle:@"Edit Favorites…"] setTarget:self];
-
- // Select the default favorite from prefs
- if (![prefs boolForKey:@"SelectLastFavoriteUsed"]) {
- [defaultFavoritePopup selectItemAtIndex:[prefs integerForKey:@"DefaultFavorite"] + 2];
- } else {
- [defaultFavoritePopup selectItemAtIndex:0];
- }
-}
-
-
-
@end