2 * Adium is the legal property of its developers, whose names are listed in the copyright file included
3 * with this source distribution.
5 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6 * General Public License as published by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11 * Public License for more details.
13 * You should have received a copy of the GNU General Public License along with this program; if not,
14 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 #import "AIStatusIconPreviewController.h"
19 @implementation AIStatusIconPreviewController
21 - (NSView *) previewView
26 - (void) setXtra:(AIXtraInfo *)xtraInfo
29 images = [[NSMutableArray alloc] init];
30 [statusNames autorelease];
32 NSString * resourcePath = [xtraInfo resourcePath];
33 NSDictionary * iconDict = [[NSDictionary dictionaryWithContentsOfFile:[resourcePath stringByAppendingPathComponent:@"Icons.plist"]] objectForKey:@"List"];
35 paths = [[iconDict allValues] objectEnumerator];
36 statusNames = [[iconDict allKeys] retain];
41 while((imageName = [paths nextObject]))
43 imagePath = [resourcePath stringByAppendingPathComponent:imageName];
44 image = [[[NSImage alloc] initWithContentsOfFile:imagePath] autorelease];
46 [images addObject:image];
48 [tableView reloadData];
49 [tableView sizeToFit];
54 [tableView setIntercellSpacing:NSMakeSize(1.0f, 3.0f)];
55 [tableView setHeaderView:nil];
57 NSTableColumn * column = [[NSTableColumn alloc] initWithIdentifier:@"Status Icon"];
58 [column setMaxWidth:32.0f];
59 [column setMinWidth:32.0f];
60 [column setDataCell:[[[NSImageCell alloc]init]autorelease]];
61 [tableView addTableColumn:column];
64 column = [[NSTableColumn alloc] initWithIdentifier:@"Status Name"];
65 [tableView addTableColumn:column];
69 - (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex
74 - (int)numberOfRowsInTableView:(NSTableView *)aTableView
76 return [statusNames count];
79 - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
81 if([[aTableColumn identifier] isEqualToString:@"Status Icon"])
82 return [images objectAtIndex:rowIndex];
84 return [statusNames objectAtIndex:rowIndex];