Commit c5db7205 authored by David Fuhrmann's avatar David Fuhrmann

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

parent c6abf403
...@@ -26,9 +26,14 @@ ...@@ -26,9 +26,14 @@
#import "playlist.h" #import "playlist.h"
#import "StringUtility.h" #import "StringUtility.h"
#ifdef HAVE_CONFIG_H
# import "config.h"
#endif
#include <assert.h>
#include <vlc_playlist.h> #include <vlc_playlist.h>
#include <vlc_input_item.h> #include <vlc_input_item.h>
#import <vlc_input.h> #include <vlc_input.h>
#include <vlc_url.h> #include <vlc_url.h>
#define TRACKNUM_COLUMN @"tracknumber" #define TRACKNUM_COLUMN @"tracknumber"
...@@ -448,10 +453,6 @@ ...@@ -448,10 +453,6 @@
{ {
NSPasteboard *o_pasteboard = [info draggingPasteboard]; NSPasteboard *o_pasteboard = [info draggingPasteboard];
// this is no valid target, sanitize to top of table
if (index == NSOutlineViewDropOnItemIndex)
index = 0;
if (targetItem == nil) { if (targetItem == nil) {
targetItem = _rootItem; targetItem = _rootItem;
} }
...@@ -498,6 +499,10 @@ ...@@ -498,6 +499,10 @@
pp_items[j++] = p_item; 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) { if (playlist_TreeMoveMany(p_playlist, j, pp_items, p_new_parent, index) != VLC_SUCCESS) {
PL_UNLOCK; PL_UNLOCK;
free(pp_items); free(pp_items);
...@@ -565,6 +570,9 @@ ...@@ -565,6 +570,9 @@
[o_array addObject: o_dic]; [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]; [_playlist addPlaylistItems:o_array withParentItemId:[targetItem plItemId] atPos:index startPlayback:NO];
return YES; return YES;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment