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 Gtk 4.0;
|
||||||
|
using Adw 1;
|
||||||
|
using Gio 2.0;
|
||||||
|
|
||||||
template $UiPlayQueue: Box {
|
template $UiPlayQueue: Box {
|
||||||
name: "play-queue";
|
name: "play-queue";
|
||||||
|
|
||||||
ScrolledWindow {
|
Stack {
|
||||||
hexpand: true;
|
visible-child-name: bind $visible_child_name (template.playbin as <$Playbin>.play_queue as <Gio.ListStore>.n-items) as <string>;
|
||||||
vscrollbar-policy: always;
|
|
||||||
hscrollbar-policy: never;
|
|
||||||
|
|
||||||
ListView view {
|
StackPage {
|
||||||
show-separators: true;
|
name: "empty";
|
||||||
single-click-activate: true;
|
|
||||||
|
|
||||||
styles [ "rich-list" ]
|
child: Adw.StatusPage {
|
||||||
|
icon-name: "list-remove-all";
|
||||||
activate => $on_row_activated ();
|
title: "No songs queued";
|
||||||
|
|
||||||
model: NoSelection {
|
|
||||||
model: bind template.playbin as <$Playbin>.play_queue;
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
factory: SignalListItemFactory {
|
StackPage {
|
||||||
setup => $on_song_list_setup ();
|
name: "not-empty";
|
||||||
bind => $on_song_list_bind ();
|
|
||||||
unbind => $on_song_list_unbind ();
|
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) {
|
[GtkCallback] private void on_row_activated (uint position) {
|
||||||
playbin.select_track (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