Added localized strings to everything, I think. Hope I didn't miss anything.
[MenuTunes.git] / MainController.m
index 3b9342b..61c2d68 100755 (executable)
@@ -147,13 +147,13 @@ static MainController *sharedController;
                 withLength:NSSquareStatusItemLength];
     }
     
-    bling = [[MTBlingController alloc] init];
+    /*bling = [[MTBlingController alloc] init];
     [self blingTime];
     registerTimer = [[NSTimer scheduledTimerWithTimeInterval:10.0
                              target:self
                              selector:@selector(blingTime)
                              userInfo:nil
-                             repeats:YES] retain];
+                             repeats:YES] retain];*/
     
     NS_DURING
         if ([[self currentRemote] playerRunningState] == ITMTRemotePlayerRunning) {
@@ -174,6 +174,14 @@ static MainController *sharedController;
     [networkController startRemoteServerSearch];
     [NSApp deactivate];
        [self performSelector:@selector(rawr) withObject:nil afterDelay:1.0];
+       
+       bling = [[MTBlingController alloc] init];
+    [self blingTime];
+    registerTimer = [[NSTimer scheduledTimerWithTimeInterval:10.0
+                             target:self
+                             selector:@selector(blingTime)
+                             userInfo:nil
+                             repeats:YES] retain];
 }
 
 - (void)rawr
@@ -181,9 +189,9 @@ static MainController *sharedController;
        _open = YES;
 }
 
-- (void)applicationWillBecomeActive:(NSNotification *)note
+- (void)applicationDidBecomeActive:(NSNotification *)note
 {
-       if (_open) {
+       if (_open && !blinged && ![NSApp mainWindow] && ![[StatusWindow sharedWindow] isVisible]) {
                [[MainController sharedController] showPreferences];
        }
 }
@@ -288,7 +296,7 @@ static MainController *sharedController;
         if ( ([now timeIntervalSinceDate:[self getBlingTime]] >= 604800) && (blinged != YES) ) {
             blinged = YES;
             [statusItem setEnabled:NO];
-            [self clearHotKeys];
+                       [[ITHotKeyCenter sharedCenter] setEnabled:NO];
             if ([refreshTimer isValid]) {
                 [refreshTimer invalidate];
                                [refreshTimer release];
@@ -299,7 +307,7 @@ static MainController *sharedController;
     } else {
         if (blinged) {
             [statusItem setEnabled:YES];
-            [self setupHotKeys];
+            [[ITHotKeyCenter sharedCenter] setEnabled:YES];
             if (![refreshTimer isValid]) {
                 [refreshTimer release];
                 refreshTimer = [[NSTimer scheduledTimerWithTimeInterval:([networkController isConnectedToServer] ? 10.0 : 0.5)
@@ -377,7 +385,7 @@ static MainController *sharedController;
 - (void)timerUpdate
 {
        NSString *identifier = [[self currentRemote] playerStateUniqueIdentifier];
-       if (identifier == nil) {
+       if (refreshTimer && identifier == nil) {
                if ([statusItem isEnabled]) {
                        [statusItem setToolTip:@"iTunes not responding."];
                        [[ITHotKeyCenter sharedCenter] setEnabled:NO];
@@ -430,7 +438,7 @@ static MainController *sharedController;
                                        } else if (title) {
                                                _toolTip = title;
                                        } else {
-                                               _toolTip = @"No Song Playing";
+                                               _toolTip = NSLocalizedString(@"noSongPlaying", @"No song is playing.");
                                        }
                                        [statusItem setToolTip:_toolTip];
                                } else {
@@ -456,13 +464,13 @@ static MainController *sharedController;
        if (([[self currentRemote] playerStateUniqueIdentifier] == nil) && playerRunningState == ITMTRemotePlayerRunning) {
                if (refreshTimer) {
                        if ([statusItem isEnabled]) {
-                               [statusItem setToolTip:@"iTunes not responding."];
+                               [statusItem setToolTip:NSLocalizedString(@"iTunesNotResponding", @"iTunes is not responding.")];
                                [[ITHotKeyCenter sharedCenter] setEnabled:NO];
                        }
                        [statusItem setEnabled:NO];
                } else {
                        NSMenu *menu = [[NSMenu alloc] init];
-                       [menu addItemWithTitle:@"iTunes Not Responding" action:nil keyEquivalent:@""];
+                       [menu addItemWithTitle:NSLocalizedString(@"iTunesNotResponding", @"iTunes is not responding.") action:nil keyEquivalent:@""];
                        [statusItem setMenu:[menu autorelease]];
                }
                return;
@@ -546,7 +554,7 @@ static MainController *sharedController;
                                } else if (title) {
                                        _toolTip = title;
                                } else {
-                                       _toolTip = @"No Song Playing";
+                                       _toolTip = NSLocalizedString(@"noSongPlaying", @"No song is playing.");;
                                }
                                [statusItem setToolTip:_toolTip];
                        } else {