X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/26e7dbbdfdddcb98beb83c19a83b8e35416821ff..a01e3db7219fd9c6401e3499551c80d2009135b5:/MenuTunes.m?ds=sidebyside diff --git a/MenuTunes.m b/MenuTunes.m index 7c5e543..54f5768 100755 --- a/MenuTunes.m +++ b/MenuTunes.m @@ -594,7 +594,7 @@ Things to do: - (void)timerUpdate { int playlist = [currentRemote currentPlaylistIndex]; - PlayerState playerState = [currentRemote playerState]; + ITMTRemotePlayerState playerState = [currentRemote playerState]; if ((playlist > 0) || playerState != stopped) { int trackPlayingIndex = [currentRemote currentSongIndex]; @@ -661,6 +661,41 @@ Things to do: [playPauseMenuItem setTitle:@"Play"]; } } + } else if ((lastPlaylistIndex > 0) && (playlist == 0)) { + NSMenuItem *menuItem; + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + //Remote the now playing item and add no song item + [menu removeItemAtIndex:trackInfoIndex]; + + if ([defaults boolForKey:@"showName"] == YES) { + [menu removeItemAtIndex:trackInfoIndex]; + } + + if ([defaults boolForKey:@"showTime"] == YES) { + [menu removeItemAtIndex:trackInfoIndex]; + } + + if (didHaveArtistName && [defaults boolForKey:@"showArtist"]) { + [menu removeItemAtIndex:trackInfoIndex]; + } + + if (didHaveAlbumName && [defaults boolForKey:@"showAlbum"]) { + [menu removeItemAtIndex:trackInfoIndex]; + } + + [playPauseMenuItem setTitle:@"Play"]; + + didHaveArtistName = NO; + didHaveAlbumName = NO; + lastPlaylistIndex = -1; + lastSongIndex = -1; + + [upcomingSongsItem setSubmenu:nil]; + [upcomingSongsItem setEnabled:NO]; + + menuItem = [[NSMenuItem alloc] initWithTitle:@"No Song" action:nil keyEquivalent:@""]; + [menu insertItem:menuItem atIndex:trackInfoIndex]; + [menuItem release]; } } @@ -713,7 +748,9 @@ Things to do: int playlist = [[sender representedObject] intValue]; if (!isPlayingRadio) { int curPlaylist = [currentRemote currentPlaylistIndex]; - [[playlistMenu itemAtIndex:curPlaylist - 1] setState:NSOffState]; + if (curPlaylist > 0) { + [[playlistMenu itemAtIndex:curPlaylist - 1] setState:NSOffState]; + } } [currentRemote switchToPlaylistAtIndex:playlist]; [[playlistMenu itemAtIndex:playlist - 1] setState:NSOnState]; @@ -731,7 +768,7 @@ Things to do: - (void)playPause:(id)sender { - PlayerState state = [currentRemote playerState]; + ITMTRemotePlayerState state = [currentRemote playerState]; if (state == playing) { [currentRemote pause];