-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBMPreferencesController.m
49 lines (34 loc) · 1.14 KB
/
BMPreferencesController.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
#import "BMPreferencesController.h"
#import "BMPreferences+Constants.h"
#import "WBRemoteVersionChecker.h"
@implementation BMPreferencesController
+ (void) showPreferences
{
static BMPreferencesController * sPreferencesController=nil;
if (sPreferencesController==nil)
{
sPreferencesController=[[BMPreferencesController alloc] initWithWindowNibName:@"BMPreferencesWindow"];
}
[sPreferencesController showWindow:self];
}
- (void) awakeFromNib
{
defaults_=[NSUserDefaults standardUserDefaults];
[self initSettings];
[[self window] center];
}
#pragma mark -
- (void) initSettings
{
[IBalwaysOneWindowCheckBox_ setState:[defaults_ boolForKey:BM_PREFERENCES_ALWAYS_SHOW_ONE_WINDOW]? NSOnState : NSOffState];
[IBcheckUpdateCheckBox_ setState:([[WBRemoteVersionChecker sharedChecker] isCheckEnabled]==YES) ? NSOnState: NSOffState];
}
- (void) switchAlwaysOneWindow:(id) sender
{
[defaults_ setBool:([IBalwaysOneWindowCheckBox_ state]==NSOnState) forKey:BM_PREFERENCES_ALWAYS_SHOW_ONE_WINDOW];
}
- (void) switchCheckUpdate:(id) sender
{
[[WBRemoteVersionChecker sharedChecker] setCheckEnabled:([IBcheckUpdateCheckBox_ state]==NSOnState)];
}
@end