mirror of
https://github.com/textmate/textmate.git
synced 2026-04-06 03:01:29 -04:00
Use system icons for Open With menu
Previously we used our own icon image class which support SCM status, custom images for known file types, and more. This is however is unnecessary, as we know the Open With menu contains only applications, and each should use their standard icon. This should also fix issue #510, although the issue was never diagnosed beyond git stalling while trying to get SCM status for the application icons in this menu.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#import "OakOpenWithMenu.h"
|
||||
#import "NSMenuItem Additions.h"
|
||||
#import "NSMenu Additions.h"
|
||||
#import <OakFoundation/NSString Additions.h>
|
||||
#import <oak/oak.h>
|
||||
@@ -103,9 +102,16 @@ static OakOpenWithMenu* SharedInstance;
|
||||
iterate(app, appURLs)
|
||||
{
|
||||
NSMenuItem* menuItem = [menu addItemWithTitle:app->first action:@selector(openWith:) keyEquivalent:@""];
|
||||
[menuItem setIconForFile:[app->second path]];
|
||||
[menuItem setTarget:self];
|
||||
[menuItem setRepresentedObject:app->second];
|
||||
|
||||
NSImage* image = nil;
|
||||
if([app->second getResourceValue:&image forKey:NSURLEffectiveIconKey error:NULL] || (image = [[NSWorkspace sharedWorkspace] iconForFile:[app->second path]]))
|
||||
{
|
||||
image = [image copy];
|
||||
image.size = NSMakeSize(16, 16);
|
||||
[menuItem setImage:image];
|
||||
}
|
||||
}
|
||||
|
||||
if(appURLs.size() > 1)
|
||||
|
||||
Reference in New Issue
Block a user