From e945be72f8e476d84c19f712dd79e51a4a3f1e80 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sun, 5 Dec 2010 15:37:40 +0000 Subject: Improve menu item validation with regard to making the selected favorite the default. --- Source/SPConnectionControllerDelegate.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3