- if (playlist != lastPlaylistIndex) {
- BOOL wasPlayingRadio = isPlayingRadio;
- isPlayingRadio = ([currentRemote classOfPlaylistAtIndex:playlist] == ITMTRemotePlayerRadioPlaylist);
-
- if (isPlayingRadio && !wasPlayingRadio) {
- int i;
- for (i = 0; i < [playlistMenu numberOfItems]; i++) {
- [[playlistMenu itemAtIndex:i] setState:NSOffState];
- }
- }
-
- if (wasPlayingRadio) {
- NSMenuItem *temp = [[NSMenuItem alloc] initWithTitle:@"" action:NULL keyEquivalent:@""];
- [menu insertItem:temp atIndex:trackInfoIndex + 1];
- [temp release];
- }
-
- if (!isPlayingRadio) {
- int i;
- for (i = 0; i < [playlistMenu numberOfItems]; i++)
- {
- [[playlistMenu itemAtIndex:i] setState:NSOffState];
- }
- [[playlistMenu itemAtIndex:playlist - 1] setState:NSOnState];
- }
-
- [self updateMenu];
- lastSongIndex = trackPlayingIndex;
- lastPlaylistIndex = playlist;
- }
- }
- //Update Play/Pause menu item
- if (playPauseMenuItem){
- if (playerPlayingState == ITMTRemotePlayerPlaying) {
- [playPauseMenuItem setTitle:@"Pause"];
- } else {
- [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];