Added the "No upcoming songs." if it's the end of the playlist or if
authorKent Sutherland <ksuther@ithinksw.com>
Tue, 18 Nov 2003 00:55:18 +0000 (00:55 +0000)
committerKent Sutherland <ksuther@ithinksw.com>
Tue, 18 Nov 2003 00:55:18 +0000 (00:55 +0000)
there are none left to the submenu and to the upcoming songs status window.

MainController.m
MenuController.m

index 5637bae..1c7905b 100755 (executable)
@@ -741,7 +741,6 @@ static MainController *sharedController;
 - (void)showUpcomingSongs
 {
     int numSongs;
-    
     NS_DURING
         numSongs = [[self currentRemote] numberOfSongsInPlaylistAtIndex:[[self currentRemote] currentPlaylistIndex]];
     NS_HANDLER
@@ -751,8 +750,8 @@ static MainController *sharedController;
     ITDebugLog(@"Showing upcoming songs status window.");
     NS_DURING
         if (numSongs > 0) {
-            NSMutableArray *songList = [NSMutableArray arrayWithCapacity:5];
             int numSongsInAdvance = [df integerForKey:@"SongsInAdvance"];
+            NSMutableArray *songList = [NSMutableArray arrayWithCapacity:numSongsInAdvance];
             int curTrack = [[self currentRemote] currentSongIndex];
             int i;
     
@@ -762,6 +761,10 @@ static MainController *sharedController;
                 }
             }
             
+            if ([songList count] == 0) {
+                [songList addObject:NSLocalizedString(@"noUpcomingSongs", @"No upcoming songs.")];
+            }
+            
             [statusWindowController showUpcomingSongsWindowWithTitles:songList];
         } else {
             [statusWindowController showUpcomingSongsWindowWithTitles:[NSArray arrayWithObject:NSLocalizedString(@"noUpcomingSongs", @"No upcoming songs.")]];
index 4898c09..088d337 100755 (executable)
                 }
             }
         }
+        
+        if ([upcomingSongsMenu numberOfItems] == 0) {
+            [upcomingSongsMenu addItemWithTitle:NSLocalizedString(@"noUpcomingSongs", @"No upcoming songs.") action:NULL keyEquivalent:@""];
+        }
     }
     ITDebugLog(@"Done Building \"Upcoming Songs\" menu.");
     return upcomingSongsMenu;