diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPGeneralPreferencePane.m | 22 |
1 files changed, 16 insertions, 6 deletions
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]]; |