Fixed a bunch of the networking crashes and bugs appearing. All with just 5 lines...
[MenuTunes.git] / MainController.m
index dd7c51e..c235a8f 100755 (executable)
@@ -334,10 +334,6 @@ static MainController *sharedController;
 
 - (void)timerUpdate
 {
-    if ([networkController isConnectedToServer]) {
-        [statusItem setMenu:[menuController menu]];
-    }
-    
     if ( [self songChanged] && (timerUpdating != YES) && (playerRunningState == ITMTRemotePlayerRunning) ) {
         ITDebugLog(@"The song changed.");
         
@@ -394,6 +390,10 @@ static MainController *sharedController;
         timerUpdating = NO;
         [statusItem setEnabled:YES];
     }
+    
+    if ([networkController isConnectedToServer]) {
+        [statusItem setMenu:[menuController menu]];
+    }
 }
 
 - (void)menuClicked
@@ -1119,6 +1119,12 @@ static MainController *sharedController;
     [currentRemote release];
     currentRemote = [remoteArray objectAtIndex:0];
     [networkController disconnect];
+    
+    if ([[self currentRemote] playerRunningState] == ITMTRemotePlayerRunning) {
+        [self applicationLaunched:nil];
+    } else {
+        [self applicationTerminated:nil];
+    }
     [self timerUpdate];
     return YES;
 }