Changeset 9828


Ignore:
Timestamp:
Dec 27, 2009, 7:30:20 PM (12 years ago)
Author:
livings124
Message:

avoid needlessly copying the folder icon

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/FileListNode.m

    r9342 r9828  
    116116- (NSImage *) icon
    117117{
    118     if (!fIsFolder && !fIcon)
    119         fIcon = [[[NSWorkspace sharedWorkspace] iconForFileType: [fName pathExtension]] retain];
     118    if (!fIcon)
     119        fIcon = [[[NSWorkspace sharedWorkspace] iconForFileType: fIsFolder ? NSFileTypeForHFSTypeCode('fldr')
     120                                                                            : [fName pathExtension]] retain];
    120121    return fIcon;
    121122}
  • trunk/macosx/FileNameCell.h

    r9723 r9828  
    2727@interface FileNameCell : NSActionCell
    2828{
    29     NSImage * fFolderImage;
    30    
    3129    NSMutableDictionary * fTitleAttributes, * fStatusAttributes;
    3230}
  • trunk/macosx/FileNameCell.m

    r9723 r9828  
    7575    [fStatusAttributes release];
    7676   
    77     [fFolderImage release];
    78    
    7977    [super dealloc];
    8078}
     
    8785    copy->fStatusAttributes = [fStatusAttributes retain];
    8886   
    89     copy->fFolderImage = [fFolderImage retain];
    90    
    9187    return copy;
    9288}
     
    9591{
    9692    FileListNode * node = (FileListNode *)[self objectValue];
    97     NSImage * image;
    98     if ([node isFolder])
    99     {
    100         if (!fFolderImage)
    101             fFolderImage = [[[NSWorkspace sharedWorkspace] iconForFileType: NSFileTypeForHFSTypeCode('fldr')] copy];
    102         image = fFolderImage;
    103     }
    104     else
    105         image = [node icon];
    106    
    107     return image;
     93    return [node icon];
    10894}
    10995
Note: See TracChangeset for help on using the changeset viewer.