Skip to content

Commit

Permalink
Properly show motivation state in preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
soffes committed Aug 11, 2015
1 parent d23fb5c commit 3bb3bbe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Motivation/Configuration.xib
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="ConfigurationWindowController" customModule="Motivation" customModuleProvider="target">
<connections>
<outlet property="lightRadio" destination="SYp-OG-PUb" id="QAx-UK-2Qi"/>
<outlet property="moderateRadio" destination="pTh-rE-L1F" id="Okf-GD-efx"/>
<outlet property="terrifyingRadio" destination="daF-cg-qud" id="Qzr-li-xhu"/>
<outlet property="window" destination="QvC-M9-y7g" id="yFe-qJ-2Tx"/>
</connections>
</customObject>
Expand Down Expand Up @@ -83,7 +86,7 @@ DQ
</button>
<button tag="2" translatesAutoresizingMaskIntoConstraints="NO" id="daF-cg-qud">
<rect key="frame" x="137" y="60" width="78" height="18"/>
<buttonCell key="cell" type="radio" title="Terrifying" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="6uM-dm-epD">
<buttonCell key="cell" type="radio" title="Terrifying" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="6uM-dm-epD">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
Expand Down
17 changes: 17 additions & 0 deletions Motivation/ConfigurationWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,28 @@ class ConfigurationWindowController: NSWindowController {

// MARK: - Properties

@IBOutlet weak var lightRadio: NSButton!
@IBOutlet weak var moderateRadio: NSButton!
@IBOutlet weak var terrifyingRadio: NSButton!

override var windowNibName: String {
return "Configuration"
}


// MARK: - NSWindowController

override func windowDidLoad() {
super.windowDidLoad()

switch Preferences().motivationLevel {
case .Light: lightRadio.state = NSOnState
case .Moderate: moderateRadio.state = NSOnState
case .Terrifying: terrifyingRadio.state = NSOnState
}
}


// MARK: - Action

@IBAction func close(sender: AnyObject?) {
Expand Down

0 comments on commit 3bb3bbe

Please sign in to comment.