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")] [GtkTemplate (ui = "/eu/callcc/audrey/ui/play_queue_song.ui")]
class Ui.PlayQueueSong : Gtk.ListBoxRow { 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 { public bool current {
set { set {
if (value) { if (value) {
@ -54,7 +58,8 @@ class Ui.PlayQueueSong : Gtk.ListBoxRow {
} }
[GtkCallback] private Gdk.ContentProvider? on_drag_prepare (double x, double y) { [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) { [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 item = object as Gtk.ListItem;
var child = new PlayQueueSong (this.playbin); var child = new PlayQueueSong (this.playbin);
child.draggable = false; // TODO
child.show_artist = true;
child.show_album = true;
item.child = child; item.child = child;
} }

View file

@ -8,7 +8,7 @@ template $UiPlayQueueSong: ListBoxRow {
spacing: 6; spacing: 6;
Image { Image {
//visible: false; visible: bind template.draggable;
icon-name: "list-drag-handle"; icon-name: "list-drag-handle";
styles [ "drag-handle" ] styles [ "drag-handle" ]
} }
@ -54,7 +54,7 @@ template $UiPlayQueueSong: ListBoxRow {
} }
Box artist_box { Box artist_box {
//visible: false; visible: bind template.show_artist;
focusable: false; focusable: false;
hexpand: true; hexpand: true;
@ -78,7 +78,7 @@ template $UiPlayQueueSong: ListBoxRow {
spacing: 6; spacing: 6;
Label { Label {
//visible: false; visible: bind template.show_album;
focusable: false; focusable: false;
xalign: 0; xalign: 0;
halign: start; halign: start;