Remove useless items in menubar.
[enjoyable.git] / ApplicationController.m
index c87a6ee..2edac94 100644 (file)
@@ -24,7 +24,7 @@ pascal OSStatus appSwitch(EventHandlerCallRef handlerChain, EventRef event, void
        et.eventClass = kEventClassApplication;
        et.eventKind = kEventAppFrontSwitched;
        EventHandlerUPP handler = NewEventHandlerUPP(appSwitch);
-       InstallApplicationEventHandler(handler, 1, &et, self, NULL);
+       InstallApplicationEventHandler(handler, 1, &et, (void *)CFBridgingRetain(self), NULL);
 }
 
 -(void) applicationWillTerminate: (NSNotification *)aNotification {
@@ -39,12 +39,12 @@ pascal OSStatus appSwitch(EventHandlerCallRef handlerChain, EventRef event, void
 }
 
 pascal OSStatus appSwitch(EventHandlerCallRef handlerChain, EventRef event, void* userData) {
-       ApplicationController* self = (ApplicationController*)userData;
+       ApplicationController* self = (__bridge ApplicationController*)userData;
        NSDictionary* currentApp = [[NSWorkspace sharedWorkspace] activeApplication];
        ProcessSerialNumber psn;
-       psn.lowLongOfPSN = [[currentApp objectForKey:@"NSApplicationProcessSerialNumberLow"] longValue];
-       psn.highLongOfPSN = [[currentApp objectForKey:@"NSApplicationProcessSerialNumberHigh"] longValue];
-       [self->configsController applicationSwitchedTo: [currentApp objectForKey:@"NSApplicationName"] withPsn: psn];
+       psn.lowLongOfPSN = [currentApp[@"NSApplicationProcessSerialNumberLow"] longValue];
+       psn.highLongOfPSN = [currentApp[@"NSApplicationProcessSerialNumberHigh"] longValue];
+       [self->configsController applicationSwitchedTo: currentApp[@"NSApplicationName"] withPsn: psn];
        return noErr;
 }
 
@@ -76,10 +76,10 @@ pascal OSStatus appSwitch(EventHandlerCallRef handlerChain, EventRef event, void
        Config* current = [configsController currentConfig];
        NSArray* configs = [configsController configs];
        for(int i=0; i<[configs count]; i++)
-               [[dockMenuBase itemAtIndex: (2+i)] setState: (([configs objectAtIndex:i] == current) ? YES : NO)];
+               [[dockMenuBase itemAtIndex: (2+i)] setState: ((configs[i] == current) ? YES : NO)];
 }
 
 -(void) chooseConfig: (id) sender {
-       [configsController activateConfig: [[configsController configs] objectAtIndex: ([dockMenuBase indexOfItem: sender]-2)] forApplication: NULL];
+       [configsController activateConfig: [configsController configs][([dockMenuBase indexOfItem: sender]-2)] forApplication: NULL];
 }
 @end