diff --git a/src/ui/play_queue.vala b/src/ui/play_queue.vala index c841706..69d8a28 100644 --- a/src/ui/play_queue.vala +++ b/src/ui/play_queue.vala @@ -10,6 +10,16 @@ class Ui.PlayQueueSong : Gtk.ListBoxRow { [GtkCallback] private string star_button_icon_name (DateTime? starred) { return starred == null ? "non-starred" : "starred"; } + + [GtkCallback] private Gdk.ContentProvider? on_drag_prepare (double x, double y) { + return new Gdk.ContentProvider.for_value (this); + } + + [GtkCallback] private bool on_drop (Value value, double x, double y) { + var source = value as PlayQueueSong; + print ("dropped %u on %u", source.position, this.position); + return false; + } } [GtkTemplate (ui = "/eu/callcc/audrey/ui/play_queue.ui")] diff --git a/src/ui/play_queue_song.blp b/src/ui/play_queue_song.blp index 9a78050..0e3aaf1 100644 --- a/src/ui/play_queue_song.blp +++ b/src/ui/play_queue_song.blp @@ -8,7 +8,7 @@ template $UiPlayQueueSong: ListBoxRow { spacing: 6; Image { - visible: false; + //visible: false; icon-name: "list-drag-handle"; styles [ "drag-handle" ] } @@ -113,6 +113,21 @@ template $UiPlayQueueSong: ListBoxRow { styles [ "flat" ] } } + + DragSource { + actions: move; + propagation-phase: capture; + + prepare => $on_drag_prepare (); + } + + DropTarget { + actions: move; + formats: UiPlayQueueSong; + preload: true; + + drop => $on_drop (); + } } SizeGroup {