add "no songs queued" placeholder
This commit is contained in:
parent
fdd719f4f8
commit
f436557bf5
2 changed files with 40 additions and 17 deletions
|
@ -1,29 +1,48 @@
|
|||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
using Gio 2.0;
|
||||
|
||||
template $UiPlayQueue: Box {
|
||||
name: "play-queue";
|
||||
|
||||
ScrolledWindow {
|
||||
hexpand: true;
|
||||
vscrollbar-policy: always;
|
||||
hscrollbar-policy: never;
|
||||
Stack {
|
||||
visible-child-name: bind $visible_child_name (template.playbin as <$Playbin>.play_queue as <Gio.ListStore>.n-items) as <string>;
|
||||
|
||||
ListView view {
|
||||
show-separators: true;
|
||||
single-click-activate: true;
|
||||
StackPage {
|
||||
name: "empty";
|
||||
|
||||
styles [ "rich-list" ]
|
||||
|
||||
activate => $on_row_activated ();
|
||||
|
||||
model: NoSelection {
|
||||
model: bind template.playbin as <$Playbin>.play_queue;
|
||||
child: Adw.StatusPage {
|
||||
icon-name: "list-remove-all";
|
||||
title: "No songs queued";
|
||||
};
|
||||
}
|
||||
|
||||
factory: SignalListItemFactory {
|
||||
setup => $on_song_list_setup ();
|
||||
bind => $on_song_list_bind ();
|
||||
unbind => $on_song_list_unbind ();
|
||||
StackPage {
|
||||
name: "not-empty";
|
||||
|
||||
child: ScrolledWindow {
|
||||
hexpand: true;
|
||||
vscrollbar-policy: always;
|
||||
hscrollbar-policy: never;
|
||||
|
||||
ListView view {
|
||||
show-separators: true;
|
||||
single-click-activate: true;
|
||||
|
||||
styles [ "rich-list" ]
|
||||
|
||||
activate => $on_row_activated ();
|
||||
|
||||
model: NoSelection {
|
||||
model: bind template.playbin as <$Playbin>.play_queue;
|
||||
};
|
||||
|
||||
factory: SignalListItemFactory {
|
||||
setup => $on_song_list_setup ();
|
||||
bind => $on_song_list_bind ();
|
||||
unbind => $on_song_list_unbind ();
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue