/* * GNUnet Setup (Cocoa UI) * Copyright (C) 2009 Heikki Lindholm * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #import "GNDatastorePage.h" @implementation GNDatastorePage - (void)awakeFromNib { char *val; [messageView setDrawsBackground:NO]; [[messageView enclosingScrollView] setDrawsBackground:NO]; GNUNET_GC_get_configuration_value_string( [assistant gnunetGCConfiguration], "FS", "QUOTA", "1024", &val); [datastoreQuotaField setStringValue:[[[NSString alloc] initWithCString:val encoding:NSUTF8StringEncoding] autorelease]]; GNUNET_free(val); if (GNUNET_GC_get_configuration_value_yesno( [assistant gnunetGCConfiguration], "FS", "ACTIVEMIGRATION", GNUNET_YES) == GNUNET_YES) [migrationButton setState:NSOnState]; else [migrationButton setState:NSOffState]; } - (IBAction)backAction:(id)sender { NSControl *control = (NSControl *)sender; if ([[control window] firstResponder] != nil && [[control window] firstResponder] != control && [[control window] makeFirstResponder:nil] == NO) { return; } [assistant previousPage]; } - (IBAction)continueAction:(id)sender { NSControl *control = (NSControl *)sender; if ([[control window] firstResponder] != nil && [[control window] firstResponder] != control && [[control window] makeFirstResponder:nil] == NO) { return; } [assistant nextPage]; } - (IBAction)migrationButtonPressed:(id)sender { if ([migrationButton state] == NSOnState) [assistant setConfigurationOption:"ACTIVEMIGRATION" inSection:"FS" toValue:"YES" fromControl:migrationButton]; else [assistant setConfigurationOption:"ACTIVEMIGRATION" inSection:"FS" toValue:"NO" fromControl:migrationButton]; } - (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor { if (control == datastoreQuotaField) return [assistant setConfigurationOption:"QUOTA" inSection:"FS" toValue:[[control stringValue] UTF8String] fromControl:control]; return YES; } @end