X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/13cf91d9f8bff4826b27829e441ad75efed02cdb..62c12e7f7c182a22969de8ebb233db31d9965454:/MenuController.m diff --git a/MenuController.m b/MenuController.m index 668f961..4b4ee50 100755 --- a/MenuController.m +++ b/MenuController.m @@ -21,8 +21,8 @@ - (NSMenu *)playlistsMenu; - (NSMenu *)eqMenu; - (void)setKeyEquivalentForCode:(short)code andModifiers:(long)modifiers - onItem:(NSMenuItem *)item; -- (BOOL)iPodAtPathAutomaticallyUpdates:(NSString *)name; + onItem:(id )item; +- (BOOL)iPodWithNameAutomaticallyUpdates:(NSString *)name; @end @implementation MenuController @@ -42,7 +42,7 @@ NSArray *menuArray = [defaults arrayForKey:@"menu"]; NSEnumerator *enumerator = [menuArray objectEnumerator]; NSString *nextObject; - NSMenuItem *tempItem; + id tempItem; NSEnumerator *itemEnum; ITHotKey *hotKey; NSArray *hotKeys = [[ITHotKeyCenter sharedCenter] allHotKeys]; @@ -399,7 +399,7 @@ - (NSMenu *)menuForNoPlayer { NSMenu *menu = [[NSMenu alloc] initWithTitle:@""]; - NSMenuItem *tempItem; + id tempItem; ITDebugLog(@"Creating menu for when player isn't running."); NS_DURING ITDebugLog(@"Add \"Open %@\" menu item.", [[[MainController sharedController] currentRemote] playerSimpleName]); @@ -438,6 +438,7 @@ NS_HANDLER [[MainController sharedController] networkError:localException]; NS_ENDHANDLER + ITDebugLog(@"Releasing old submenus."); [_ratingMenu release]; [_upcomingSongsMenu release]; [_playlistsMenu release]; @@ -497,7 +498,6 @@ if (_currentPlaylist && !_playingRadio) { if (numSongs > 0) { int i; - for (i = _currentTrack + 1; i <= _currentTrack + numSongsInAdvance; i++) { if (i <= numSongs) { NSString *curSong; @@ -506,7 +506,7 @@ NS_HANDLER [[MainController sharedController] networkError:localException]; NS_ENDHANDLER - NSMenuItem *songItem; + id songItem; ITDebugLog(@"Adding song: %@", curSong); songItem = [upcomingSongsMenu addItemWithTitle:curSong action:@selector(performUpcomingSongsMenuAction:) keyEquivalent:@""]; [songItem setTag:i]; @@ -525,11 +525,11 @@ return upcomingSongsMenu; } -- (NSMenu *)playlistsMenu +/*- (NSMenu *)playlistsMenu { NSMenu *playlistsMenu = [[NSMenu alloc] initWithTitle:@""]; NSArray *playlists; - NSMenuItem *tempItem; + id tempItem; ITMTRemotePlayerSource source = [[[MainController sharedController] currentRemote] currentSource]; int i; NS_DURING @@ -563,14 +563,14 @@ } ITDebugLog(@"Done Building \"Playlists\" menu"); return playlistsMenu; -} +}*/ -/*- (NSMenu *)playlistsMenu +- (NSMenu *)playlistsMenu { NSMenu *playlistsMenu = [[NSMenu alloc] initWithTitle:@""]; NSArray *playlists; - NSMenuItem *tempItem; + id tempItem; ITMTRemotePlayerSource source = [[[MainController sharedController] currentRemote] currentSource]; int i, j; NS_DURING @@ -590,7 +590,6 @@ [tempItem setTarget:self]; } } - if ( (source == ITMTRemoteRadioSource) || ([playlists count] - 2 > 0) ) { [playlistsMenu addItem:[NSMenuItem separatorItem]]; } @@ -605,7 +604,14 @@ 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++) { @@ -627,13 +633,13 @@ } ITDebugLog(@"Done Building \"Playlists\" menu"); return playlistsMenu; -}*/ +} - (NSMenu *)eqMenu { NSMenu *eqMenu = [[NSMenu alloc] initWithTitle:@""]; NSArray *eqPresets; - NSMenuItem *tempItem; + id tempItem; int i; NS_DURING @@ -761,7 +767,7 @@ } - (void)setKeyEquivalentForCode:(short)code andModifiers:(long)modifiers - onItem:(NSMenuItem *)item + onItem:(id )item { unichar charcode = 'a'; int i; @@ -980,7 +986,7 @@ 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]; @@ -1010,6 +1016,7 @@ } } } + return NO; } @end \ No newline at end of file