Changing hotkeys in the prefs now writes to the prefs and rebuilds the menu.
authorKent Sutherland <ksuther@ithinksw.com>
Mon, 14 Apr 2003 18:49:59 +0000 (18:49 +0000)
committerKent Sutherland <ksuther@ithinksw.com>
Mon, 14 Apr 2003 18:49:59 +0000 (18:49 +0000)
The app crashes on launch because the remote isn't responding for some
reason.

OldMainController.m
PreferencesController.m
iTunesRemote.m

index 8160644..4171538 100755 (executable)
         [[ratingMenu addItemWithTitle:[NSString stringWithFormat:@"%@%@%@%@%@", fullStarChar, fullStarChar, fullStarChar, emptyStarChar, emptyStarChar] action:@selector(selectSongRating:) keyEquivalent:@""] setTag:60];
         [[ratingMenu addItemWithTitle:[NSString stringWithFormat:@"%@%@%@%@%@", fullStarChar, fullStarChar, fullStarChar, fullStarChar, emptyStarChar] action:@selector(selectSongRating:) keyEquivalent:@""] setTag:80];
         [[ratingMenu addItemWithTitle:[NSString stringWithFormat:@"%@%@%@%@%@", fullStarChar, fullStarChar, fullStarChar, fullStarChar, fullStarChar] action:@selector(selectSongRating:) keyEquivalent:@""] setTag:100];
-        
         [NSThread detachNewThreadSelector:@selector(startTimerInNewThread) toTarget:self withObject:nil];
-        [self rebuildMenu];
         [self setupHotKeys];
+        [self rebuildMenu];
         isAppRunning = ITMTRemotePlayerRunning;
-        return;
     }
-    
-    isAppRunning = ITMTRemotePlayerRunning;
-    NSLog(@"applicationTerminated");
 }
 
 - (void)applicationTerminated:(NSNotification *)note
     lastSongIdentifier = [[currentRemote currentSongUniqueIdentifier] retain];
     
     //If we're in a playlist or radio mode
-    if ( (trackInfoIndex > -1) ) {
+    if ( ![lastSongIdentifier isEqualToString:@"0-0"] && (trackInfoIndex > -1) ) {
         NSString *title;
         
         if ( (i = [menu indexOfItemWithTitle:@"No Song"]) ) {
             if ( (i > -1) ) {
                 [menu removeItemAtIndex:i];
-                [menu insertItemWithTitle:@"Now Playing" action:NULL keyEquivalent:@"" atIndex:i-1];
+                [menu insertItemWithTitle:@"Now Playing" action:NULL keyEquivalent:@"" atIndex:i];
             }
         }
         
             [tempItem autorelease];
        }
     }
+    
     [eqItem setSubmenu:eqMenu];
     [eqItem setEnabled:YES];
-    
     [[eqMenu itemAtIndex:([currentRemote currentEQPresetIndex] - 1)] setState:NSOnState];
 }
 
index af1838b..5c9f059 100755 (executable)
@@ -459,6 +459,8 @@ static PreferencesController *prefs = nil;
         toggleShuffleCombo = [combo copy];
         [toggleShuffleButton setTitle:string];
     }
+    [df setKeyCombo:combo forKey:setHotKey];
+    [controller rebuildMenu];
     [self cancelHotKey:sender];
 }
 
index 0f537fb..1ab3043 100755 (executable)
 - (BOOL)begin
 {
     iTunesPSN = [self iTunesPSN];
-    
-    [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(applicationLaunched:) name:NSWorkspaceDidLaunchApplicationNotification object:nil];
-    [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(applicationTerminated:) name:NSWorkspaceDidTerminateApplicationNotification object:nil];
-    
     return YES;
 }