1
0
Fork 0

Some more cleaning up....

master
Matthieu Lalonde 13 years ago
parent 5ef20235d8
commit d3f915740d

@ -27,7 +27,6 @@
if (![defaults boolForKey:@"configured"]) if (![defaults boolForKey:@"configured"])
{ {
[self initDefaults]; [self initDefaults];
[self showConfigPanel:nil];
} else { } else {
[self initialize]; [self initialize];
} }
@ -87,20 +86,17 @@
[defaults setBool:YES forKey:@"configured"]; [defaults setBool:YES forKey:@"configured"];
// sync the defaults to disk
[defaults synchronize];
// TODO: Add modal alert "First launch" here... // TODO: Add modal alert "First launch" here...
[self showConfigPanel:self]; [self showConfigPanel:self];
} }
- (void) readDefaults - (void) readDefaults
{ {
hostname = [defaults valueForKey:@"hostname"]; hostname = [defaults valueForKey:@"hostname"];
protocol = [defaults valueForKey:@"protocol"]; protocol = [defaults valueForKey:@"protocol"];
port = [defaults integerForKey:@"port"]; port = [defaults integerForKey:@"port"];
username = [defaults valueForKey:@"username"]; username = [defaults valueForKey:@"username"];
password = [defaults valueForKey:@"password"]; password = [defaults valueForKey:@"password"];
showMenuIcon = [defaults boolForKey:@"showMenuIcon"]; showMenuIcon = [defaults boolForKey:@"showMenuIcon"];
useBytes = [defaults boolForKey:@"useBytes"]; useBytes = [defaults boolForKey:@"useBytes"];
@ -303,30 +299,19 @@
[configStateStatus startAnimation:nil]; [configStateStatus startAnimation:nil];
[configStateStatus setHidden:false]; [configStateStatus setHidden:false];
//WRTRequest *wrtr = [[WRTRequest alloc] init];
// TODO check that the request is actually successful
hostname = [configFieldHostname stringValue]; hostname = [configFieldHostname stringValue];
[defaults setValue:hostname forKey:@"hostname"];
port = [configFieldPort intValue]; port = [configFieldPort intValue];
[defaults setInteger:port forKey:@"port"];
//NSLog(@"%d", [configFieldProtocol state]);
if ([configFieldProtocolHTTP state] == 1) { if ([configFieldProtocolHTTP state] == 1) {
protocol = @"http"; protocol = @"http";
} else if ([configFieldProtocolHTTPS state] == 1) { } else if ([configFieldProtocolHTTPS state] == 1) {
protocol = @"https"; protocol = @"https";
} }
[defaults setValue:protocol forKey:@"protocol"];
refreshTime = [configFieldRefresh integerValue]; refreshTime = [configFieldRefresh integerValue];
[defaults setInteger:refreshTime forKey:@"refreshTime"];
useBytes = ([configFieldUseBytes state] == 1 ? true: false); useBytes = ([configFieldUseBytes state] == 1 ? true: false);
[defaults setBool:useBytes forKey:@"useBytes"];
if ([configFieldShowIcon state] == NSOffState && [defaults boolForKey:@"showMenuIcon"] == true) { if ([configFieldShowIcon state] == NSOffState && [defaults boolForKey:@"showMenuIcon"] == true) {
[self hideMenubarIcon]; [self hideMenubarIcon];
@ -335,11 +320,12 @@
} }
showMenuIcon = ([configFieldShowIcon state] == 1 ? true: false); showMenuIcon = ([configFieldShowIcon state] == 1 ? true: false);
[defaults setBool:showMenuIcon forKey:@"showMenuIcon"];
[configStateStatus stopAnimation:nil]; [configStateStatus stopAnimation:nil];
[configStateStatus setHidden:true]; [configStateStatus setHidden:true];
[self writeDefaults];
[defaults synchronize]; [defaults synchronize];
[self initialize]; [self initialize];

Loading…
Cancel
Save