Commit 6ce65b84 authored by Felix Paul Kühne's avatar Felix Paul Kühne Committed by Jean-Baptiste Kempf

macosx: open recent menu: for files, just show their name without the full...

macosx: open recent menu: for files, just show their name without the full path. additionally, show their icon to make it more pretty.
(cherry picked from commit 9f0a8e2c)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 793b00bb
...@@ -538,7 +538,7 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -538,7 +538,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
#pragma mark Recent Items #pragma mark Recent Items
- (IBAction)openRecentItem:(id)item - (IBAction)openRecentItem:(id)item
{ {
[[VLCMain sharedInstance] application: nil openFile: [item title]]; [[VLCMain sharedInstance] application: nil openFile: [[[[NSDocumentController sharedDocumentController] recentDocumentURLs] objectAtIndex: [item tag]] absoluteString]];
} }
- (IBAction)clearRecentItems:(id)sender - (IBAction)clearRecentItems:(id)sender
...@@ -1117,20 +1117,12 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -1117,20 +1117,12 @@ static VLCMainMenu *_o_sharedInstance = nil;
UInt32 i_nb_docs = [o_docs count]; UInt32 i_nb_docs = [o_docs count];
if( i_nb_items > 1 ) if( i_nb_items > 1 )
{
if (OSX_LEOPARD)
{ {
while( --i_nb_items ) while( --i_nb_items )
{ {
[o_menu removeItemAtIndex: 0]; [o_menu removeItemAtIndex: 0];
} }
} }
else
{
// this is more efficient than removing the items one by one
[o_menu removeAllItems];
}
}
if( i_nb_docs > 0 ) if( i_nb_docs > 0 )
{ {
...@@ -1147,7 +1139,7 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -1147,7 +1139,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
o_url = [o_docs objectAtIndex: i_nb_docs]; o_url = [o_docs objectAtIndex: i_nb_docs];
if( [o_url isFileURL] ) if( [o_url isFileURL] )
o_doc = [o_url path]; o_doc = [[NSFileManager defaultManager] displayNameAtPath: [o_url path]];
else else
o_doc = [o_url absoluteString]; o_doc = [o_url absoluteString];
...@@ -1155,6 +1147,12 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -1155,6 +1147,12 @@ static VLCMainMenu *_o_sharedInstance = nil;
action: @selector(openRecentItem:) action: @selector(openRecentItem:)
keyEquivalent: @"" atIndex: 0]; keyEquivalent: @"" atIndex: 0];
[o_menuitem setTarget: self]; [o_menuitem setTarget: self];
[o_menuitem setTag: i_nb_docs];
if ([o_url isFileURL])
{
[o_menuitem setImage: [[NSWorkspace sharedWorkspace] iconForFile: [o_url path]]];
[[o_menuitem image] setSize: NSMakeSize(16,16)];
}
if( i_nb_docs == 0 ) if( i_nb_docs == 0 )
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment