[vlc-commits] macosx: add new pl items to the end if they are dropped to a node

David Fuhrmann git at videolan.org
Tue Dec 30 16:12:00 CET 2014


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sun Dec  7 13:29:12 2014 +0100| [c5db7205bea8daa1113882414d700f276e80661e] | committer: David Fuhrmann

macosx: add new pl items to the end if they are dropped to a node

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

 modules/gui/macosx/PLModel.m |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/modules/gui/macosx/PLModel.m b/modules/gui/macosx/PLModel.m
index 6fae2cc..41055ee 100644
--- a/modules/gui/macosx/PLModel.m
+++ b/modules/gui/macosx/PLModel.m
@@ -26,9 +26,14 @@
 #import "playlist.h"
 #import "StringUtility.h"
 
+#ifdef HAVE_CONFIG_H
+# import "config.h"
+#endif
+#include <assert.h>
+
 #include <vlc_playlist.h>
 #include <vlc_input_item.h>
-#import <vlc_input.h>
+#include <vlc_input.h>
 #include <vlc_url.h>
 
 #define TRACKNUM_COLUMN @"tracknumber"
@@ -448,10 +453,6 @@
 {
     NSPasteboard *o_pasteboard = [info draggingPasteboard];
 
-    // this is no valid target, sanitize to top of table
-    if (index == NSOutlineViewDropOnItemIndex)
-        index = 0;
-
     if (targetItem == nil) {
         targetItem = _rootItem;
     }
@@ -498,6 +499,10 @@
                 pp_items[j++] = p_item;
         }
 
+        // drop on a node itself will append entries at the end
+        if (index == NSOutlineViewDropOnItemIndex)
+            index = p_new_parent->i_children;
+
         if (playlist_TreeMoveMany(p_playlist, j, pp_items, p_new_parent, index) != VLC_SUCCESS) {
             PL_UNLOCK;
             free(pp_items);
@@ -565,6 +570,9 @@
             [o_array addObject: o_dic];
         }
 
+        // drop on a node itself will append entries at the end
+        static_assert(NSOutlineViewDropOnItemIndex == -1, "Expect NSOutlineViewDropOnItemIndex to be -1");
+
         [_playlist addPlaylistItems:o_array withParentItemId:[targetItem plItemId] atPos:index startPlayback:NO];
         return YES;
     }



More information about the vlc-commits mailing list