]> git.sesse.net Git - vlc/commitdiff
macosx: avoid unnecessarily early loading of open panel nib
authorDavid Fuhrmann <dfuhrmann@videolan.org>
Thu, 2 Oct 2014 15:42:32 +0000 (17:42 +0200)
committerDavid Fuhrmann <dfuhrmann@videolan.org>
Thu, 2 Oct 2014 15:47:13 +0000 (17:47 +0200)
Loading the open nib can take some significant time, due to audio/
video devices enumeration.

refs #12123

modules/gui/macosx/open.h
modules/gui/macosx/open.m
modules/gui/macosx/playlist.m

index ee7c68a0d27e2971155f482c2f48e545ddd44cef..3b7886a6c326876b696d3b9c12a02aee06e773e5 100644 (file)
 - (IBAction)openSpecialMediaFolder:(id)sender;
 - (IBAction)dvdreadOptionChanged:(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;
 - (IBAction)openNetModeChanged:(id)sender;
index 9e3e5389e7552cfcb6ae1d8a494528e2fc48cbe0..7cbe46357d5f0340ac6ecea6db5fad2fb42aac3c 100644 (file)
@@ -825,7 +825,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
     [[[o_tabview tabViewItemAtIndex: [o_tabview indexOfTabViewItemWithIdentifier:@"optical"]] view] displayIfNeeded];
 }
 
-- (NSString *) getBSDNodeFromMountPath:(NSString *)mountPath
++ (NSString *) getBSDNodeFromMountPath:(NSString *)mountPath
 {
     OSStatus err;
     FSRef ref;
@@ -860,7 +860,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
     return @"";
 }
 
-- (NSString *)getVolumeTypeFromMountPath:(NSString *)mountPath
++ (NSString *)getVolumeTypeFromMountPath:(NSString *)mountPath
 {
     OSStatus err;
     FSRef ref;
@@ -1003,7 +1003,7 @@ out:
 
 - (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];
     NSString *o_device_path;
 
@@ -1020,7 +1020,7 @@ out:
         [o_type isEqualToString: kVLCMediaUnknown])
         o_device_path = o_path;
     else
-        o_device_path = [self getBSDNodeFromMountPath:o_path];
+        o_device_path = [VLCOpen getBSDNodeFromMountPath:o_path];
 
     return [NSDictionary dictionaryWithObjectsAndKeys: o_path, @"path",
                                                 o_device_path, @"devicePath",
index e6d777b6e184cb304794d4d027f42ef910e49e5e..88c97b2b0adc6f10989fb23261a3252371a2873d 100644 (file)
     if ([[NSFileManager defaultManager] fileExistsAtPath:o_path isDirectory:&b_dir] && b_dir &&
         [[NSWorkspace sharedWorkspace] getFileSystemInfoForPath:o_path isRemovable: &b_rem
                                                      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]);
 
         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])
             o_uri = [NSString stringWithFormat: @"dvdnav://%@", o_path];
         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])
-            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])
-            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])
             o_uri = [NSString stringWithFormat: @"bluray://%@", o_path];
         else