From 1973d514a6aa9c4c24726db4478df83f185d4cf1 Mon Sep 17 00:00:00 2001 From: Peter Kamb Date: Mon, 15 Feb 2016 23:56:04 -0800 Subject: [PATCH] Clean up this class. --- PowerKey/PKPreferencesWindowController.h | 6 ++---- PowerKey/PKPreferencesWindowController.m | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/PowerKey/PKPreferencesWindowController.h b/PowerKey/PKPreferencesWindowController.h index 09f136d..aa62f12 100644 --- a/PowerKey/PKPreferencesWindowController.h +++ b/PowerKey/PKPreferencesWindowController.h @@ -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 diff --git a/PowerKey/PKPreferencesWindowController.m b/PowerKey/PKPreferencesWindowController.m index 75bf360..f12c365 100644 --- a/PowerKey/PKPreferencesWindowController.m +++ b/PowerKey/PKPreferencesWindowController.m @@ -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)], @@ -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]; @@ -166,10 +172,4 @@ - (void)copyBundleResourceToSupportDirectory:(NSString *)resource withExtension: } } -- (IBAction)runInBackground:(id)sender { - [self.window orderOut:sender]; - - [[NSApplication sharedApplication] setActivationPolicy:NSApplicationActivationPolicyAccessory]; -} - @end