Only notify when iTunes is not the active app. Fixes #111.
authorPeter Hosey <hg@boredzo.org>
Sat Mar 27 22:19:16 2010 -0700 (2010-03-27)
changeset 46081b90cdbf5fc4
parent 4607 1965ad0e7d66
child 4609 f8ebcae026f6
Only notify when iTunes is not the active app. Fixes #111.
Extras/GrowlTunes/GrowlTunesController.m
     1.1 --- a/Extras/GrowlTunes/GrowlTunesController.m	Sat Mar 27 22:18:39 2010 -0700
     1.2 +++ b/Extras/GrowlTunes/GrowlTunesController.m	Sat Mar 27 22:19:16 2010 -0700
     1.3 @@ -331,6 +331,8 @@
     1.4  #pragma mark iTunes 4.7 notifications
     1.5  
     1.6  - (void) songChanged:(NSNotification *)aNotification {
     1.7 +	BOOL iTunesIsTheActiveApp = ([[[[NSWorkspace sharedWorkspace] activeApplication] objectForKey:@"NSApplicationBundleIdentifier"] caseInsensitiveCompare:ITUNES_BUNDLE_ID] == NSOrderedSame);
     1.8 +
     1.9  	NSString     *playerState = nil;
    1.10  	iTunesState   newState    = itUNKNOWN;
    1.11  	NSString     *newTrackURL = nil;
    1.12 @@ -492,8 +494,10 @@
    1.13  		BOOL isStream = [newTrackURL hasPrefix:@"http://"];
    1.14  		BOOL descriptionChanged = ![lastPostedDescription isEqualToString:displayString];
    1.15  		if (URLChanged || (isStream && descriptionChanged)) {
    1.16 -			// Tell Growl
    1.17 -			[GrowlApplicationBridge notifyWithDictionary:noteDict];
    1.18 +			if (!iTunesIsTheActiveApp) {
    1.19 +				// Tell Growl
    1.20 +				[GrowlApplicationBridge notifyWithDictionary:noteDict];
    1.21 +			}
    1.22  
    1.23  			// Recent Tracks
    1.24  			if (streamTitle && [streamTitle length]) {