X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/9ba1419655d7d247210a4ed2e7a220ddf82d80cb..5f3aa6959c1903bcb1194b9d0ec24d33906e4f9d:/MainController.m diff --git a/MainController.m b/MainController.m index 475a23e..3cf10ab 100755 --- a/MainController.m +++ b/MainController.m @@ -1,7 +1,9 @@ #import "NewMainController.h" +#import "MenuController.h" #import "PreferencesController.h" #import "HotKeyCenter.h" #import "StatusWindowController.h" +#import "StatusItemHack.h" @interface MainController(Private) - (ITMTRemote *)loadRemote; @@ -32,6 +34,7 @@ static MainController *sharedController; remoteArray = [[NSMutableArray alloc] initWithCapacity:1]; statusWindowController = [[StatusWindowController alloc] init]; + menuController = [[MenuController alloc] init]; df = [[NSUserDefaults standardUserDefaults] retain]; [self setLatestSongIdentifier:@"0-0"]; } @@ -60,6 +63,7 @@ static MainController *sharedController; [[PreferencesController sharedPrefs] registerDefaults]; } + [StatusItemHack install]; statusItem = [[ITStatusItem alloc] initWithStatusBar:[NSStatusBar systemStatusBar] withLength:NSSquareStatusItemLength]; @@ -152,7 +156,6 @@ static MainController *sharedController; if ( ( [self songChanged] ) || ( ([self radioIsPlaying]) && (latestPlaylistClass != ITMTRemotePlayerRadioPlaylist) ) || ( (! [self radioIsPlaying]) && (latestPlaylistClass == ITMTRemotePlayerRadioPlaylist) ) ) { - //[statusItem setMenu:[self menu]]; [self setLatestSongIdentifier:[currentRemote currentSongUniqueIdentifier]]; latestPlaylistClass = [currentRemote currentPlaylistClass]; @@ -160,16 +163,15 @@ static MainController *sharedController; [self showCurrentTrackInfo]; } } -/* - //Update Play/Pause menu item - if (playPauseItem){ - if ([currentRemote playerPlayingState] == ITMTRemotePlayerPlaying) { - [playPauseItem setTitle:@"Pause"]; - } else { - [playPauseItem setTitle:@"Play"]; - } +} + +- (void)menuClicked +{ + if ([currentRemote playerRunningState] == ITMTRemotePlayerRunning) { + [statusItem setMenu:[menuController menu]]; + } else { + [statusItem setMenu:[menuController menuForNoPlayer]]; } -*/ } // @@ -464,8 +466,6 @@ static MainController *sharedController; refreshTimer = nil; [self clearHotKeys]; playerRunningState = ITMTRemotePlayerNotRunning; - - [statusItem setMenu:[self menuForNoPlayer]]; } } @@ -498,8 +498,9 @@ static MainController *sharedController; [currentRemote halt]; [statusItem release]; [statusWindowController release]; + [menuController release]; [super dealloc]; } -@end +@end \ No newline at end of file