Merge branch 'master' of git://github.com/ksuther/MenuTunes master
authorJoseph Spiros <joseph.spiros@ithinksw.com>
Wed, 30 Mar 2011 06:56:16 +0000 (06:56 +0000)
committerJoseph Spiros <joseph.spiros@ithinksw.com>
Wed, 30 Mar 2011 06:56:16 +0000 (06:56 +0000)
* 'master' of git://github.com/ksuther/MenuTunes:
  Reset the screen that the status window is on when the system's screens change.

StatusWindowController.m

index 2e4593e..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