Commit b7fbd8c6 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: simplified the way we set the window's title

parent 2d83c3c2
...@@ -657,35 +657,19 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -657,35 +657,19 @@ static VLCMainWindow *_o_sharedInstance = nil;
char *uri = input_item_GetURI( input_GetItem( p_input ) ); char *uri = input_item_GetURI( input_GetItem( p_input ) );
if ([aString isEqualToString:@""]) NSURL * o_url = [NSURL URLWithString: [NSString stringWithUTF8String: uri]];
{ if ([o_url isFileURL])
[self setRepresentedURL: o_url];
char *file = uri ? strrchr( uri, '/' ) : NULL; else
if( file != NULL ) [self setRepresentedURL: [NSURL URLWithString:@""]];
{
decode_URI( ++file );
aString = [NSString stringWithUTF8String:file];
}
else
aString = [NSString stringWithUTF8String:uri];
}
NSMutableString *o_mrl = [NSMutableString stringWithUTF8String: decode_URI(uri)];
free( uri ); free( uri );
NSRange prefix_range = [o_mrl rangeOfString: @"file:"];
if( prefix_range.location != NSNotFound )
[o_mrl deleteCharactersInRange: prefix_range];
if( [o_mrl characterAtIndex:0] == '/' ) if ([aString isEqualToString:@""])
{
/* it's a local file */
[self setRepresentedFilename: o_mrl];
}
else
{ {
/* it's from the network or somewhere else, if ([o_url isFileURL])
* we clear the previous path */ aString = [[NSFileManager defaultManager] displayNameAtPath: [o_url path]];
[self setRepresentedFilename: @""]; else
aString = [o_url absoluteString];
} }
[self setTitle: aString]; [self setTitle: aString];
...@@ -694,7 +678,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -694,7 +678,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
else else
{ {
[self setTitle: _NS("VLC media player")]; [self setTitle: _NS("VLC media player")];
[self setRepresentedFilename: @""]; [self setRepresentedURL: [NSURL URLWithString: @""]];
} }
[o_pool release]; [o_pool release];
} }
......
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