diff options
| author | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-02-28 16:54:50 +0000 |
|---|---|---|
| committer | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-02-28 16:54:50 +0000 |
| commit | 817e7dad3956711128995f0248b63e33601f75e6 (patch) | |
| tree | 6b7d5d01cd3a57226f33f708fac6e1e073d7dd1f /macosx/RecentItemsMenu.m | |
| parent | 097afff51fd80241c35d34c731f19f804e814b1a (diff) | |
| download | pcsxr-817e7dad3956711128995f0248b63e33601f75e6.tar.gz | |
Set the recent item menu text based on the localized name: this will honor the hidden extension key set in Finder.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@83232 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/RecentItemsMenu.m')
| -rwxr-xr-x | macosx/RecentItemsMenu.m | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/macosx/RecentItemsMenu.m b/macosx/RecentItemsMenu.m index 357ebd65..72a3dead 100755 --- a/macosx/RecentItemsMenu.m +++ b/macosx/RecentItemsMenu.m @@ -73,7 +73,13 @@ - (NSMenuItem*)newMenuItem:(NSURL*)documentURL { - NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:[documentURL lastPathComponent] action:@selector(openRecentItem:) keyEquivalent:@""]; + NSString *lastName = nil; + [documentURL getResourceValue:&lastName forKey:NSURLLocalizedNameKey error:NULL]; + if (!lastName) { + lastName = [documentURL lastPathComponent]; + } + + NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:lastName action:@selector(openRecentItem:) keyEquivalent:@""]; [newItem setRepresentedObject:documentURL]; //[newItem setEnabled:YES]; [newItem setTarget:self]; @@ -97,7 +103,7 @@ // Document items are menu items with tag 0 - (void)removeDocumentItems { - NSMutableArray *removeItemsArray = [NSMutableArray array]; + NSMutableArray *removeItemsArray = [[NSMutableArray alloc] initWithCapacity:10]; for (NSMenuItem* item in [self itemArray]) { if([item tag] == 0) { [removeItemsArray addObject:item]; @@ -106,6 +112,7 @@ for (NSMenuItem *item in removeItemsArray) { [self removeItem:item]; } + RELEASEOBJ(removeItemsArray); } @end |
