[vlc-commits] macosx/library: show minimal menu if appropriate

Felix Paul Kühne git at videolan.org
Sun Jan 26 14:59:59 CET 2020


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Sun Jan 26 13:43:30 2020 +0100| [322b55eab90a46bcfa6310816c1654156a23c3b4] | committer: Felix Paul Kühne

macosx/library: show minimal menu if appropriate

When the user right-clicks on a non-media-item in the library representation, don't offer options to manipulate the item as there is none.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=322b55eab90a46bcfa6310816c1654156a23c3b4
---

 modules/gui/macosx/library/VLCLibraryMenuController.m | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/modules/gui/macosx/library/VLCLibraryMenuController.m b/modules/gui/macosx/library/VLCLibraryMenuController.m
index 9d45e5a2ef..53a365ae1c 100644
--- a/modules/gui/macosx/library/VLCLibraryMenuController.m
+++ b/modules/gui/macosx/library/VLCLibraryMenuController.m
@@ -68,7 +68,15 @@
 
 - (void)popupMenuWithEvent:(NSEvent *)theEvent forView:(NSView *)theView
 {
-    [NSMenu popUpContextMenu:_libraryMenu withEvent:theEvent forView:theView];
+    if (self.representedMediaItem != nil) {
+        [NSMenu popUpContextMenu:_libraryMenu withEvent:theEvent forView:theView];
+    } else {
+        NSMenu *minimalMenu = [[NSMenu alloc] initWithTitle:@""];
+        NSMenuItem *addItem = [[NSMenuItem alloc] initWithTitle:_NS("Add Media Folder...") action:@selector(addMedia:) keyEquivalent:@""];
+        addItem.target = self;
+        minimalMenu.itemArray = @[addItem];
+        [NSMenu popUpContextMenu:minimalMenu withEvent:theEvent forView:theView];
+    }
 }
 
 #pragma mark - actions



More information about the vlc-commits mailing list