aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-12-05 15:37:40 +0000
committerstuconnolly <stuart02@gmail.com>2010-12-05 15:37:40 +0000
commite945be72f8e476d84c19f712dd79e51a4a3f1e80 (patch)
treeab4ad00cb6c2aa659cea61eb4d8536667a894959
parent4e87089af2ce50364a3e6fcfdf8a3c31e172d8aa (diff)
downloadsequelpro-e945be72f8e476d84c19f712dd79e51a4a3f1e80.tar.gz
sequelpro-e945be72f8e476d84c19f712dd79e51a4a3f1e80.tar.bz2
sequelpro-e945be72f8e476d84c19f712dd79e51a4a3f1e80.zip
Improve menu item validation with regard to making the selected favorite the default.
-rw-r--r--Source/SPConnectionControllerDelegate.m9
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/SPConnectionControllerDelegate.m b/Source/SPConnectionControllerDelegate.m
index f6923ec2..da16fd57 100644
--- a/Source/SPConnectionControllerDelegate.m
+++ b/Source/SPConnectionControllerDelegate.m
@@ -483,10 +483,17 @@
}
// Duplicate and make the selected favorite the default
- if ((action == @selector(duplicateFavorite:)) || (action == @selector(makeSelectedFavoriteDefault:))) {
+ if (action == @selector(duplicateFavorite:)) {
return (([favoritesOutlineView numberOfSelectedRows] == 1) && (![node isGroup]));
}
+ // Make selected favorite the default
+ if (action == @selector(makeSelectedFavoriteDefault:)) {
+ NSInteger favoriteID = [[[self selectedFavorite] objectForKey:SPFavoriteIDKey] integerValue];
+
+ return (([favoritesOutlineView numberOfSelectedRows] == 1) && (![node isGroup]) && (favoriteID != [prefs integerForKey:SPDefaultFavorite]));
+ }
+
// Rename selected favorite/group
if (action == @selector(renameFavorite:)) {
return ([favoritesOutlineView numberOfSelectedRows] == 1);