Fixed a crash when unchecking share this player. Also trying to make the
[MenuTunes.git] / MainController.m
index 065659a..fbeae9d 100755 (executable)
@@ -14,7 +14,6 @@
 - (ITMTRemote *)loadRemote;
 - (void)timerUpdate;
 - (void)setLatestSongIdentifier:(NSString *)newIdentifier;
-- (void)showCurrentTrackInfo;
 - (void)applicationLaunched:(NSNotification *)note;
 - (void)applicationTerminated:(NSNotification *)note;
 @end
@@ -291,6 +290,9 @@ static MainController *sharedController;
 {
     if ([networkController isConnectedToServer]) {
         [statusItem setMenu:[menuController menu]];
+        if ([[networkController networkObject] remote] == nil) {
+            [self networkError:nil];
+        }
     }
     
     if ( [self songChanged] && (timerUpdating != YES) ) {
@@ -960,6 +962,12 @@ static MainController *sharedController;
     if (result == 1) {
         [[PreferencesController sharedPrefs] resetRemotePlayerTextFields];
         currentRemote = [[[networkController networkObject] remote] retain];
+        [refreshTimer invalidate];
+        refreshTimer = [[NSTimer scheduledTimerWithTimeInterval:([networkController isConnectedToServer] ? 10.0 : 0.5)
+                                target:self
+                                selector:@selector(timerUpdate)
+                                userInfo:nil
+                                repeats:YES] retain];
         [self timerUpdate];
         ITDebugLog(@"Connection successful.");
         return 1;
@@ -992,7 +1000,7 @@ static MainController *sharedController;
     if ([networkController checkForServerAtHost:[df stringForKey:@"sharedPlayerHost"]]) {
         ITDebugLog(@"Remote server found.");
         [timer invalidate];
-        if (![networkController isConnectedToServer]) {
+        if (![networkController isServerOn] && ![networkController isConnectedToServer]) {
             [[StatusWindowController sharedController] showReconnectQueryWindow];
         }
     } else {