From eec61c8ed025e1b68924210442f21d72ac478a04 Mon Sep 17 00:00:00 2001 From: Erica Z Date: Sun, 20 Oct 2024 11:57:47 +0200 Subject: [PATCH] configure play queue displayed fields --- src/ui/play_queue.vala | 11 ++++++++++- src/ui/play_queue_song.blp | 6 +++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/ui/play_queue.vala b/src/ui/play_queue.vala index 4b11fdb..18b8a70 100644 --- a/src/ui/play_queue.vala +++ b/src/ui/play_queue.vala @@ -1,5 +1,9 @@ [GtkTemplate (ui = "/eu/callcc/audrey/ui/play_queue_song.ui")] class Ui.PlayQueueSong : Gtk.ListBoxRow { + public bool draggable { get; set; default = false; } + public bool show_artist { get; set; default = false; } + public bool show_album { get; set; default = false; } + public bool current { set { if (value) { @@ -54,7 +58,8 @@ class Ui.PlayQueueSong : Gtk.ListBoxRow { } [GtkCallback] private Gdk.ContentProvider? on_drag_prepare (double x, double y) { - return new Gdk.ContentProvider.for_value (this); + if (this.draggable) return new Gdk.ContentProvider.for_value (this); + else return null; } [GtkCallback] private bool on_drop (Value value, double x, double y) { @@ -95,6 +100,10 @@ public class Ui.PlayQueue : Adw.NavigationPage { var item = object as Gtk.ListItem; var child = new PlayQueueSong (this.playbin); + child.draggable = false; // TODO + child.show_artist = true; + child.show_album = true; + item.child = child; } diff --git a/src/ui/play_queue_song.blp b/src/ui/play_queue_song.blp index b7b32ae..b3969b7 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: bind template.draggable; icon-name: "list-drag-handle"; styles [ "drag-handle" ] } @@ -54,7 +54,7 @@ template $UiPlayQueueSong: ListBoxRow { } Box artist_box { - //visible: false; + visible: bind template.show_artist; focusable: false; hexpand: true; @@ -78,7 +78,7 @@ template $UiPlayQueueSong: ListBoxRow { spacing: 6; Label { - //visible: false; + visible: bind template.show_album; focusable: false; xalign: 0; halign: start;