From 479952e2cf104d1f984108c5b672d8fbb039eebe Mon Sep 17 00:00:00 2001 From: Joseph Spiros Date: Sun, 16 Mar 2003 06:06:06 +0000 Subject: [PATCH] w00t. If player application is not running, instead of simply saying so, MenuTunes provides the user with a quick item to launch the player. --- ITMTRemote.h | 5 +++++ ITMTRemote.m | 5 +++++ MenuTunes.h | 2 ++ MenuTunes.m | 15 +++++++++++++-- iTunesRemote.m | 5 +++++ 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/ITMTRemote.h b/ITMTRemote.h index 137b859..07dec73 100755 --- a/ITMTRemote.h +++ b/ITMTRemote.h @@ -166,6 +166,11 @@ typedef enum { */ - (NSDictionary *)capabilities; +/*! + * @method showPrimaryInterface + */ +- (BOOL)showPrimaryInterface; + /*! * @method playerRunningState * @abstract Returns the running state of the remote's player. diff --git a/ITMTRemote.m b/ITMTRemote.m index 8753f6d..50fcb21 100755 --- a/ITMTRemote.m +++ b/ITMTRemote.m @@ -59,6 +59,11 @@ nil]; } +- (BOOL)showPrimaryInterface +{ + return NO; +} + - (ITMTRemotePlayerRunningState)playerRunningState { return nil; diff --git a/MenuTunes.h b/MenuTunes.h index 393c5ec..e45925a 100755 --- a/MenuTunes.h +++ b/MenuTunes.h @@ -75,4 +75,6 @@ - (void)clearHotKeys; - (void)closePreferences; +- (void)showPlayer; + @end diff --git a/MenuTunes.m b/MenuTunes.m index eea31d2..0c08e20 100755 --- a/MenuTunes.m +++ b/MenuTunes.m @@ -749,8 +749,7 @@ [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]; @@ -875,6 +874,18 @@ 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 diff --git a/iTunesRemote.m b/iTunesRemote.m index 59bffe1..e286598 100755 --- a/iTunesRemote.m +++ b/iTunesRemote.m @@ -69,6 +69,11 @@ nil]; } +- (BOOL)showPrimaryInterface +{ + return NO; +} + - (ITMTRemotePlayerRunningState)playerRunningState { NSArray *apps = [[NSWorkspace sharedWorkspace] launchedApplications]; -- 2.20.1