From 50a2250ac53bb8a846a5676694189287b389546c Mon Sep 17 00:00:00 2001 From: staticlinuxpro Date: Fri, 17 Oct 2014 19:40:34 -0500 Subject: [PATCH 1/3] Change MenuBar NSImage to template Makes the menubar icon white when the status bar is dark (Yosemite+), also allows the OS to tweak for better visibility. --- DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.m | 1 + 1 file changed, 1 insertion(+) diff --git a/DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.m b/DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.m index 7ee7936..40ed36c 100644 --- a/DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.m +++ b/DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.m @@ -79,6 +79,7 @@ DNSConfigurationState currentState = kDNS_CONFIGURATION_UNKNOWN; default: led = [NSImage imageNamed: @"icon-no-network"]; } + [led setTemplate:YES]; _statusItem.image = led; } From 85b67e70aa7bad15b2020ad1037b5a535f755579 Mon Sep 17 00:00:00 2001 From: Luke Adams Date: Fri, 17 Oct 2014 19:47:16 -0500 Subject: [PATCH 2/3] Update Menubar to ARC --- DNSCrypt-Menubar/DNSCrypt-Menubar.xcodeproj/project.pbxproj | 4 ++++ DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.h | 4 ++-- DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.m | 4 +--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/DNSCrypt-Menubar/DNSCrypt-Menubar.xcodeproj/project.pbxproj b/DNSCrypt-Menubar/DNSCrypt-Menubar.xcodeproj/project.pbxproj index f4b5816..d760cee 100644 --- a/DNSCrypt-Menubar/DNSCrypt-Menubar.xcodeproj/project.pbxproj +++ b/DNSCrypt-Menubar/DNSCrypt-Menubar.xcodeproj/project.pbxproj @@ -297,6 +297,8 @@ 09A13AEC145F3B9000B227A4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -315,6 +317,8 @@ 09A13AED145F3B9000B227A4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", diff --git a/DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.h b/DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.h index f62cdc3..81d0e30 100644 --- a/DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.h +++ b/DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.h @@ -8,7 +8,7 @@ #define kDNSCRYPT_CONTROL_DIR kDNSCRYPT_VAR_BASE_DIR @"/control" @interface AppDelegate : NSObject { - NSWindow *_window; + NSWindow *__weak _window; NSMenu *_dnscryptMenu; NSStatusItem *_statusItem; NSMenuItem *_versionMenuItem; @@ -25,7 +25,7 @@ typedef enum { } DNSConfigurationState; @property (strong) NSStatusItem *statusItem; -@property (assign) NSWindow *window; +@property (weak) NSWindow *window; @property (strong) IBOutlet NSMenu *dnscryptMenu; @property (strong) IBOutlet NSMenuItem *versionMenuItem; diff --git a/DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.m b/DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.m index 40ed36c..4dad2d0 100644 --- a/DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.m +++ b/DNSCrypt-Menubar/DNSCrypt-Menubar/AppDelegate.m @@ -28,8 +28,7 @@ DNSConfigurationState currentState = kDNS_CONFIGURATION_UNKNOWN; [task launch]; data = [[pipe fileHandleForReading] readDataToEndOfFile]; [task waitUntilExit]; - [task release]; - result = [[[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding] autorelease]; + result = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding]; if ([result hasSuffix: @"\n"]) { result = [result substringToIndex: result.length - 1]; } @@ -147,7 +146,6 @@ DNSConfigurationState currentState = kDNS_CONFIGURATION_UNKNOWN; - (void) awakeFromNib { _statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength]; - [_statusItem retain]; _statusItem.highlightMode = TRUE; _statusItem.toolTip = @"DNSCrypt"; _statusItem.menu = _dnscryptMenu; From 76bcc9755e60f4a119318c5cf5e04c8d14e46ef2 Mon Sep 17 00:00:00 2001 From: Luke Adams Date: Fri, 17 Oct 2014 19:51:51 -0500 Subject: [PATCH 3/3] Disable GC on the prefpane. Now uses ARC. --- DNSCrypt-Preference-Pane/DNSCrypt.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DNSCrypt-Preference-Pane/DNSCrypt.xcodeproj/project.pbxproj b/DNSCrypt-Preference-Pane/DNSCrypt.xcodeproj/project.pbxproj index 0d24358..57f4f91 100644 --- a/DNSCrypt-Preference-Pane/DNSCrypt.xcodeproj/project.pbxproj +++ b/DNSCrypt-Preference-Pane/DNSCrypt.xcodeproj/project.pbxproj @@ -347,7 +347,7 @@ "$(inherited)", "\"$(SRCROOT)\"", ); - GCC_ENABLE_OBJC_GC = no; + GCC_ENABLE_OBJC_GC = unsupported; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "DNSCrypt/DNSCrypt-Prefix.pch"; GCC_VERSION = ""; @@ -368,7 +368,7 @@ "$(inherited)", "\"$(SRCROOT)\"", ); - GCC_ENABLE_OBJC_GC = no; + GCC_ENABLE_OBJC_GC = unsupported; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "DNSCrypt/DNSCrypt-Prefix.pch"; GCC_VERSION = "";