~ubuntu-branches/ubuntu/vivid/projectcenter.app/vivid

« back to all changes in this revision

Viewing changes to Modules/Preferences/Saving/PCSavingPrefs.m

  • Committer: Bazaar Package Importer
  • Author(s): Yavor Doganov
  • Date: 2010-06-03 16:04:52 UTC
  • mfrom: (3.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100603160452-dcsmkjwdtwxuitdo
Tags: 0.5.3~20100601-1
* New upstream release.
* debian/compat: Set to 7.
* debian/control (Section): Change to `gnustep'.
  (Build-Depends): Require debhelper >= 7, remove version constraints
  for libgnustep-gui-dev (obsolete).
  (Depends): Add ${gnustep:Depends}.
  (Standards-Version): Compliant with 3.8.4 as of this release.
  (Vcs-Arch): New field.
  (Description): Do not praise NextStep.
* debian/rules: Export GNUSTEP_MAKEFILES and get rid of gs_make.
  (OPTFLAG): No longer define; rework noopt handling to be compatible
  with gnustep-make/2.4.x (Closes: #581976).
  (build-stamp): Pass GDB=/usr/bin/gdb for the PCDefaultDebugger
  define.
  (install): Replace dh_clean -k with dh_prep.
  (binary-arch): Adjust dh_installchangelogs' argument.  Rework the
  FHS_ME_HARDER snippet; PC's supporting executables are no longer
  installed as Bundles.
* debian/patches/05_link-libs.dpatch: Update; the fix was merged
  upstream, but now -lm is required as well.
* debian/patches/10_bundles-install-dir.dpatch: Remove; obsolete with
  the new way of FHS-compliance handling.
* debian/links: Delete; no longer needed.
* debian/menu: Adjust command.
* debian/source/format:
* debian/README.source:
* debian/preinst: New file.
* debian/copyright: Bump copyright years, add more upstream authors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// 
 
2
// GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
 
3
//
 
4
// Copyright (C) 2001-2009 Free Software Foundation
 
5
//
 
6
// Authors: Sergii Stoian
 
7
//
 
8
// Description: 
 
9
//
 
10
// This file is part of GNUstep.
 
11
//
 
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.
 
16
//
 
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.
 
21
//
 
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.
 
25
 
 
26
#import "PCSavingPrefs.h"
 
27
 
 
28
@implementation PCSavingPrefs
 
29
 
 
30
// ----------------------------------------------------------------------------
 
31
// --- Init and free
 
32
// ----------------------------------------------------------------------------
 
33
 
 
34
- (id)initWithPrefController:(id <PCPreferences>)aPrefs
 
35
{
 
36
  self = [super init];
 
37
 
 
38
  if ([NSBundle loadNibNamed:@"SavingPrefs" owner:self] == NO)
 
39
    {
 
40
      NSLog(@"PCSavingPrefs: error loading NIB file!");
 
41
    }
 
42
 
 
43
  prefs = aPrefs;
 
44
 
 
45
  RETAIN(savingView);
 
46
 
 
47
  return self;
 
48
}
 
49
 
 
50
- (void)awakeFromNib
 
51
{
 
52
  [saveOnQuit setRefusesFirstResponder:YES];
 
53
  [keepBackup setRefusesFirstResponder:YES];
 
54
}
 
55
 
 
56
- (void)dealloc
 
57
{
 
58
#ifdef DEBUG
 
59
  NSLog (@"PCSavingPrefs: dealloc");
 
60
#endif
 
61
 
 
62
  [[NSNotificationCenter defaultCenter] removeObserver:self];
 
63
 
 
64
  RELEASE(savingView);
 
65
 
 
66
  [super dealloc];
 
67
}
 
68
 
 
69
// Protocol
 
70
- (void)readPreferences
 
71
{
 
72
  NSString *val;
 
73
  BOOL     bVal;
 
74
  int      state;
 
75
 
 
76
  val = [prefs stringForKey:AutoSavePeriod defaultValue:@"120"];
 
77
  [autosaveField setStringValue:val];
 
78
  [autosaveSlider setFloatValue:[val floatValue]];
 
79
 
 
80
  bVal = [prefs boolForKey:SaveOnQuit defaultValue:YES];
 
81
  state = bVal ? NSOnState : NSOffState;
 
82
  [saveOnQuit setState:state];
 
83
 
 
84
  bVal = [prefs boolForKey:KeepBackup defaultValue:YES];
 
85
  state = bVal ? NSOnState : NSOffState;
 
86
  [keepBackup setState:state];
 
87
}
 
88
 
 
89
- (NSView *)view
 
90
{
 
91
  return savingView;
 
92
}
 
93
 
 
94
// Actions
 
95
- (void)setSaveOnQuit:(id)sender
 
96
{
 
97
  BOOL state;
 
98
 
 
99
  if (saveOnQuit == nil)
 
100
    {// HACK!!! need to be fixed in GNUstep
 
101
      saveOnQuit = sender;
 
102
      return;
 
103
    }
 
104
 
 
105
  state = ([sender state] == NSOffState) ? NO : YES;
 
106
  [prefs setBool:state forKey:SaveOnQuit notify:YES];
 
107
}
 
108
 
 
109
- (void)setKeepBackup:(id)sender
 
110
{
 
111
  BOOL state;
 
112
 
 
113
  if (keepBackup == nil)
 
114
    {// HACK!!! need to be fixed in GNUstep
 
115
      keepBackup = sender;
 
116
      return;
 
117
    }
 
118
 
 
119
  state = ([sender state] == NSOffState) ? NO : YES;
 
120
  [prefs setBool:state forKey:KeepBackup notify:YES];
 
121
}
 
122
 
 
123
- (void)setSavePeriod:(id)sender
 
124
{
 
125
  NSString *periodString;
 
126
  
 
127
  if (sender == autosaveSlider)
 
128
    {
 
129
      [autosaveField setIntValue:[sender intValue]];
 
130
    }
 
131
 
 
132
  periodString = [autosaveField stringValue];
 
133
  [prefs setString:periodString forKey:AutoSavePeriod notify:YES];
 
134
 
 
135
  [[NSNotificationCenter defaultCenter] 
 
136
    postNotificationName:PCSavePeriodDidChangeNotification
 
137
                  object:periodString];
 
138
}
 
139
 
 
140
@end
 
141