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

Loading…
Cancel
Save