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