-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb1ccae
commit c4035c0
Showing
8 changed files
with
354 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import Cocoa | ||
import Settings | ||
import LaunchAtLogin | ||
|
||
|
||
class GeneralSettingViewController: NSViewController, SettingsPane { | ||
public let paneIdentifier = Settings.PaneIdentifier(rawValue: "preferences_general") | ||
public let paneTitle = "Setting" | ||
public let toolbarItemIcon = NSImage(named: NSImage.infoName)! | ||
|
||
override var nibName: NSNib.Name? { "GeneralSettingViewController" } | ||
|
||
|
||
@IBOutlet weak var launchAtLoginButton: NSButton! | ||
@IBOutlet weak var autoPasteButton: NSButton! | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
self.preferredContentSize = NSSize.init(width: 400, height: 300) | ||
} | ||
|
||
override func viewWillAppear() { | ||
super.viewWillAppear() | ||
populateLaunchAtLogin() | ||
populateAutoPaste() | ||
} | ||
|
||
|
||
|
||
@IBAction func launchAtLoginChanged(_ sender: NSButton) { | ||
LaunchAtLogin.isEnabled = (sender.state == .on) | ||
} | ||
|
||
@IBAction func autoPasteChanged(_ sender: NSButton) { | ||
if sender.state == .on && ClipboardController.clipboard.checkAutoPastePermission() == false { | ||
autoPasteButton.state = .off | ||
UserDefaults.standard.autoPaste = false | ||
return | ||
} | ||
autoPasteButton.state = sender.state | ||
UserDefaults.standard.autoPaste = sender.state == .on | ||
} | ||
|
||
private func populateLaunchAtLogin() { | ||
launchAtLoginButton.state = LaunchAtLogin.isEnabled ? .on : .off | ||
} | ||
|
||
private func populateAutoPaste() { | ||
autoPasteButton.state = UserDefaults.standard.autoPaste ? .on : .off | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.