summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-04-18 12:02:53 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-04-18 12:02:53 +0200
commit78bf582fb29151a916d2c93e9f056d9464d1f997 (patch)
tree3f496d985eb4108dc4e3f8a12b3e3ee0557eb8f9 /plugins
parent9d08630aea8485c5e22efc0745a5cbca1f5bf9e4 (diff)
dragndrop move/copy action selection
Diffstat (limited to 'plugins')
-rw-r--r--plugins/gtkui/ddblistview.c3
-rw-r--r--plugins/gtkui/ddblistview.h2
-rw-r--r--plugins/gtkui/ddbtabstrip.c6
-rw-r--r--plugins/gtkui/mainplaylist.c9
-rw-r--r--plugins/gtkui/trkproperties.c2
5 files changed, 10 insertions, 12 deletions
diff --git a/plugins/gtkui/ddblistview.c b/plugins/gtkui/ddblistview.c
index 57269e8a..035a75a8 100644
--- a/plugins/gtkui/ddblistview.c
+++ b/plugins/gtkui/ddblistview.c
@@ -932,7 +932,7 @@ ddb_listview_list_drag_data_received (GtkWidget *widget,
UNREF (drop_before);
drop_before = next;
}
- ps->binding->drag_n_drop (drop_before, plt, d, length);
+ ps->binding->drag_n_drop (drop_before, plt, d, length, drag_context->action == GDK_ACTION_COPY ? 1 : 0);
if (drop_before) {
UNREF (drop_before);
}
@@ -1965,7 +1965,6 @@ ddb_listview_list_drag_end (GtkWidget *widget,
GdkDragContext *drag_context,
gpointer user_data)
{
- printf ("ddb_listview_list_drag_end\n");
DdbListview *ps = DDB_LISTVIEW (gtk_object_get_data (GTK_OBJECT (widget), "owner"));
ddb_listview_refresh (ps, DDB_REFRESH_LIST|DDB_EXPOSE_LIST);
ps->scroll_direction = 0;
diff --git a/plugins/gtkui/ddblistview.h b/plugins/gtkui/ddblistview.h
index e75ca059..0060669d 100644
--- a/plugins/gtkui/ddblistview.h
+++ b/plugins/gtkui/ddblistview.h
@@ -68,7 +68,7 @@ typedef struct {
int (*get_group) (DdbListviewIter it, char *str, int size);
// drag-n-drop
- void (*drag_n_drop) (DdbListviewIter before, int playlist, uint32_t *indices, int length);
+ void (*drag_n_drop) (DdbListviewIter before, int playlist, uint32_t *indices, int length, int copy);
void (*external_drag_n_drop) (DdbListviewIter before, char *mem, int length);
// callbacks
diff --git a/plugins/gtkui/ddbtabstrip.c b/plugins/gtkui/ddbtabstrip.c
index aeb5868b..cece5b22 100644
--- a/plugins/gtkui/ddbtabstrip.c
+++ b/plugins/gtkui/ddbtabstrip.c
@@ -249,11 +249,7 @@ on_tabstrip_drag_data_received (GtkWidget *widget,
int plt = *d;
d++;
int length = (data->length/4)-1;
- if (plt == deadbeef->plt_get_curr ()) {
- gtk_drag_finish (drag_context, TRUE, FALSE, time);
- return;
- }
- ps->binding->drag_n_drop (NULL, plt, d, length);
+ ps->binding->drag_n_drop (NULL, plt, d, length, drag_context->action == GDK_ACTION_COPY ? 1 : 0);
}
gtk_drag_finish (drag_context, TRUE, FALSE, time);
}
diff --git a/plugins/gtkui/mainplaylist.c b/plugins/gtkui/mainplaylist.c
index 4e8ddd93..f360fecf 100644
--- a/plugins/gtkui/mainplaylist.c
+++ b/plugins/gtkui/mainplaylist.c
@@ -98,14 +98,15 @@ int main_get_idx (DdbListviewIter it) {
return idx;
}
-void main_drag_n_drop (DdbListviewIter before, int playlist, uint32_t *indices, int length) {
+void
+main_drag_n_drop (DdbListviewIter before, int from_playlist, uint32_t *indices, int length, int copy) {
deadbeef->plt_lock ();
int curr = deadbeef->plt_get_curr ();
- if (playlist == curr) {
- deadbeef->pl_move_items (PL_MAIN, (DB_playItem_t *)before, indices, length);
+ if (copy) {
+ deadbeef->pl_copy_items (PL_MAIN, from_playlist, (DB_playItem_t *)before, indices, length);
}
else {
- deadbeef->pl_copy_items (PL_MAIN, playlist, (DB_playItem_t *)before, indices, length);
+ deadbeef->pl_move_items (PL_MAIN, from_playlist, (DB_playItem_t *)before, indices, length);
}
deadbeef->plt_unlock ();
}
diff --git a/plugins/gtkui/trkproperties.c b/plugins/gtkui/trkproperties.c
index a4a9462e..f4ce782f 100644
--- a/plugins/gtkui/trkproperties.c
+++ b/plugins/gtkui/trkproperties.c
@@ -25,6 +25,8 @@
#include "support.h"
#include "../../deadbeef.h"
#include "gtkui.h"
+#include "mainplaylist.h"
+#include "search.h"
static GtkWidget *trackproperties;
static DB_playItem_t *track;