avoid retaining tons of copies of the folder icon

This commit is contained in:
Mitchell Livingston 2007-03-05 16:51:32 +00:00
parent a9e40db432
commit 1713e5ff88
3 changed files with 6 additions and 5 deletions

View File

@ -29,9 +29,8 @@
@interface InfoWindowController : NSWindowController
{
NSArray * fTorrents;
NSArray * fPeers, * fFiles;
NSImage * fAppIcon, * fDotGreen, * fDotRed;
NSArray * fTorrents, * fPeers, * fFiles;
NSImage * fAppIcon, * fDotGreen, * fDotRed, * fFolderIcon;
IBOutlet NSTabView * fTabView;

View File

@ -74,6 +74,8 @@
fAppIcon = [[NSApp applicationIconImage] copy];
fDotGreen = [NSImage imageNamed: @"GreenDot.tiff"];
fDotRed = [NSImage imageNamed: @"RedDot.tiff"];
fFolderIcon = [[[NSWorkspace sharedWorkspace] iconForFileType: NSFileTypeForHFSTypeCode('fldr')] copy];
}
return self;
}
@ -118,6 +120,7 @@
[fFiles release];
[fAppIcon release];
[fFolderIcon release];
[super dealloc];
}
@ -715,7 +718,7 @@
if (!item)
return;
[cell setImage: [item objectForKey: @"Icon"]];
[cell setImage: [[item objectForKey: @"IsFolder"] boolValue] ? fFolderIcon : [item objectForKey: @"Icon"]];
}
else if ([[tableColumn identifier] isEqualToString: @"Check"])
{

View File

@ -1334,7 +1334,6 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
{
[dict setObject: [NSMutableArray array] forKey: @"Children"];
[dict setObject: [NSNumber numberWithInt: 1] forKey: @"Remaining"];
[dict setObject: [[NSWorkspace sharedWorkspace] iconForFileType: NSFileTypeForHFSTypeCode('fldr')] forKey: @"Icon"];
}
else
{