X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/9cebb1f7452afe422cb940e970c9f30b5180a239..4416c262f94695ab705ab81826b10540923407e4:/MainController.m diff --git a/MainController.m b/MainController.m index 8784dd1..da07757 100755 --- a/MainController.m +++ b/MainController.m @@ -358,17 +358,21 @@ static MainController *sharedController; - (void)timerUpdate { if ([[self currentRemote] playerStateUniqueIdentifier] == nil) { + if ([statusItem isEnabled]) { + [statusItem setToolTip:@"iTunes not responding."]; + [self clearHotKeys]; + } [statusItem setEnabled:NO]; - [statusItem setToolTip:@"iTunes not responding."]; return; } else if (![statusItem isEnabled]) { [statusItem setEnabled:YES]; [statusItem setToolTip:_toolTip]; + [self setupHotKeys]; return; } if ( [self songChanged] && (timerUpdating != YES) && (playerRunningState == ITMTRemotePlayerRunning) ) { - ITDebugLog(@"The song changed."); + ITDebugLog(@"The song changed. '%@'", _latestSongIdentifier); if ([df boolForKey:@"runScripts"]) { NSArray *scripts = [[NSFileManager defaultManager] directoryContentsAtPath:[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Application Support/MenuTunes/Scripts"]]; NSEnumerator *scriptsEnum = [scripts objectEnumerator]; @@ -430,6 +434,21 @@ static MainController *sharedController; - (void)menuClicked { ITDebugLog(@"Menu clicked."); + + if ([[self currentRemote] playerStateUniqueIdentifier] == nil) { + if ([statusItem isEnabled]) { + [statusItem setToolTip:@"iTunes not responding."]; + [self clearHotKeys]; + } + [statusItem setEnabled:NO]; + return; + } else if (![statusItem isEnabled]) { + [statusItem setEnabled:YES]; + [statusItem setToolTip:_toolTip]; + [self setupHotKeys]; + return; + } + if ([networkController isConnectedToServer]) { //Used the cached version return;