Skip to content

Commit

Permalink
Clean up this class.
Browse files Browse the repository at this point in the history
  • Loading branch information
pkamb committed Feb 16, 2016
1 parent 7888013 commit 1973d51
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
6 changes: 2 additions & 4 deletions PowerKey/PKPreferencesWindowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ const NSInteger kPowerKeyScriptTag;
@property (nonatomic, retain) IBOutlet NSPopUpButton *powerKeySelector;
@property (nonatomic, retain) IBOutlet NSTextField *versionNumberLabel;

- (IBAction)didSelectPowerKeyReplacement:(id)sender;

- (IBAction)runInBackground:(id)sender;
- (IBAction)openSupportLink:(id)sender;

- (NSURL *)applicationSupportDirectory;
- (void)copyBundleResourceToSupportDirectory:(NSString *)resource withExtension:(NSString *)extension;
- (IBAction)didSelectPowerKeyReplacement:(id)sender;

@end
20 changes: 10 additions & 10 deletions PowerKey/PKPreferencesWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ - (void)windowDidLoad {
[self selectPowerKeyReplacementKeyCode:replacementKeyCode withScriptURL:scriptURL];
}

- (IBAction)runInBackground:(id)sender {
[self.window orderOut:sender];

[[NSApplication sharedApplication] setActivationPolicy:NSApplicationActivationPolicyAccessory];
}

- (IBAction)openSupportLink:(id)sender {
system("open https://github.com/pkamb/powerkey#frequently-asked-questions");
}

- (NSArray *)powerKeyReplacements {
NSArray *replacements = @[@[@"Delete", @(kVK_ForwardDelete)],
@[@"No Action", @(kPowerKeyDeadKeyTag)],
Expand Down Expand Up @@ -135,10 +145,6 @@ - (BOOL)panel:(id)sender validateURL:(NSURL *)url error:(NSError **)outError {
return script || appleScript;
}

- (IBAction)openSupportLink:(id)sender {
system("open https://github.com/pkamb/powerkey#frequently-asked-questions");
}

- (NSURL *)applicationSupportDirectory {
NSArray *urls = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask];
NSURL *applicationSupport = [[urls firstObject] URLByAppendingPathComponent:[[NSBundle mainBundle] bundleIdentifier] isDirectory:YES];
Expand Down Expand Up @@ -166,10 +172,4 @@ - (void)copyBundleResourceToSupportDirectory:(NSString *)resource withExtension:
}
}

- (IBAction)runInBackground:(id)sender {
[self.window orderOut:sender];

[[NSApplication sharedApplication] setActivationPolicy:NSApplicationActivationPolicyAccessory];
}

@end

0 comments on commit 1973d51

Please sign in to comment.