From 731b77e1ad84b186223ff221628563a8a427ed4d Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Fri, 9 Dec 2011 16:35:15 -0800 Subject: [PATCH] If we don't have the permission to connect to the dnscrypt-updater socket, gray out the check boxes. --- DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt.m b/DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt.m index 5099ae2..360f52b 100644 --- a/DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt.m +++ b/DNSCrypt-Preference-Pane/DNSCrypt/DNSCrypt.m @@ -142,6 +142,13 @@ BOOL checkBoxesHaveBeenInitialized = NO; return [config writeToFile: prefPaneConfigFile atomically: YES]; } +- (void) setReadOnly: (BOOL) readOnly { + enableOpenDNSButton.enabled = !readOnly; + enableDNSCryptButton.enabled = !readOnly; + useHTTPSButton.enabled = !readOnly; + enableInsecureDNSButton.enabled = !readOnly; +} + - (BOOL) loadPrefPaneConfig { NSString *prefPaneConfigFile = [self getPrefPaneConfigFile]; @@ -160,6 +167,9 @@ BOOL checkBoxesHaveBeenInitialized = NO; if ([enableInsecure_ isKindOfClass: [NSNumber class]]) { enableInsecure = [enableInsecure_ boolValue]; } + if ([self sendCommandToConfigUpdater: @"dc.w $4E71"] == FALSE) { + [self setReadOnly: YES]; + } return TRUE; }