[vlc-commits] macosx: do not allow playlist item deletion for sd modules

David Fuhrmann git at videolan.org
Tue Nov 11 12:25:09 CET 2014


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Tue Nov 11 11:24:45 2014 +0100| [028d21434fc906d94caa4a2b3eb0e1a4a40cdabc] | committer: David Fuhrmann

macosx: do not allow playlist item deletion for sd modules

close #12423

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

 modules/gui/macosx/playlist.m |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m
index 57f7ae9..38643c4 100644
--- a/modules/gui/macosx/playlist.m
+++ b/modules/gui/macosx/playlist.m
@@ -961,8 +961,12 @@
 {
     int i_count;
     NSIndexSet *o_selected_indexes;
-    playlist_t * p_playlist;
     intf_thread_t * p_intf = VLCIntf;
+    playlist_t * p_playlist = pl_Get(p_intf);
+
+    // check if deletion is allowed
+    if ([self currentPlaylistRoot] != p_playlist->p_local_category && [self currentPlaylistRoot] != p_playlist->p_ml_category)
+        return;
 
     o_selected_indexes = [o_outline_view selectedRowIndexes];
     i_count = [o_selected_indexes count];
@@ -970,7 +974,6 @@
     if (retainedRowSelection == NSNotFound)
         retainedRowSelection = 0;
 
-    p_playlist = pl_Get(p_intf);
 
     NSUInteger indexes[i_count];
     if (i_count == [o_outline_view numberOfRows]) {
@@ -1313,8 +1316,11 @@
     b_item_sel = (row != -1 && [o_outline_view selectedRow] != -1);
     b_rows = [o_outline_view numberOfRows] != 0;
 
+    playlist_t *p_playlist = pl_Get(VLCIntf);
+    bool b_del_allowed = [self currentPlaylistRoot] == p_playlist->p_local_category || [self currentPlaylistRoot] == p_playlist->p_ml_category;
+
     [o_mi_play setEnabled: b_item_sel];
-    [o_mi_delete setEnabled: b_item_sel];
+    [o_mi_delete setEnabled: b_item_sel && b_del_allowed];
     [o_mi_selectall setEnabled: b_rows];
     [o_mi_info setEnabled: b_item_sel];
     [o_mi_preparse setEnabled: b_item_sel];



More information about the vlc-commits mailing list