1 |
/* DefSortOrderPref.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 "DefSortOrderPref.h" |
36 |
#include "GWorkspace.h" |
37 |
#include "GNUstep.h" |
38 |
|
39 |
#define byname 0 |
40 |
#define bykind 1 |
41 |
#define bydate 2 |
42 |
#define bysize 3 |
43 |
#define byowner 4 |
44 |
|
45 |
static NSString *nibName = @"DefSortOrderPref"; |
46 |
|
47 |
@implementation DefSortOrderPref |
48 |
|
49 |
- (void)dealloc |
50 |
{ |
51 |
RELEASE (prefbox); |
52 |
[super dealloc]; |
53 |
} |
54 |
|
55 |
- (id)init |
56 |
{ |
57 |
self = [super init]; |
58 |
if(self) { |
59 |
if ([NSBundle loadNibNamed: nibName owner: self] == NO) { |
60 |
NSLog(@"failed to load %@!", nibName); |
61 |
} else { |
62 |
RETAIN (prefbox); |
63 |
RELEASE (win); |
64 |
|
65 |
sortType = [GWLib defSortType]; |
66 |
[matrix selectCellAtRow: sortType column: 0]; |
67 |
|
68 |
[setButt setEnabled: NO]; |
69 |
|
70 |
/* Internationalization */ |
71 |
[setButt setTitle: NSLocalizedString(@"Set", @"")]; |
72 |
[selectbox setTitle: NSLocalizedString(@"Sort by", @"")]; |
73 |
[sortinfo1 setStringValue: NSLocalizedString(@"The method will apply to all the folders", @"")]; |
74 |
[sortinfo2 setStringValue: NSLocalizedString(@"that have no order specified", @"")]; |
75 |
[[matrix cellAtRow:0 column:0] setStringValue: NSLocalizedString(@"Name", @"")]; |
76 |
[[matrix cellAtRow:1 column:0] setStringValue: NSLocalizedString(@"Kind", @"")]; |
77 |
[[matrix cellAtRow:2 column:0] setStringValue: NSLocalizedString(@"Date", @"")]; |
78 |
[[matrix cellAtRow:3 column:0] setStringValue: NSLocalizedString(@"Size", @"")]; |
79 |
[[matrix cellAtRow:4 column:0] setStringValue: NSLocalizedString(@"Owner", @"")]; |
80 |
} |
81 |
} |
82 |
|
83 |
return self; |
84 |
} |
85 |
|
86 |
- (NSView *)prefView |
87 |
{ |
88 |
return prefbox; |
89 |
} |
90 |
|
91 |
- (NSString *)prefName |
92 |
{ |
93 |
return NSLocalizedString(@"Sorting Order", @""); |
94 |
} |
95 |
|
96 |
- (void)changeType:(id)sender |
97 |
{ |
98 |
sortType = [[sender selectedCell] tag]; |
99 |
[setButt setEnabled: YES]; |
100 |
} |
101 |
|
102 |
- (void)setNewSortType:(id)sender |
103 |
{ |
104 |
[GWLib setDefSortType: sortType]; |
105 |
[setButt setEnabled: NO]; |
106 |
} |
107 |
|
108 |
@end |