+
+ // Set the launch player checkbox state
+ ITDebugLog(@"Setting launch player with MenuTunes state.");
+ [launchPlayerAtLaunchCheckbox setState:[df boolForKey:@"LaunchPlayerWithMT"] ? NSOnState : NSOffState];
+
+ // Setup the positioning controls
+
+ // Setup effects controls
+ [appearanceEffectPopup selectItem:[appearanceEffectPopup itemAtIndex:[appearanceEffectPopup indexOfItemWithTag:[df integerForKey:@"statusWindowAppearanceEffect"]]]];
+ [vanishEffectPopup selectItem:[vanishEffectPopup itemAtIndex:[vanishEffectPopup indexOfItemWithTag:[df integerForKey:@"statusWindowVanishEffect"]]]];
+ [appearanceSpeedSlider setFloatValue:-([df floatForKey:@"statusWindowAppearanceSpeed"])];
+ [vanishSpeedSlider setFloatValue:-([df floatForKey:@"statusWindowVanishSpeed"])];
+ [vanishDelaySlider setFloatValue:[df floatForKey:@"statusWindowVanishDelay"]];
+ [showOnChangeCheckbox setState:([df boolForKey:@"showSongInfoOnChange"] ? NSOnState : NSOffState)];
+
+ // Setup the sharing controls
+ if ([df boolForKey:@"enableSharing"]) {
+ [shareMenuTunesCheckbox setState:NSOnState];
+ [useSharedMenuTunesCheckbox setEnabled:NO];
+ [selectSharedPlayerButton setEnabled:NO];
+ [passwordTextField setEnabled:YES];
+ [usePasswordCheckbox setEnabled:YES];
+ [nameTextField setEnabled:YES];
+ } else if ([df boolForKey:@"useSharedPlayer"]) {
+ [useSharedMenuTunesCheckbox setState:NSOnState];
+ [shareMenuTunesCheckbox setEnabled:NO];
+ [selectSharedPlayerButton setEnabled:YES];
+ }
+
+ [[NSNotificationCenter defaultCenter] addObserver:sharingTableView selector:@selector(reloadData) name:@"ITMTFoundNetService" object:nil];
+
+ serverName = [df stringForKey:@"sharedPlayerName"];
+ if (!serverName || [serverName length] == 0) {
+ serverName = @"MenuTunes Shared Player";
+ }
+ [nameTextField setStringValue:serverName];
+
+ [selectPlayerBox setContentView:zeroConfView];
+ [usePasswordCheckbox setState:([df boolForKey:@"enableSharingPassword"] ? NSOnState : NSOffState)];
+ if ([df dataForKey:@"sharedPlayerPassword"]) {
+ [passwordTextField setStringValue:@"password"];
+ }
+ if ([df stringForKey:@"sharedPlayerHost"]) {
+ [hostTextField setStringValue:[df stringForKey:@"sharedPlayerHost"]];
+ }
+
+ if ([[NetworkController sharedController] isConnectedToServer]) {
+ [selectedPlayerTextField setStringValue:[[[NetworkController sharedController] networkObject] serverName]];
+ [locationTextField setStringValue:[[NetworkController sharedController] remoteHost]];
+ } else {
+ [selectedPlayerTextField setStringValue:@"No shared player selected."];
+ [locationTextField setStringValue:@"-"];
+ }
+}
+
+- (IBAction)changeMenus:(id)sender
+{
+ ITDebugLog(@"Synchronizing menus");
+ [df setObject:myItems forKey:@"menu"];
+ [df synchronize];
+}
+
+- (void)setLaunchesAtLogin:(BOOL)flag
+{
+ NSMutableDictionary *loginwindow;
+ NSMutableArray *loginarray;
+ ITDebugLog(@"Setting launches at login: %i", flag);
+ [df synchronize];
+ loginwindow = [[df persistentDomainForName:@"loginwindow"] mutableCopy];
+ loginarray = [loginwindow objectForKey:@"AutoLaunchedApplicationDictionary"];
+
+ if (flag) {
+ NSDictionary *itemDict = [NSDictionary dictionaryWithObjectsAndKeys:
+ [[NSBundle mainBundle] bundlePath], @"Path",
+ [NSNumber numberWithInt:0], @"Hide", nil];
+ [loginarray addObject:itemDict];
+ } else {
+ int i;
+ 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];
+ break;
+ }
+ }
+ }
+ [df setPersistentDomain:loginwindow forName:@"loginwindow"];
+ [df synchronize];
+ [loginwindow release];
+ ITDebugLog(@"Finished setting launches at login.");