add "no songs queued" placeholder

This commit is contained in:
Erica Z 2024-10-25 11:05:01 +02:00
parent fdd719f4f8
commit f436557bf5
2 changed files with 40 additions and 17 deletions

View file

@ -1,9 +1,26 @@
using Gtk 4.0;
using Adw 1;
using Gio 2.0;
template $UiPlayQueue: Box {
name: "play-queue";
ScrolledWindow {
Stack {
visible-child-name: bind $visible_child_name (template.playbin as <$Playbin>.play_queue as <Gio.ListStore>.n-items) as <string>;
StackPage {
name: "empty";
child: Adw.StatusPage {
icon-name: "list-remove-all";
title: "No songs queued";
};
}
StackPage {
name: "not-empty";
child: ScrolledWindow {
hexpand: true;
vscrollbar-policy: always;
hscrollbar-policy: never;
@ -26,5 +43,7 @@ template $UiPlayQueue: Box {
unbind => $on_song_list_unbind ();
};
}
};
}
}
}

View file

@ -161,4 +161,8 @@ public class Ui.PlayQueue : Gtk.Box {
[GtkCallback] private void on_row_activated (uint position) {
playbin.select_track (position);
}
[GtkCallback] private string visible_child_name (uint n_items) {
return n_items > 0 ? "not-empty" : "empty";
}
}