Added more the MenuController. All of the main menu things are added in now.
[MenuTunes.git] / MainController.m
index 475a23e..3cf10ab 100755 (executable)
@@ -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