X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/28b26b0acce681c25cd8bf5ac7fc8881794afb36..dc685d1d1cffcfd6bb95dd948c30f1dc315919e0:/MainController.m diff --git a/MainController.m b/MainController.m index c235a8f..c4fd253 100755 --- a/MainController.m +++ b/MainController.m @@ -392,7 +392,7 @@ static MainController *sharedController; } if ([networkController isConnectedToServer]) { - [statusItem setMenu:[menuController menu]]; + [statusItem setMenu:([[self currentRemote] playerRunningState] == ITMTRemotePlayerRunning) ? [menuController menu] : [menuController menuForNoPlayer]]; } } @@ -533,14 +533,14 @@ static MainController *sharedController; - (void)showPlayer { ITDebugLog(@"Beginning show player."); - if ( ( playerRunningState == ITMTRemotePlayerRunning) ) { + //if ( ( playerRunningState == ITMTRemotePlayerRunning) ) { ITDebugLog(@"Showing player interface."); NS_DURING [[self currentRemote] showPrimaryInterface]; NS_HANDLER [self networkError:localException]; NS_ENDHANDLER - } else { + /*} else { ITDebugLog(@"Launching player."); NS_DURING NSString *path; @@ -554,7 +554,7 @@ static MainController *sharedController; NS_HANDLER [self networkError:localException]; NS_ENDHANDLER - } + }*/ ITDebugLog(@"Finished show player."); } @@ -1091,6 +1091,11 @@ static MainController *sharedController; if (result == 1) { [[PreferencesController sharedPrefs] resetRemotePlayerTextFields]; currentRemote = [[[networkController networkObject] remote] retain]; + + [self setupHotKeys]; + //playerRunningState = ITMTRemotePlayerRunning; + playerRunningState = [[self currentRemote] playerRunningState]; + [refreshTimer invalidate]; refreshTimer = [[NSTimer scheduledTimerWithTimeInterval:([networkController isConnectedToServer] ? 10.0 : 0.5) target:self @@ -1182,7 +1187,7 @@ static MainController *sharedController; - (void)applicationLaunched:(NSNotification *)note { NS_DURING - if (!note || [[[note userInfo] objectForKey:@"NSApplicationName"] isEqualToString:[[self currentRemote] playerFullName]]) { + if (!note || ([[[note userInfo] objectForKey:@"NSApplicationName"] isEqualToString:[[self currentRemote] playerFullName]] && ![[NetworkController sharedController] isConnectedToServer])) { ITDebugLog(@"Remote application launched."); playerRunningState = ITMTRemotePlayerRunning; [[self currentRemote] begin]; @@ -1204,7 +1209,7 @@ static MainController *sharedController; - (void)applicationTerminated:(NSNotification *)note { NS_DURING - if (!note || [[[note userInfo] objectForKey:@"NSApplicationName"] isEqualToString:[[self currentRemote] playerFullName]]) { + if (!note || [[[note userInfo] objectForKey:@"NSApplicationName"] isEqualToString:[[self currentRemote] playerFullName]] && ![[NetworkController sharedController] isConnectedToServer]) { ITDebugLog(@"Remote application terminated."); playerRunningState = ITMTRemotePlayerNotRunning; [[self currentRemote] halt];