X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/0b0d67ac83acfad048c61a70c17861f1f67ceef1..9cebb1f7452afe422cb940e970c9f30b5180a239:/MainController.m?ds=inline diff --git a/MainController.m b/MainController.m index 64af7d0..8784dd1 100755 --- a/MainController.m +++ b/MainController.m @@ -357,9 +357,18 @@ static MainController *sharedController; - (void)timerUpdate { - if ( [self songChanged] && (timerUpdating != YES) && (playerRunningState == ITMTRemotePlayerRunning) ) { + if ([[self currentRemote] playerStateUniqueIdentifier] == nil) { + [statusItem setEnabled:NO]; + [statusItem setToolTip:@"iTunes not responding."]; + return; + } else if (![statusItem isEnabled]) { + [statusItem setEnabled:YES]; + [statusItem setToolTip:_toolTip]; + return; + } + + if ( [self songChanged] && (timerUpdating != YES) && (playerRunningState == ITMTRemotePlayerRunning) ) { ITDebugLog(@"The song changed."); - if ([df boolForKey:@"runScripts"]) { NSArray *scripts = [[NSFileManager defaultManager] directoryContentsAtPath:[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Application Support/MenuTunes/Scripts"]]; NSEnumerator *scriptsEnum = [scripts objectEnumerator]; @@ -393,16 +402,15 @@ static MainController *sharedController; if ( [df boolForKey:@"showToolTip"] ) { NSString *artist = [[self currentRemote] currentSongArtist]; NSString *title = [[self currentRemote] currentSongTitle]; - NSString *toolTip; ITDebugLog(@"Creating status item tooltip."); if (artist) { - toolTip = [NSString stringWithFormat:@"%@ - %@", artist, title]; + _toolTip = [NSString stringWithFormat:@"%@ - %@", artist, title]; } else if (title) { - toolTip = title; + _toolTip = title; } else { - toolTip = @"No Song Playing"; + _toolTip = @"No Song Playing"; } - [statusItem setToolTip:toolTip]; + [statusItem setToolTip:_toolTip]; } else { [statusItem setToolTip:nil]; }