From bc88036a5e15925be8439668e2875d17d3c479ab Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 13 Oct 2012 11:28:10 -0700 Subject: [PATCH] Use [NSImage imageNamed:] for the menu bar icons, so that retina icons (provided that we have some) can be displayed. --- DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.m | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.m b/DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.m index 3ab6bd5..0c5fc4a 100644 --- a/DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.m +++ b/DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.m @@ -97,24 +97,22 @@ DNSConfigurationState currentState = kDNS_CONFIGURATION_UNKNOWN; - (void) updateLedStatus { - NSBundle *bundle = [NSBundle mainBundle]; NSImage *led = nil; switch (currentState) { case kDNS_CONFIGURATION_OPENDNS: - led = [[NSImage alloc] initWithContentsOfFile: [bundle pathForImageResource: @"yes-opendns-no-crypt.png"]]; + led = [NSImage imageNamed: @"yes-opendns-no-crypt.png"]; break; case kDNS_CONFIGURATION_LOCALHOST: - led = [[NSImage alloc] initWithContentsOfFile: [bundle pathForImageResource: @"yes-opendns-yes-crypt.png"]]; + led = [NSImage imageNamed: @"yes-opendns-yes-crypt.png"]; break; case kDNS_CONFIGURATION_VANILLA: - led = [[NSImage alloc] initWithContentsOfFile: [bundle pathForImageResource: @"no-opendns.png"]]; + led = [NSImage imageNamed: @"no-opendns.png"]; break; default: - led = [[NSImage alloc] initWithContentsOfFile: [bundle pathForImageResource: @"no-network.png"]]; + led = [NSImage imageNamed: @"no-network.png"]; } _statusItem.image = led; - [led release]; } - (BOOL) updateStatusWithCurrentConfig @@ -174,10 +172,8 @@ DNSConfigurationState currentState = kDNS_CONFIGURATION_UNKNOWN; { [self setCheckBoxesEnabled: FALSE]; - NSBundle *bundle = [NSBundle mainBundle]; - NSImage *led = [[NSImage alloc] initWithContentsOfFile: [bundle pathForImageResource: @"no-network.png"]]; + NSImage *led = [NSImage imageNamed: @"no-network.png"]; _statusItem.image = led; - [led release]; [self fromCommand: @"/bin/csh" withArguments: [NSArray arrayWithObjects: @"-c", @"cd '" kDNSCRIPT_SCRIPTS_BASE_DIR @"' && exec ./gui-push-conf-change.sh prefpane", nil]];