mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 12:28:52 +00:00
avoid needlessly copying the folder icon
This commit is contained in:
@@ -115,8 +115,9 @@
|
||||
|
||||
- (NSImage *) icon
|
||||
{
|
||||
if (!fIsFolder && !fIcon)
|
||||
fIcon = [[[NSWorkspace sharedWorkspace] iconForFileType: [fName pathExtension]] retain];
|
||||
if (!fIcon)
|
||||
fIcon = [[[NSWorkspace sharedWorkspace] iconForFileType: fIsFolder ? NSFileTypeForHFSTypeCode('fldr')
|
||||
: [fName pathExtension]] retain];
|
||||
return fIcon;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
|
||||
@interface FileNameCell : NSActionCell
|
||||
{
|
||||
NSImage * fFolderImage;
|
||||
|
||||
NSMutableDictionary * fTitleAttributes, * fStatusAttributes;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,8 +74,6 @@
|
||||
[fTitleAttributes release];
|
||||
[fStatusAttributes release];
|
||||
|
||||
[fFolderImage release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@@ -86,25 +84,13 @@
|
||||
copy->fTitleAttributes = [fTitleAttributes retain];
|
||||
copy->fStatusAttributes = [fStatusAttributes retain];
|
||||
|
||||
copy->fFolderImage = [fFolderImage retain];
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
- (NSImage *) image
|
||||
{
|
||||
FileListNode * node = (FileListNode *)[self objectValue];
|
||||
NSImage * image;
|
||||
if ([node isFolder])
|
||||
{
|
||||
if (!fFolderImage)
|
||||
fFolderImage = [[[NSWorkspace sharedWorkspace] iconForFileType: NSFileTypeForHFSTypeCode('fldr')] copy];
|
||||
image = fFolderImage;
|
||||
}
|
||||
else
|
||||
image = [node icon];
|
||||
|
||||
return image;
|
||||
return [node icon];
|
||||
}
|
||||
|
||||
- (NSRect) imageRectForBounds: (NSRect) bounds
|
||||
|
||||
Reference in New Issue
Block a user