diff options
Diffstat (limited to 'ZeroTier One/PreferencesViewController.swift')
| -rw-r--r-- | ZeroTier One/PreferencesViewController.swift | 23 | 
1 files changed, 23 insertions, 0 deletions
diff --git a/ZeroTier One/PreferencesViewController.swift b/ZeroTier One/PreferencesViewController.swift index 95d2d882..0fd10281 100644 --- a/ZeroTier One/PreferencesViewController.swift +++ b/ZeroTier One/PreferencesViewController.swift @@ -10,9 +10,32 @@ import Cocoa  class PreferencesViewController: NSViewController { +    @IBOutlet var startupCheckBox: NSButton! + +    let launchController = LaunchAtLoginController() +      override func viewDidLoad() {          super.viewDidLoad()          // Do view setup here. + +        if launchController.launchAtLogin { +            startupCheckBox.state = NSOnState +        } +        else { +            startupCheckBox.state = NSOffState +        } +    } + +    @IBAction func onStartupCheckBoxChanged(sender: NSButton) { +        let bundle = NSBundle.mainBundle() +        let bundleURL = bundle.bundleURL + +        if sender.state == NSOnState { +            launchController.setLaunchAtLogin(true, forURL: bundleURL) +        } +        else { +            launchController.setLaunchAtLogin(false, forURL: bundleURL) +        }      }  }  | 
