Skip to content

Commit

Permalink
Merge branch 'ryanbrainard-opt-notify'
Browse files Browse the repository at this point in the history
  • Loading branch information
pallotron committed Jul 29, 2014
2 parents 21cd33d + 497bb8a commit 2c1b572
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions yubiswitch/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

-(IBAction)toggleSwitchOffDelay:(id)sender;
-(IBAction)toggleLockWhenUnplugged:(id)sender;
-(IBAction)toggleDisplayNotications:(id)sender;
-(IBAction)toggle:(id)sender;
-(IBAction)quit:(id)sender;
-(IBAction)about:(id)sender;
Expand Down
7 changes: 7 additions & 0 deletions yubiswitch/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ -(void)observeValueForKeyPath:(NSString *)aKeyPath ofObject:(id)anObject
}

-(void)notify:(NSString *)msg {
BOOL displayNotifications = [[NSUserDefaults standardUserDefaults]
boolForKey:@"displayNotifications"];
if (!displayNotifications) return;
usernotification.title = msg;
[[NSUserNotificationCenter defaultUserNotificationCenter]
deliverNotification:usernotification];
Expand Down Expand Up @@ -196,6 +199,10 @@ -(IBAction)toggleLockWhenUnplugged:(id)sender {
[controller save:self];
}

- (IBAction)toggleDisplayNotications:(id)sender {
[controller save:self];
}

-(IBAction)about:(id)sender {
[[aboutwc window] makeKeyAndOrderFront:self];
[[aboutwc window] setOrderedIndex:0];
Expand Down
9 changes: 8 additions & 1 deletion yubiswitch/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@
</binding>
</connections>
</menuItem>
<menuItem title="Display notifications" id="zaa-1a-4ru">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleDisplayNotications:" target="494" id="X9f-ho-1Em"/>
<binding destination="BET-T9-5EC" name="value" keyPath="values.displayNotifications" id="42y-ke-7fE"/>
</connections>
</menuItem>
<menuItem title="Preferences..." id="ZbY-4K-DDd">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
Expand Down Expand Up @@ -91,4 +98,4 @@
</objectController>
<userDefaultsController representsSharedInstance="YES" id="BET-T9-5EC"/>
</objects>
</document>
</document>
2 changes: 2 additions & 0 deletions yubiswitch/DefaultPreferences.plist
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@
</dict>
<key>startAtLogin</key>
<false/>
<key>displayNotifications</key>
<true/>
</dict>
</plist>

0 comments on commit 2c1b572

Please sign in to comment.