forked from damariei/wiiscale
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PrefsController.m
44 lines (36 loc) · 993 Bytes
/
PrefsController.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
//
// PrefsController.m
// GoogleHealthWeight
//
// Created by Ford Parsons on 10/10/10.
// Copyright 2010 Ford Parsons. All rights reserved.
//
#import "PrefsController.h"
@implementation PrefsController
@synthesize addOrDeleteBtn;
@synthesize newUser;
@synthesize didCancel;
@synthesize userText;
- (id)init {
if ([super init]) {
newUser = true;
didCancel = false;
}
return self;
}
- (IBAction)cancelBtnClicked:(id)sender {
didCancel = true;
[[NSUserDefaults standardUserDefaults] setValue:@"" forKey:@"username"];
[NSApp endSheet:configureSheet];
}
- (IBAction)addOrDeleteBtnClicked:(id)sender {
didCancel = false;
if (newUser) {
[[NSUserDefaults standardUserDefaults] setValue:[userText stringValue] forKey:@"username"];
} else {
[[NSUserDefaults standardUserDefaults] setValue:@"" forKey:@"username"];
}
[[NSUserDefaults standardUserDefaults] synchronize];
[NSApp endSheet:configureSheet];
}
@end