diff --git a/Application/AppController.h b/Application/AppController.h index 90f7fd197..a0203cd22 100644 --- a/Application/AppController.h +++ b/Application/AppController.h @@ -40,6 +40,9 @@ IBOutlet NSMenuItem *showLengthColumn; IBOutlet NSMenuItem *showTrackColumn; IBOutlet NSMenuItem *showYearColumn; + + IBOutlet NSMenu *dockMenu; + IBOutlet NSMenuItem *currentArtistItem; IBOutlet NSWindowController *spotlightWindowController; diff --git a/Application/AppController.m b/Application/AppController.m index a3a1de87e..7f89f9746 100644 --- a/Application/AppController.m +++ b/Application/AppController.m @@ -203,6 +203,11 @@ void* kAppControllerContext = &kAppControllerContext; FileTreeOutlineView* outlineView = [fileTreeViewController outlineView]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(nodeExpanded:) name:NSOutlineViewItemDidExpandNotification object:outlineView]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(nodeCollapsed:) name:NSOutlineViewItemDidCollapseNotification object:outlineView]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDockMenu:) name:CogPlaybackDidBeginNotficiation object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDockMenu:) name:CogPlaybackDidStopNotficiation object:nil]; + + [self updateDockMenu:nil]; NSArray *expandedNodesArray = [[NSUserDefaults standardUserDefaults] valueForKey:@"fileTreeViewExpandedNodes"]; @@ -626,4 +631,21 @@ void* kAppControllerContext = &kAppControllerContext; [miniWindow setLevel:level]; } +- (void)updateDockMenu:(NSNotification *)notification +{ + PlaylistEntry *pe = [playlistController currentEntry]; + + BOOL hideItem = NO; + + if ([[notification name] isEqualToString:CogPlaybackDidStopNotficiation] || !pe || ![pe artist] || [[pe artist] isEqualToString:@""]) + hideItem = YES; + + if (hideItem && [dockMenu indexOfItem:currentArtistItem] == 0) { + [dockMenu removeItem:currentArtistItem]; + } + else if (!hideItem && [dockMenu indexOfItem:currentArtistItem] < 0) { + [dockMenu insertItem:currentArtistItem atIndex:0]; + } +} + @end diff --git a/Base.lproj/MainMenu.xib b/Base.lproj/MainMenu.xib index 846a7cc0f..9c1cfc9aa 100644 --- a/Base.lproj/MainMenu.xib +++ b/Base.lproj/MainMenu.xib @@ -32,7 +32,7 @@ - + @@ -657,7 +657,7 @@ - + @@ -1504,7 +1504,9 @@ Gw + +