- [df setObject:myItems forKey:@"menu"];
-
- //Set key combos
- [df setKeyCombo:playPauseCombo forKey:@"PlayPause"];
- [df setKeyCombo:nextTrackCombo forKey:@"NextTrack"];
- [df setKeyCombo:prevTrackCombo forKey:@"PrevTrack"];
- [df setKeyCombo:trackInfoCombo forKey:@"TrackInfo"];
- [df setKeyCombo:upcomingSongsCombo forKey:@"UpcomingSongs"];
- [df setKeyCombo:volumeIncrementCombo forKey:@"IncrementVolume"];
- [df setKeyCombo:volumeDecrementCombo forKey:@"DecrementVolume"];
- [df setKeyCombo:ratingIncrementCombo forKey:@"IncrementRating"];
- [df setKeyCombo:ratingDecrementCombo forKey:@"DecrementRating"];
- [df setKeyCombo:toggleLoopCombo forKey:@"ToggleLoop"];
- [df setKeyCombo:toggleShuffleCombo forKey:@"ToggleShuffle"];
-
- //Set info checkboxes
- [df setBool:[albumCheckbox state] forKey:@"showAlbum"];
- [df setBool:[nameCheckbox state] forKey:@"showName"];
- [df setBool:[artistCheckbox state] forKey:@"showArtist"];
- [df setBool:[trackTimeCheckbox state] forKey:@"showTime"];
-
- //Here we set whether we will launch at login by modifying loginwindow.plist
- if ([launchAtLoginCheckbox state] == NSOnState) {
- NSMutableDictionary *loginwindow;
- NSMutableArray *loginarray;
- ComponentInstance temp = OpenDefaultComponent(kOSAComponentType, kAppleScriptSubtype);;
- int i;
- BOOL skip = NO;
-
- [df synchronize];
- loginwindow = [[df persistentDomainForName:@"loginwindow"] mutableCopy];
- loginarray = [loginwindow objectForKey:@"AutoLaunchedApplicationDictionary"];
-
- for (i = 0; i < [loginarray count]; i++) {
- NSDictionary *tempDict = [loginarray objectAtIndex:i];
- if ([[[tempDict objectForKey:@"Path"] lastPathComponent] isEqualToString:[[[NSBundle mainBundle] bundlePath] lastPathComponent]]) {
- skip = YES;
- }
- }
-
- if (!skip) {
- AEDesc scriptDesc, resultDesc;
- NSString *script = [NSString stringWithFormat:@"tell application \"System Events\"\nmake new login item at end of login items with properties {path:\"%@\", kind:\"APPLICATION\"}\nend tell", [[NSBundle mainBundle] bundlePath]];
-
- AECreateDesc(typeChar, [script cString], [script cStringLength],
- &scriptDesc);
-
- OSADoScript(temp, &scriptDesc, kOSANullScript, typeChar, kOSAModeCanInteract, &resultDesc);
-
- AEDisposeDesc(&scriptDesc);
- AEDisposeDesc(&resultDesc);
- CloseComponent(temp);
- }
- } else {
- NSMutableDictionary *loginwindow;
- NSMutableArray *loginarray;
- int i;
-
- [df synchronize];
- loginwindow = [[df persistentDomainForName:@"loginwindow"] mutableCopy];
- loginarray = [loginwindow objectForKey:@"AutoLaunchedApplicationDictionary"];
-
- for (i = 0; i < [loginarray count]; i++) {
- NSDictionary *tempDict = [loginarray objectAtIndex:i];
- if ([[[tempDict objectForKey:@"Path"] lastPathComponent] isEqualToString:[[[NSBundle mainBundle] bundlePath] lastPathComponent]]) {
- [loginarray removeObjectAtIndex:i];
- [df setPersistentDomain:loginwindow forName:@"loginwindow"];
- [df synchronize];
- break;
- }
- }
+ if ( [sender tag] == 1010) {
+ [self setLaunchesAtLogin:SENDER_STATE];
+ } else if ( [sender tag] == 1020) {
+ [df setBool:SENDER_STATE forKey:@"LaunchPlayerWithMT"];
+ } else if ( [sender tag] == 1030) {
+ [df setInteger:[sender intValue] forKey:@"SongsInAdvance"];
+
+ } else if ( [sender tag] == 1040) {
+ // This will not be executed. Song info always shows the title of the song.
+ // [df setBool:SENDER_STATE forKey:@"showName"];
+ } else if ( [sender tag] == 1050) {
+ [df setBool:SENDER_STATE forKey:@"showArtist"];
+ } else if ( [sender tag] == 1060) {
+ [df setBool:SENDER_STATE forKey:@"showAlbum"];
+ } else if ( [sender tag] == 1070) {
+ [df setBool:SENDER_STATE forKey:@"showTime"];
+ } else if ( [sender tag] == 1080) {
+ [df setBool:SENDER_STATE forKey:@"showTrackNumber"];
+ } else if ( [sender tag] == 1090) {
+ [df setBool:SENDER_STATE forKey:@"showTrackRating"];