Reset the screen that the status window is on when the system's screens change.
[MenuTunes.git] / StatusWindowController.m
index 7663d39..aa684a3 100755 (executable)
@@ -98,6 +98,8 @@ static StatusWindowController *sharedController;
         } else {
             [(ITTSWBackgroundView *)[_window contentView] setBackgroundColor:[NSColor blueColor]];
         }
+        
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenParametersChanged:) name:NSApplicationDidChangeScreenParametersNotification object:nil];
     }
     
     return self;
@@ -105,10 +107,23 @@ static StatusWindowController *sharedController;
 
 - (void)dealloc
 {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+    
     [_window release];
     [super dealloc];
 }
 
+- (void)screenParametersChanged:(NSNotification *)notification
+{
+    NSArray *screens = [NSScreen screens];
+    int screenIndex = [df integerForKey:@"statusWindowScreenIndex"];
+    
+    if (screenIndex >= [screens count]) {
+        screenIndex = 0;
+    }
+    [_window setScreen:[screens objectAtIndex:screenIndex]];
+}
+
 - (void)showSongInfoWindowWithSource:(ITMTRemotePlayerSource)source
                                title:            (NSString *)title
                                album:            (NSString *)album
@@ -309,25 +324,6 @@ static StatusWindowController *sharedController;
     [_window setLocked:YES];
 }
 
-
-- (void)showRegistrationQueryWindow
-{
-    NSString *message = NSLocalizedString(@"trialexpired_msg", @"Your 7-day unlimited trial period has elapsed.\nYou must register to continue using MenuTunes.");
-
-    [_window setImage:[NSImage imageNamed:@"Register"]];
-    [_window setSizing:(ITTransientStatusWindowSizing)[df integerForKey:@"statusWindowSizing"]];
-    [_window buildDialogWindowWithMessage:message
-                            defaultButton:NSLocalizedString(@"registernow", @"Register Now")
-                          alternateButton:NSLocalizedString(@"quitmenutunes", @"Quit MenuTunes")
-                                   target:[MainController sharedController]
-                            defaultAction:@selector(registerNowOK)
-                          alternateAction:@selector(registerNowCancel)];
-
-       _currentType = StatusWindowRegistrationType;
-    [_window appear:self];
-    [_window setLocked:YES];
-}
-
 - (void)showReconnectQueryWindow
 {
     NSString *message = NSLocalizedString(@"sharedplayeravailable_msg", @"The selected shared player is available again.\nWould you like to reconnect to it?");