Hopefully fixed one last bug with the multisource playlists. Added some
[MenuTunes.git] / MenuController.m
index 4ab0bf4..4b4ee50 100755 (executable)
@@ -22,7 +22,7 @@
 - (NSMenu *)eqMenu;
 - (void)setKeyEquivalentForCode:(short)code andModifiers:(long)modifiers
         onItem:(id <NSMenuItem>)item;
-- (BOOL)iPodAtPathAutomaticallyUpdates:(NSString *)name;
+- (BOOL)iPodWithNameAutomaticallyUpdates:(NSString *)name;
 @end
 
 @implementation MenuController
     NS_HANDLER
         [[MainController sharedController] networkError:localException];
     NS_ENDHANDLER
+    ITDebugLog(@"Releasing old submenus.");
     [_ratingMenu release];
     [_upcomingSongsMenu release];
     [_playlistsMenu release];
     if (_currentPlaylist && !_playingRadio) {
         if (numSongs > 0) {
             int i;
-
             for (i = _currentTrack + 1; i <= _currentTrack + numSongsInAdvance; i++) {
                 if (i <= numSongs) {
                     NSString *curSong;
         NSMenu *submenu = [[NSMenu alloc] init];
         ITDebugLog(@"Adding source: %@", name);
         
-        if ( ([[curPlaylist objectAtIndex:i] intValue] == ITMTRemoteiPodSource) && (![self iPodAtPathAutomaticallyUpdates:[curPlaylist objectAtIndex:j]]) ) {
+        if ([[curPlaylist objectAtIndex:1] intValue] == ITMTRemoteiPodSource) {
+            NSLog(@"We have an iPod!");
+            NSLog(@"This iPod is named %@!", name);
+            NSLog(@"Does it update automagically?");
+            NSLog(@"Result: %i", [self iPodWithNameAutomaticallyUpdates:name]);
+        }
+        
+        if ( ([[curPlaylist objectAtIndex:1] intValue] == ITMTRemoteiPodSource) && [self iPodWithNameAutomaticallyUpdates:name] ) {
             ITDebugLog(@"Invalid iPod source.");
         } else {
             for (j = 2; j < [curPlaylist count]; j++) {
     ITDebugLog(@"Done setting key equivalent on menu item: %@", [item title]);
 }
 
-- (BOOL)iPodAtPathAutomaticallyUpdates:(NSString *)name
+- (BOOL)iPodWithNameAutomaticallyUpdates:(NSString *)name
 {
     NSArray *volumes = [[NSWorkspace sharedWorkspace] mountedLocalVolumePaths];
     NSEnumerator *volEnum = [volumes objectEnumerator];