1/* DefSortOrderPref.m 2 * 3 * Copyright (C) 2003-2010 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. 23 */ 24 25#import <Foundation/Foundation.h> 26#import <AppKit/AppKit.h> 27#import <GNUstepBase/GNUstep.h> 28 29#import "FSNodeRep.h" 30#import "DefSortOrderPref.h" 31#import "GWorkspace.h" 32 33 34static NSString *nibName = @"DefSortOrderPref"; 35 36@implementation DefSortOrderPref 37 38- (void)dealloc 39{ 40 RELEASE (prefbox); 41 [super dealloc]; 42} 43 44- (id)init 45{ 46 self = [super init]; 47 if(self) { 48 if ([NSBundle loadNibNamed: nibName owner: self] == NO) { 49 NSLog(@"failed to load %@!", nibName); 50 } else { 51 RETAIN (prefbox); 52 RELEASE (win); 53 54 sortType = [[FSNodeRep sharedInstance] defaultSortOrder]; 55 [matrix selectCellAtRow: sortType column: 0]; 56 57 [setButt setEnabled: NO]; 58 59 /* Internationalization */ 60 [setButt setTitle: NSLocalizedString(@"Set", @"")]; 61 [selectbox setTitle: NSLocalizedString(@"Sort by", @"")]; 62 [sortinfo1 setStringValue: NSLocalizedString(@"The method will apply to all the folders", @"")]; 63 [sortinfo2 setStringValue: NSLocalizedString(@"that have no order specified", @"")]; 64 [[matrix cellAtRow:0 column:0] setTitle: NSLocalizedString(@"Name", @"")]; 65 [[matrix cellAtRow:1 column:0] setTitle: NSLocalizedString(@"Type", @"")]; 66 [[matrix cellAtRow:2 column:0] setTitle: NSLocalizedString(@"Date", @"")]; 67 [[matrix cellAtRow:3 column:0] setTitle: NSLocalizedString(@"Size", @"")]; 68 [[matrix cellAtRow:4 column:0] setTitle: NSLocalizedString(@"Owner", @"")]; 69 } 70 } 71 72 return self; 73} 74 75- (NSView *)prefView 76{ 77 return prefbox; 78} 79 80- (NSString *)prefName 81{ 82 return NSLocalizedString(@"Sorting Order", @""); 83} 84 85- (void)changeType:(id)sender 86{ 87 sortType = [[sender selectedCell] tag]; 88 [setButt setEnabled: YES]; 89} 90 91- (void)setNewSortType:(id)sender 92{ 93 [[FSNodeRep sharedInstance] setDefaultSortOrder: sortType]; 94 [setButt setEnabled: NO]; 95 96 [[NSDistributedNotificationCenter defaultCenter] 97 postNotificationName: @"GWSortTypeDidChangeNotification" 98 object: nil 99 userInfo: nil]; 100} 101 102@end 103