mirror of
https://github.com/transmission/transmission
synced 2024-12-28 10:38:45 +00:00
29 lines
No EOL
508 B
Objective-C
29 lines
No EOL
508 B
Objective-C
|
|
#import "ExpandedPathToIconTransformer.h"
|
|
|
|
@implementation ExpandedPathToIconTransformer
|
|
|
|
+ (Class) transformedValueClass
|
|
{
|
|
return [NSImage class];
|
|
}
|
|
|
|
+ (BOOL) allowsReverseTransformation
|
|
{
|
|
return NO;
|
|
}
|
|
|
|
- (id) transformedValue: (id) value
|
|
{
|
|
if (!value)
|
|
return nil;
|
|
|
|
NSImage * icon = [[NSWorkspace sharedWorkspace] iconForFile: [value stringByExpandingTildeInPath]];
|
|
[icon setScalesWhenResized: YES];
|
|
[icon setSize: NSMakeSize(16.0, 16.0)];
|
|
|
|
return icon;
|
|
}
|
|
|
|
|
|
@end |