2
// GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
4
// Copyright (C) 2001-2009 Free Software Foundation
6
// Authors: Sergii Stoian
10
// This file is part of GNUstep.
12
// This application is free software; you can redistribute it and/or
13
// modify it under the terms of the GNU General Public License as published
14
// by the Free Software Foundation; either version 2 of the License, or
15
// (at your option) any later version.
17
// This application is distributed in the hope that it will be useful,
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
// Library General Public License for more details.
22
// You should have received a copy of the GNU General Public
23
// License along with this library; if not, write to the Free Software
24
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
26
#import "PCSavingPrefs.h"
28
@implementation PCSavingPrefs
30
// ----------------------------------------------------------------------------
32
// ----------------------------------------------------------------------------
34
- (id)initWithPrefController:(id <PCPreferences>)aPrefs
38
if ([NSBundle loadNibNamed:@"SavingPrefs" owner:self] == NO)
40
NSLog(@"PCSavingPrefs: error loading NIB file!");
52
[saveOnQuit setRefusesFirstResponder:YES];
53
[keepBackup setRefusesFirstResponder:YES];
59
NSLog (@"PCSavingPrefs: dealloc");
62
[[NSNotificationCenter defaultCenter] removeObserver:self];
70
- (void)readPreferences
76
val = [prefs stringForKey:AutoSavePeriod defaultValue:@"120"];
77
[autosaveField setStringValue:val];
78
[autosaveSlider setFloatValue:[val floatValue]];
80
bVal = [prefs boolForKey:SaveOnQuit defaultValue:YES];
81
state = bVal ? NSOnState : NSOffState;
82
[saveOnQuit setState:state];
84
bVal = [prefs boolForKey:KeepBackup defaultValue:YES];
85
state = bVal ? NSOnState : NSOffState;
86
[keepBackup setState:state];
95
- (void)setSaveOnQuit:(id)sender
99
if (saveOnQuit == nil)
100
{// HACK!!! need to be fixed in GNUstep
105
state = ([sender state] == NSOffState) ? NO : YES;
106
[prefs setBool:state forKey:SaveOnQuit notify:YES];
109
- (void)setKeepBackup:(id)sender
113
if (keepBackup == nil)
114
{// HACK!!! need to be fixed in GNUstep
119
state = ([sender state] == NSOffState) ? NO : YES;
120
[prefs setBool:state forKey:KeepBackup notify:YES];
123
- (void)setSavePeriod:(id)sender
125
NSString *periodString;
127
if (sender == autosaveSlider)
129
[autosaveField setIntValue:[sender intValue]];
132
periodString = [autosaveField stringValue];
133
[prefs setString:periodString forKey:AutoSavePeriod notify:YES];
135
[[NSNotificationCenter defaultCenter]
136
postNotificationName:PCSavePeriodDidChangeNotification
137
object:periodString];