configure play queue displayed fields

This commit is contained in:
Erica Z 2024-10-20 11:57:47 +02:00
parent c8e4e55410
commit eec61c8ed0
2 changed files with 13 additions and 4 deletions

View file

@ -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;
}

View file

@ -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;