[vlc-commits] macosx/library menu: implement menu item to add more folders to monitor
Felix Paul Kühne
git at videolan.org
Sun Jun 2 12:36:26 CEST 2019
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Sun Jun 2 11:30:08 2019 +0200| [1e2dfd6af9faa3d812645a1ac9703ee46ec406b4] | committer: Felix Paul Kühne
macosx/library menu: implement menu item to add more folders to monitor
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1e2dfd6af9faa3d812645a1ac9703ee46ec406b4
---
modules/gui/macosx/library/VLCLibraryMenuController.m | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/modules/gui/macosx/library/VLCLibraryMenuController.m b/modules/gui/macosx/library/VLCLibraryMenuController.m
index 355e3a8181..69284fb5e5 100644
--- a/modules/gui/macosx/library/VLCLibraryMenuController.m
+++ b/modules/gui/macosx/library/VLCLibraryMenuController.m
@@ -51,7 +51,7 @@
playItem.target = self;
NSMenuItem *appendItem = [[NSMenuItem alloc] initWithTitle:_NS("Append to Playlist") action:@selector(appendToPlaylist:) keyEquivalent:@""];
appendItem.target = self;
- NSMenuItem *addItem = [[NSMenuItem alloc] initWithTitle:_NS("Add Media...") action:@selector(addMedia:) keyEquivalent:@""];
+ NSMenuItem *addItem = [[NSMenuItem alloc] initWithTitle:_NS("Add Media Folder...") action:@selector(addMedia:) keyEquivalent:@""];
addItem.target = self;
NSMenuItem *revealItem = [[NSMenuItem alloc] initWithTitle:_NS("Reveal in Finder") action:@selector(revealInFinder:) keyEquivalent:@""];
revealItem.target = self;
@@ -79,7 +79,22 @@
- (void)addMedia:(id)sender
{
-
+ NSOpenPanel *openPanel = [NSOpenPanel openPanel];
+ [openPanel setCanChooseFiles: NO];
+ [openPanel setCanChooseDirectories: YES];
+ [openPanel setAllowsMultipleSelection: YES];
+
+ NSModalResponse modalResponse = [openPanel runModal];
+
+ if (modalResponse == NSModalResponseOK) {
+ NSArray *URLs = [openPanel URLs];
+ NSUInteger count = [URLs count];
+ VLCLibraryController *libraryController = [[VLCMain sharedInstance] libraryController];
+ for (NSUInteger i = 0; i < count ; i++) {
+ NSURL *url = URLs[i];
+ [libraryController addFolderWithFileURL:url];
+ }
+ }
}
- (void)revealInFinder:(id)sender
More information about the vlc-commits
mailing list