Commit 640b974d authored by David's avatar David
Browse files

macosx: avoid unnecessarily early loading of open panel nib

Loading the open nib can take some significant time, due to audio/
video devices enumeration.

refs #12123
parent 91d08e51
...@@ -273,8 +273,10 @@ ...@@ -273,8 +273,10 @@
- (IBAction)openSpecialMediaFolder:(id)sender; - (IBAction)openSpecialMediaFolder:(id)sender;
- (IBAction)dvdreadOptionChanged:(id)sender; - (IBAction)dvdreadOptionChanged:(id)sender;
- (IBAction)vcdOptionChanged:(id)sender; - (IBAction)vcdOptionChanged:(id)sender;
- (NSString *)getVolumeTypeFromMountPath:(NSString *)mountPath;
- (NSString *)getBSDNodeFromMountPath:(NSString *)mountPath; // static helper functions
+ (NSString *)getVolumeTypeFromMountPath:(NSString *)mountPath;
+ (NSString *)getBSDNodeFromMountPath:(NSString *)mountPath;
- (void)openNet; - (void)openNet;
- (IBAction)openNetModeChanged:(id)sender; - (IBAction)openNetModeChanged:(id)sender;
......
...@@ -825,7 +825,7 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -825,7 +825,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
[[[o_tabview tabViewItemAtIndex: [o_tabview indexOfTabViewItemWithIdentifier:@"optical"]] view] displayIfNeeded]; [[[o_tabview tabViewItemAtIndex: [o_tabview indexOfTabViewItemWithIdentifier:@"optical"]] view] displayIfNeeded];
} }
- (NSString *) getBSDNodeFromMountPath:(NSString *)mountPath + (NSString *) getBSDNodeFromMountPath:(NSString *)mountPath
{ {
OSStatus err; OSStatus err;
FSRef ref; FSRef ref;
...@@ -860,7 +860,7 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -860,7 +860,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
return @""; return @"";
} }
- (NSString *)getVolumeTypeFromMountPath:(NSString *)mountPath + (NSString *)getVolumeTypeFromMountPath:(NSString *)mountPath
{ {
OSStatus err; OSStatus err;
FSRef ref; FSRef ref;
...@@ -1003,7 +1003,7 @@ out: ...@@ -1003,7 +1003,7 @@ out:
- (NSDictionary *)scanPath:(NSString *)o_path - (NSDictionary *)scanPath:(NSString *)o_path
{ {
NSString *o_type = [self getVolumeTypeFromMountPath:o_path]; NSString *o_type = [VLCOpen getVolumeTypeFromMountPath:o_path];
NSImage *o_image = [[NSWorkspace sharedWorkspace] iconForFile: o_path]; NSImage *o_image = [[NSWorkspace sharedWorkspace] iconForFile: o_path];
NSString *o_device_path; NSString *o_device_path;
...@@ -1020,7 +1020,7 @@ out: ...@@ -1020,7 +1020,7 @@ out:
[o_type isEqualToString: kVLCMediaUnknown]) [o_type isEqualToString: kVLCMediaUnknown])
o_device_path = o_path; o_device_path = o_path;
else else
o_device_path = [self getBSDNodeFromMountPath:o_path]; o_device_path = [VLCOpen getBSDNodeFromMountPath:o_path];
return [NSDictionary dictionaryWithObjectsAndKeys: o_path, @"path", return [NSDictionary dictionaryWithObjectsAndKeys: o_path, @"path",
o_device_path, @"devicePath", o_device_path, @"devicePath",
......
...@@ -1066,21 +1066,20 @@ ...@@ -1066,21 +1066,20 @@
if ([[NSFileManager defaultManager] fileExistsAtPath:o_path isDirectory:&b_dir] && b_dir && if ([[NSFileManager defaultManager] fileExistsAtPath:o_path isDirectory:&b_dir] && b_dir &&
[[NSWorkspace sharedWorkspace] getFileSystemInfoForPath:o_path isRemovable: &b_rem [[NSWorkspace sharedWorkspace] getFileSystemInfoForPath:o_path isRemovable: &b_rem
isWritable:&b_writable isUnmountable:NULL description:NULL type:NULL] && b_rem && !b_writable && [o_nsurl isFileURL]) { isWritable:&b_writable isUnmountable:NULL description:NULL type:NULL] && b_rem && !b_writable && [o_nsurl isFileURL]) {
id o_vlc_open = [[VLCMain sharedInstance] open];
NSString *diskType = [o_vlc_open getVolumeTypeFromMountPath: o_path]; NSString *diskType = [VLCOpen getVolumeTypeFromMountPath: o_path];
msg_Dbg(p_intf, "detected optical media of type %s in the file input", [diskType UTF8String]); msg_Dbg(p_intf, "detected optical media of type %s in the file input", [diskType UTF8String]);
if ([diskType isEqualToString: kVLCMediaDVD]) if ([diskType isEqualToString: kVLCMediaDVD])
o_uri = [NSString stringWithFormat: @"dvdnav://%@", [o_vlc_open getBSDNodeFromMountPath: o_path]]; o_uri = [NSString stringWithFormat: @"dvdnav://%@", [VLCOpen getBSDNodeFromMountPath: o_path]];
else if ([diskType isEqualToString: kVLCMediaVideoTSFolder]) else if ([diskType isEqualToString: kVLCMediaVideoTSFolder])
o_uri = [NSString stringWithFormat: @"dvdnav://%@", o_path]; o_uri = [NSString stringWithFormat: @"dvdnav://%@", o_path];
else if ([diskType isEqualToString: kVLCMediaAudioCD]) else if ([diskType isEqualToString: kVLCMediaAudioCD])
o_uri = [NSString stringWithFormat: @"cdda://%@", [o_vlc_open getBSDNodeFromMountPath: o_path]]; o_uri = [NSString stringWithFormat: @"cdda://%@", [VLCOpen getBSDNodeFromMountPath: o_path]];
else if ([diskType isEqualToString: kVLCMediaVCD]) else if ([diskType isEqualToString: kVLCMediaVCD])
o_uri = [NSString stringWithFormat: @"vcd://%@#0:0", [o_vlc_open getBSDNodeFromMountPath: o_path]]; o_uri = [NSString stringWithFormat: @"vcd://%@#0:0", [VLCOpen getBSDNodeFromMountPath: o_path]];
else if ([diskType isEqualToString: kVLCMediaSVCD]) else if ([diskType isEqualToString: kVLCMediaSVCD])
o_uri = [NSString stringWithFormat: @"vcd://%@@0:0", [o_vlc_open getBSDNodeFromMountPath: o_path]]; o_uri = [NSString stringWithFormat: @"vcd://%@@0:0", [VLCOpen getBSDNodeFromMountPath: o_path]];
else if ([diskType isEqualToString: kVLCMediaBD] || [diskType isEqualToString: kVLCMediaBDMVFolder]) else if ([diskType isEqualToString: kVLCMediaBD] || [diskType isEqualToString: kVLCMediaBDMVFolder])
o_uri = [NSString stringWithFormat: @"bluray://%@", o_path]; o_uri = [NSString stringWithFormat: @"bluray://%@", o_path];
else else
......
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