/[gnustep]/gnustep/usr-apps/gworkspace/GWorkspace/Preferences/XTermPref.m
ViewVC logotype

Contents of /gnustep/usr-apps/gworkspace/GWorkspace/Preferences/XTermPref.m

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Tue Sep 30 15:38:05 2003 UTC (20 years, 6 months ago) by esersale
Branch: MAIN
Changes since 1.2: +2 -0 lines
*** empty log message ***

1 /* XTermPref.m
2 *
3 * Copyright (C) 2003 Free Software Foundation, Inc.
4 *
5 * Author: Enrico Sersale <enrico@imago.ro>
6 * Date: August 2001
7 *
8 * This file is part of the GNUstep GWorkspace application
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 */
24
25
26 #include <Foundation/Foundation.h>
27 #include <AppKit/AppKit.h>
28 #ifdef GNUSTEP
29 #include "GWLib.h"
30 #include "GWFunctions.h"
31 #else
32 #include <GWorkspace/GWLib.h>
33 #include <GWorkspace/GWFunctions.h>
34 #endif
35 #include "XTermPref.h"
36 #include "GWorkspace.h"
37 #include "GNUstep.h"
38
39 static NSString *nibName = @"XTermPref";
40
41 @implementation XTermPref
42
43 - (void)dealloc
44 {
45 TEST_RELEASE (prefbox);
46 TEST_RELEASE (xterm);
47 TEST_RELEASE (xtermArgs);
48 [super dealloc];
49 }
50
51 - (id)init
52 {
53 self = [super init];
54
55 if (self) {
56 if ([NSBundle loadNibNamed: nibName owner: self] == NO) {
57 NSLog(@"failed to load %@!", nibName);
58 } else {
59 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
60
61 RETAIN (prefbox);
62 RELEASE (win);
63
64 xterm = [defaults stringForKey: @"defxterm"];
65 if (xterm != nil) {
66 RETAIN (xterm);
67 [xtermLabel setStringValue: xterm];
68 }
69
70 xtermArgs = [defaults stringForKey: @"defaultxtermargs"];
71 if (xtermArgs != nil) {
72 RETAIN (xtermArgs);
73 [argsLabel setStringValue: xtermArgs];
74 }
75
76 gw = [GWorkspace gworkspace];
77
78 /* Internationalization */
79 [setButt setTitle: NSLocalizedString(@"Set", @"")];
80 [fieldsBox setTitle: NSLocalizedString(@"XTerminal", @"")];
81 }
82 }
83
84 return self;
85 }
86
87 - (NSView *)prefView
88 {
89 return prefbox;
90 }
91
92 - (NSString *)prefName
93 {
94 return @"XTerminal";
95 }
96
97 - (IBAction)setXTerm:(id)sender
98 {
99 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
100 NSString *xt = [xtermLabel stringValue];
101 NSString *xtargs = [argsLabel stringValue];
102
103 if ([xterm isEqual: xt] && [xtermArgs isEqual: xtargs]) {
104 return;
105 }
106
107 ASSIGN (xterm, xt);
108 ASSIGN (xtermArgs, xtargs);
109
110 [defaults setObject: xterm forKey: @"defxterm"];
111 [defaults setObject: xtermArgs forKey: @"defaultxtermargs"];
112 [defaults synchronize];
113
114 [gw changeDefaultXTerm: xterm arguments: xtermArgs];
115 }
116
117 @end

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26