-
Notifications
You must be signed in to change notification settings - Fork 9
/
PreferencesController.m
54 lines (42 loc) · 1.54 KB
/
PreferencesController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// PreferencesController.m
// Sesamouse
//
// Created by Nathan Vander Wilt on 3/6/10.
// Copyright 2010 Calf Trail Software, LLC. All rights reserved.
//
#import "PreferencesController.h"
const CFStringRef HelperSuite = CFSTR("com.calftrail.touch-synthesis");
const CFStringRef HelperUpKey = CFSTR("SwipeActionUp");
const CFStringRef HelperDownKey = CFSTR("SwipeActionDown");
@implementation PreferencesController
// @"Ignore", @"Middle Click", @"Show Desktop", @"App Exposé", @"Exposé", @"Dashboard", @"Spaces"
- (NSArray*)upOptions {
return [NSArray arrayWithObjects:
@"Swipe up", @"Show Desktop", @"Dashboard",
@"Exposé", @"Spaces", nil];
}
- (void)setUpAction:(NSString*)action {
CFPreferencesSetAppValue(HelperUpKey, (CFStringRef)action, HelperSuite);
CFPreferencesAppSynchronize(HelperSuite);
}
- (NSString*)upAction {
CFStringRef action = CFPreferencesCopyAppValue(HelperUpKey, HelperSuite);
if (!action) action = (CFStringRef)[[self upOptions] objectAtIndex:0];
return [(NSString*)action autorelease];
}
- (NSArray*)downOptions {
return [NSArray arrayWithObjects:
@"Swipe down", @"Exposé", @"Spaces",
@"Show Desktop", @"Dashboard", nil];
}
- (void)setDownAction:(NSString*)action {
CFPreferencesSetAppValue(HelperDownKey, (CFStringRef)action, HelperSuite);
CFPreferencesAppSynchronize(HelperSuite);
}
- (NSString*)downAction {
CFStringRef action = CFPreferencesCopyAppValue(HelperDownKey, HelperSuite);
if (!action) action = (CFStringRef)[[self downOptions] objectAtIndex:0];
return [(NSString*)action autorelease];
}
@end