-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathEGPreferencesController.m
65 lines (46 loc) · 1.57 KB
/
EGPreferencesController.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
55
56
57
58
59
60
61
62
63
64
65
//
// EGPreferencesController.m
// Sass
//
// Created by Ryan Krug on 2/16/14.
//
//
#import "EGPreferencesController.h"
NSString *const EG_PREF_OUTPUT_STYLE = @"EGSassPlugin_OutputStyle";
NSString *const EG_PREF_DEBUG_STYLE = @"EGSassPlugin_DebugStyle";
NSInteger const EG_SASS_SOURCE_COMMENTS_NONE = 0;
NSInteger const EG_SASS_SOURCE_COMMENTS_DEBUG = 1;
NSInteger const EG_SASS_SOURCE_COMMENTS_MAP = 2;
@interface EGPreferencesController ()
@end
@implementation EGPreferencesController
- (instancetype)init
{
self = [super initWithWindowNibName:@"EGPreferencesController"];
if (!self) {
return nil;
}
return self;
}
- (void)windowDidLoad
{
[super windowDidLoad];
NSInteger outputStyle = [[NSUserDefaults standardUserDefaults] integerForKey:EG_PREF_OUTPUT_STYLE];
NSInteger debugStyle = [[NSUserDefaults standardUserDefaults] integerForKey:EG_PREF_DEBUG_STYLE];
[self.outputStyleButton selectItemAtIndex:outputStyle];
[self.debugStyleButton selectItemAtIndex:debugStyle];
}
#pragma mark - IBAction
- (IBAction)outputStyleChanged:(id)sender
{
NSInteger outputStyle = [self.outputStyleButton indexOfSelectedItem];
[[NSUserDefaults standardUserDefaults] setInteger:outputStyle forKey:EG_PREF_OUTPUT_STYLE];
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (IBAction)debugStyleChanged:(id)sender
{
NSInteger debugStyle = [self.debugStyleButton indexOfSelectedItem];
[[NSUserDefaults standardUserDefaults] setInteger:debugStyle forKey:EG_PREF_DEBUG_STYLE];
[[NSUserDefaults standardUserDefaults] synchronize];
}
@end