w00t. If player application is not running, instead of simply saying so,
authorJoseph Spiros <joseph.spiros@ithinksw.com>
Sun, 16 Mar 2003 06:06:06 +0000 (06:06 +0000)
committerJoseph Spiros <joseph.spiros@ithinksw.com>
Sun, 16 Mar 2003 06:06:06 +0000 (06:06 +0000)
MenuTunes provides the user with a quick item to launch the player.

ITMTRemote.h
ITMTRemote.m
MenuTunes.h
MenuTunes.m
iTunesRemote.m

index 137b859..07dec73 100755 (executable)
@@ -166,6 +166,11 @@ typedef enum {
  */
 - (NSDictionary *)capabilities;
 
+/*!
+ * @method showPrimaryInterface
+ */
+- (BOOL)showPrimaryInterface;
+
 /*!
  * @method playerRunningState
  * @abstract Returns the running state of the remote's player.
index 8753f6d..50fcb21 100755 (executable)
                 nil];
 }
 
+- (BOOL)showPrimaryInterface
+{
+    return NO;
+}
+
 - (ITMTRemotePlayerRunningState)playerRunningState
 {
     return nil;
index 393c5ec..e45925a 100755 (executable)
@@ -75,4 +75,6 @@
 - (void)clearHotKeys;
 - (void)closePreferences;
 
+- (void)showPlayer;
+
 @end
index eea31d2..0c08e20 100755 (executable)
     
     [menu release];
     menu = [[NSMenu alloc] initWithTitle:@""];
-    [menu addItemWithTitle:@"Audio Player" action:NULL keyEquivalent:@""];
-    [menu addItemWithTitle:@"Not Running" action:NULL keyEquivalent:@""];
+    [[menu addItemWithTitle:[NSString stringWithFormat:@"Open %@", [currentRemote playerSimpleName]] action:@selector(showPlayer:) keyEquivalent:@""] setTarget:self];
     [menu addItem:[NSMenuItem separatorItem]];
     [[menu addItemWithTitle:@"Preferences" action:@selector(showPreferences:) keyEquivalent:@""] setTarget:self];
     [[menu addItemWithTitle:@"Quit" action:@selector(quitMenuTunes:) keyEquivalent:@""] setTarget:self];
     prefsController = nil;
 }
 
+- (void)showPlayer:(id)sender
+{
+    if ( ( isAppRunning == ITMTRemotePlayerRunning) ) {
+        [currentRemote showPrimaryInterface];
+    } else {
+        if (![[NSWorkspace sharedWorkspace] launchApplication:[currentRemote playerFullName]]) {
+            NSLog(@"Error Launching Player");
+        }
+    }
+}
+        
+
 //
 //
 // Show Current Track Info And Show Upcoming Songs Floaters
index 59bffe1..e286598 100755 (executable)
                 nil];
 }
 
+- (BOOL)showPrimaryInterface
+{
+    return NO;
+}
+
 - (ITMTRemotePlayerRunningState)playerRunningState
 {
     NSArray *apps = [[NSWorkspace sharedWorkspace] launchedApplications];