NS_DURING
[[_eqMenu itemAtIndex:0] setState:[mtr equalizerEnabled] ? NSOnState : NSOffState];
[[_eqMenu itemAtIndex:([mtr currentEQPresetIndex] + 1)] setState:NSOnState];
- [[_eqMenu itemAtIndex:([mtr currentEQPresetIndex] - 1)] setState:NSOnState];
NS_HANDLER
[[MainController sharedController] networkError:localException];
NS_ENDHANDLER
tempItem = [eqMenu addItemWithTitle:@"Enabled" action:@selector(performEqualizerMenuAction:) keyEquivalent:@""];
[tempItem setTag:-1];
[tempItem setTarget:self];
- NS_DURING
- [tempItem setState:[[[MainController sharedController] currentRemote] equalizerEnabled] ? NSOnState : NSOffState];
- NS_HANDLER
- [[MainController sharedController] networkError:localException];
- NS_ENDHANDLER
[eqMenu addItem:[NSMenuItem separatorItem]];
for (i = 0; i < [eqPresets count]; i++) {
- (NSMenu *)artistsMenu
{
- NSMenu *artistsMenu = [[NSMenu alloc] initWithTitle:@""];
+ NSMenu *artistsMenu = [[NSMenu alloc] initWithTitle:@"Artists"];
NSEnumerator *artistsEnumerator;
NSString *nextArtist;
id <NSMenuItem> tempItem;
artistsEnumerator = [[[[MainController sharedController] currentRemote] artists] objectEnumerator];
while ( (nextArtist = [artistsEnumerator nextObject]) ) {
tempItem = [artistsMenu addItemWithTitle:nextArtist action:@selector(performBrowseMenuAction:) keyEquivalent:@""];
- [tempItem setRepresentedObject:nextArtist];
- [tempItem setTag:1];
[tempItem setTarget:self];
}
NS_HANDLER
- (NSMenu *)albumsMenu
{
- NSMenu *albumsMenu = [[NSMenu alloc] initWithTitle:@""];
+ NSMenu *albumsMenu = [[NSMenu alloc] initWithTitle:@"Albums"];
NSEnumerator *albumsEnumerator;
NSString *nextAlbum;
id <NSMenuItem> tempItem;
albumsEnumerator = [[[[MainController sharedController] currentRemote] albums] objectEnumerator];
while ( (nextAlbum = [albumsEnumerator nextObject]) ) {
tempItem = [albumsMenu addItemWithTitle:nextAlbum action:@selector(performBrowseMenuAction:) keyEquivalent:@""];
- [tempItem setRepresentedObject:nextAlbum];
- [tempItem setTag:2];
[tempItem setTarget:self];
}
NS_HANDLER
- (void)performBrowseMenuAction:(id)sender
{
- ITDebugLog(@"Browse action selected on item with object %@ and tag %i", [sender representedObject], [sender tag]);
+ ITDebugLog(@"Browse action selected on item named %@", [sender title]);
/*
** 1 - Artist
** 2 - Album
** 3 - Genre?
*/
- [[MainController sharedController] makePlaylistWithTerm:[sender representedObject] ofType:[sender tag]];
+ [[MainController sharedController] makePlaylistWithTerm:[sender title] ofType:(([[[sender menu] title] isEqualToString:@"Artists"]) ? 1 : 2)];
}
- (void)updateMenu