mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-11 23:56:37 -07:00
wire up control to launch at startup in preferences
This commit is contained in:
parent
b0971e3a01
commit
decb4261d4
2 changed files with 41 additions and 4 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue