Added ITFoundation launch at login, but it doesn'ty work. Other small fixes for netwo...
authorKent Sutherland <ksuther@ithinksw.com>
Sat, 22 May 2004 22:25:32 +0000 (22:25 +0000)
committerKent Sutherland <ksuther@ithinksw.com>
Sat, 22 May 2004 22:25:32 +0000 (22:25 +0000)
MainController.m
MenuTunes.xcode/project.pbxproj
PreferencesController.m

index 4417228..ad6f2e1 100755 (executable)
@@ -1093,7 +1093,8 @@ static MainController *sharedController;
         currentRemote = [[[networkController networkObject] remote] retain];
         
         [self setupHotKeys];
-        playerRunningState = ITMTRemotePlayerRunning;
+        //playerRunningState = ITMTRemotePlayerRunning;
+        playerRunningState = [[self currentRemote] playerRunningState];
         
         [refreshTimer invalidate];
         refreshTimer = [[NSTimer scheduledTimerWithTimeInterval:([networkController isConnectedToServer] ? 10.0 : 0.5)
@@ -1186,7 +1187,7 @@ static MainController *sharedController;
 - (void)applicationLaunched:(NSNotification *)note
 {
     NS_DURING
-        if (!note || [[[note userInfo] objectForKey:@"NSApplicationName"] isEqualToString:[[self currentRemote] playerFullName]]) {
+        if (!note || ([[[note userInfo] objectForKey:@"NSApplicationName"] isEqualToString:[[self currentRemote] playerFullName]] && ![[NetworkController sharedController] isConnectedToServer])) {
             ITDebugLog(@"Remote application launched.");
             playerRunningState = ITMTRemotePlayerRunning;
             [[self currentRemote] begin];
index ce13b91..0feee35 100755 (executable)
 //372
 //373
 //374
+               3713879D065F83FB006A543D = {
+                       fileRef = 3740714D05ACE0B500CC2142;
+                       isa = PBXBuildFile;
+                       settings = {
+                       };
+               };
                3740714D05ACE0B500CC2142 = {
                        isa = PBXFileReference;
                        lastKnownFileType = wrapper.framework;
                        settings = {
                        };
                };
-               3740714F05ACE0B500CC2142 = {
-                       fileRef = 3740714D05ACE0B500CC2142;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
                3740716B05ACE14D00CC2142 = {
                        fileRef = 3740714D05ACE0B500CC2142;
                        isa = PBXBuildFile;
                        buildSettings = {
                                DYLIB_COMPATIBILITY_VERSION = 1;
                                DYLIB_CURRENT_VERSION = 1;
-                               FRAMEWORK_SEARCH_PATHS = "/Volumes/Data/Desktop/ITFoundation/build /Volumes/Data/Desktop/ITKit/build";
+                               FRAMEWORK_SEARCH_PATHS = "../ITFoundation/build ../ITKit/build";
                                FRAMEWORK_VERSION = A;
                                GCC_PRECOMPILE_PREFIX_HEADER = YES;
                                GCC_PREFIX_HEADER = MenuTunes_Prefix.pch;
                                7C95A03805A928A300B4F576,
                                7C95A0E905A92B0700B4F576,
                                7C95A0F005A92B4800B4F576,
-                               3740714F05ACE0B500CC2142,
                                3740716D05ACE20500CC2142,
+                               3713879D065F83FB006A543D,
                        );
                        isa = PBXFrameworksBuildPhase;
                        runOnlyForDeploymentPostprocessing = 0;
index 51271ab..50f7397 100755 (executable)
@@ -13,7 +13,7 @@
 #import <sys/types.h>
 #import <sys/stat.h>
 
-#import <ITFoundation/ITFoundation.h>
+#import <ITFoundation/ITLoginItem.h>
 
 #import <ITKit/ITHotKeyCenter.h>
 #import <ITKit/ITKeyCombo.h>
@@ -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,7 +210,7 @@ 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) {
@@ -519,11 +518,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 +558,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 +569,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 +749,6 @@ static PreferencesController *prefs = nil;
 
 - (void)setupUI
 {
-    NSMutableDictionary *loginwindow;
-    NSMutableArray      *loginarray;
-    NSEnumerator   *loginEnum;
     NSEnumerator   *keyArrayEnum;
     NSString       *serverName;
     NSData         *colorData;
@@ -814,16 +794,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 +998,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 -