X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/2d9409ab3de16736f5ec5fae6ec0eb6c15fe6c4a..0a1be7120daf3895af462672f59a2889a6c9c581:/PreferencesController.m diff --git a/PreferencesController.m b/PreferencesController.m index 3a9ecd3..8acaab7 100755 --- a/PreferencesController.m +++ b/PreferencesController.m @@ -13,7 +13,7 @@ mt = [tunes retain]; [mt registerDefaultsIfNeeded]; - + //Load the nib [NSBundle loadNibNamed:@"Preferences" owner:self]; @@ -32,7 +32,7 @@ [allTableView registerForDraggedTypes:[NSArray arrayWithObjects:@"MenuTableViewPboardType", @"AllTableViewPboardType", nil]]; //Set the list of items you can have. - availableItems = [[NSMutableArray alloc] initWithObjects:@"Current Track Info", @"Upcoming Songs", @"Playlists", @"EQ Presets", @"Play/Pause", @"Next Track", @"Previous Track", @"Fast Forward", @"Rewind", @"", nil]; + availableItems = [[NSMutableArray alloc] initWithObjects:@"Current Track Info", @"Upcoming Songs", @"Playlists", @"EQ Presets", @"Song Rating", @"Play/Pause", @"Next Track", @"Previous Track", @"Fast Forward", @"Rewind", @"", nil]; //Get our preferred menu myItems = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"menu"] mutableCopy]; @@ -47,7 +47,7 @@ } //Items that show should a submenu image - submenuItems = [[NSArray alloc] initWithObjects:@"Upcoming Songs", @"Playlists", @"EQ Presets", nil]; + submenuItems = [[NSArray alloc] initWithObjects:@"Upcoming Songs", @"Playlists", @"EQ Presets", @"Song Rating", nil]; //Fill in the number of songs in advance to show field [songsInAdvance setIntValue:[defaults integerForKey:@"SongsInAdvance"]]; @@ -134,7 +134,6 @@ - (IBAction)apply:(id)sender { - ProcessSerialNumber psn; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults setObject:myItems forKey:@"menu"]; @@ -210,9 +209,16 @@ [defaults setInteger:5 forKey:@"SongsInAdvance"]; } - psn = [mt iTunesPSN]; - if (!((psn.highLongOfPSN == kNoProcess) && (psn.lowLongOfPSN == 0))) { - [mt rebuildMenu]; + { + NSArray *apps = [[NSWorkspace sharedWorkspace] launchedApplications]; + int i; + + for (i = 0; i < [apps count]; i++) { + if ([[[apps objectAtIndex:i] objectForKey:@"NSApplicationName"] + isEqualToString:@"iTunes"]) { + [mt rebuildMenu]; + } + } } [mt clearHotKeys]; }