X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/50485da2e6ae0642e4dfb55ef4c0556ed6ef2a80..68dce30ee215d5614aff29c67733f9d71cfd033a:/PreferencesController.m diff --git a/PreferencesController.m b/PreferencesController.m index 51271ab..c2767c2 100755 --- a/PreferencesController.m +++ b/PreferencesController.m @@ -13,7 +13,7 @@ #import #import -#import +#import #import #import @@ -48,7 +48,6 @@ - (void)repopulateEffectPopupsForVerticalPosition:(ITVerticalWindowPosition)vPos horizontalPosition:(ITHorizontalWindowPosition)hPos; - (BOOL)effect:(Class)effectClass supportsVerticalPosition:(ITVerticalWindowPosition)vPos withHorizontalPosition:(ITHorizontalWindowPosition)hPos; - (IBAction)changeMenus:(id)sender; -- (void)setLaunchesAtLogin:(BOOL)flag; @end @@ -211,12 +210,14 @@ static PreferencesController *prefs = nil; { ITDebugLog(@"Changing general setting of tag %i.", [sender tag]); if ( [sender tag] == 1010) { - [self setLaunchesAtLogin:SENDER_STATE]; + //ITSetApplicationLaunchOnLogin([[NSBundle mainBundle] bundlePath], SENDER_STATE); } else if ( [sender tag] == 1020) { [df setBool:SENDER_STATE forKey:@"LaunchPlayerWithMT"]; } else if ( [sender tag] == 1030) { [df setInteger:[sender intValue] forKey:@"SongsInAdvance"]; - [[controller menuController] rebuildSubmenus]; + if ([[controller currentRemote] playerRunningState] == ITMTRemotePlayerRunning) { + [[controller menuController] rebuildSubmenus]; + } } 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"]; @@ -519,11 +520,6 @@ static PreferencesController *prefs = nil; - (void)registerDefaults { - BOOL found = NO; - NSMutableDictionary *loginWindow; - NSMutableArray *loginArray; - NSEnumerator *loginEnum; - id anItem; ITDebugLog(@"Registering defaults."); [df setObject:[NSArray arrayWithObjects: @"trackInfo", @@ -564,20 +560,9 @@ static PreferencesController *prefs = nil; [df synchronize]; - loginWindow = [[df persistentDomainForName:@"loginwindow"] mutableCopy]; - loginArray = [loginWindow objectForKey:@"AutoLaunchedApplicationDictionary"]; - loginEnum = [loginArray objectEnumerator]; - - while ( (anItem = [loginEnum nextObject]) ) { - if ( [[[anItem objectForKey:@"Path"] lastPathComponent] isEqualToString:[[[NSBundle mainBundle] bundlePath] lastPathComponent]] ) { - found = YES; - } - } - [loginWindow release]; - - if (!found) { + /*if (ITDoesApplicationLaunchOnLogin([[NSBundle mainBundle] bundlePath])) { [[StatusWindowController sharedController] showSetupQueryWindow]; - } + }*/ } - (void)autoLaunchOK @@ -586,7 +571,7 @@ static PreferencesController *prefs = nil; [[StatusWindow sharedWindow] vanish:self]; [[StatusWindow sharedWindow] setIgnoresMouseEvents:YES]; - [self setLaunchesAtLogin:YES]; + //ITSetApplicationLaunchOnLogin([[NSBundle mainBundle] bundlePath], YES); } - (void)autoLaunchCancel @@ -766,9 +751,6 @@ static PreferencesController *prefs = nil; - (void)setupUI { - NSMutableDictionary *loginwindow; - NSMutableArray *loginarray; - NSEnumerator *loginEnum; NSEnumerator *keyArrayEnum; NSString *serverName; NSData *colorData; @@ -814,16 +796,9 @@ static PreferencesController *prefs = nil; // Set the launch at login checkbox state ITDebugLog(@"Setting launch at login state."); - [df synchronize]; - loginwindow = [[df persistentDomainForName:@"loginwindow"] mutableCopy]; - loginarray = [loginwindow objectForKey:@"AutoLaunchedApplicationDictionary"]; - - loginEnum = [loginarray objectEnumerator]; - while ( (anItem = [loginEnum nextObject]) ) { - if ([[[anItem objectForKey:@"Path"] lastPathComponent] isEqualToString:[[[NSBundle mainBundle] bundlePath] lastPathComponent]]) { - [launchAtLoginCheckbox setState:NSOnState]; - } - } + /*if (ITDoesApplicationLaunchOnLogin([[NSBundle mainBundle] bundlePath])) { + [launchAtLoginCheckbox setState:NSOnState]; + }*/ // Set the launch player checkbox state ITDebugLog(@"Setting launch player with MenuTunes state."); @@ -1025,36 +1000,6 @@ static PreferencesController *prefs = nil; } } -- (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."); -} - /*************************************************************************/ #pragma mark -