diff --git a/resources/play_queue.blp b/resources/play_queue.blp index 3dea3d8..18eafcf 100644 --- a/resources/play_queue.blp +++ b/resources/play_queue.blp @@ -2,39 +2,71 @@ using Gtk 4.0; using Adw 1; template $AudreyUiPlayQueue: Adw.Bin { - name: "play-queue"; + child: Box { + name: "play-queue-page"; + homogeneous: true; - child: Stack { - visible-child-name: bind $visible_child_name(template.model as <$GListStore>.n-items) as ; + Adw.Clamp { + halign: center; + margin-top: 24; + margin-bottom: 24; + margin-start: 24; + margin-end: 24; - StackPage { - name: "empty"; + Picture { + valign: center; - child: Adw.StatusPage { - icon-name: "list-remove-all"; - title: "No songs queued"; - }; + styles [ + "frame" + ] + + halign: center; + paintable: bind template.playing-cover-art; + } } - StackPage { - name: "not-empty"; + Adw.Bin { + name: "play-queue"; + hexpand: true; + halign: fill; + margin-top: 48; + margin-bottom: 48; + margin-start: 24; + margin-end: 24; - child: ScrolledWindow { - hexpand: true; - hscrollbar-policy: never; + child: Stack { + visible-child-name: bind $visible_child_name(template.model as <$GListStore>.n-items) as ; - ListView view { - single-click-activate: true; - activate => $on_row_activated() swapped; + StackPage { + name: "empty"; - model: NoSelection { - model: bind template.model; + child: Adw.StatusPage { + icon-name: "list-remove-all"; + title: "No songs queued"; }; + } - factory: SignalListItemFactory { - setup => $on_song_list_setup() swapped; - bind => $on_song_list_bind() swapped; - unbind => $on_song_list_unbind() swapped; + StackPage { + name: "not-empty"; + + child: ScrolledWindow { + hexpand: true; + hscrollbar-policy: never; + + ListView view { + single-click-activate: true; + activate => $on_row_activated() swapped; + + model: NoSelection { + model: bind template.model; + }; + + factory: SignalListItemFactory { + setup => $on_song_list_setup() swapped; + bind => $on_song_list_bind() swapped; + unbind => $on_song_list_unbind() swapped; + }; + } }; } }; diff --git a/resources/play_queue_song.blp b/resources/play_queue_song.blp index 8457b8a..aaf2a43 100644 --- a/resources/play_queue_song.blp +++ b/resources/play_queue_song.blp @@ -6,7 +6,6 @@ template $AudreyUiPlayQueueSong: Box { Box { margin-start: 6; - width-request: 36; focusable: false; homogeneous: true; diff --git a/resources/playbar.blp b/resources/playbar.blp index 807c5bc..4e0bc78 100644 --- a/resources/playbar.blp +++ b/resources/playbar.blp @@ -8,6 +8,7 @@ template $AudreyUiPlaybar: Adw.Bin { styles [ "osd" ] + visible: bind template.show-pulse-bar; valign: start; } diff --git a/resources/window.blp b/resources/window.blp index 3c8e9bd..ed12b97 100644 --- a/resources/window.blp +++ b/resources/window.blp @@ -7,7 +7,6 @@ template $AudreyUiWindow: Adw.ApplicationWindow { default-height: 600; Adw.ToolbarView { - [top] Adw.HeaderBar { [start] @@ -84,7 +83,10 @@ template $AudreyUiWindow: Adw.ApplicationWindow { vexpand: true; GridView { - styles [ "albums" ] + styles [ + "albums" + ] + single-click-activate: true; model: NoSelection { @@ -140,41 +142,11 @@ template $AudreyUiWindow: Adw.ApplicationWindow { title: _("Play queue"); name: "play-queue"; - child: Box { - name: "play-queue-page"; - homogeneous: true; - - Adw.Clamp { - halign: center; - margin-top: 24; - margin-bottom: 24; - margin-start: 24; - margin-end: 24; - - Picture { - valign: center; - - styles [ - "frame" - ] - - halign: center; - paintable: bind template.playing_cover_art; - } - } - - $AudreyUiPlayQueue play_queue { - hexpand: true; - halign: fill; - margin-top: 48; - margin-bottom: 48; - margin-start: 24; - margin-end: 24; - - model: bind template.playlist_model; - playlist-pos: bind template.playlist-pos; - // playbin: bind template.playbin; - } + child: $AudreyUiPlayQueue play_queue { + model: bind template.playlist_model; + playlist-pos: bind template.playlist-pos; + // playbin: bind template.playbin; + playing-cover-art: bind template.playing-cover-art; }; } }; diff --git a/src/ui/play_queue.rs b/src/ui/play_queue.rs index 3bc8ca3..bcff8e2 100644 --- a/src/ui/play_queue.rs +++ b/src/ui/play_queue.rs @@ -2,9 +2,9 @@ pub mod song; pub use song::Song; mod imp { - use adw::{gio, glib, prelude::*, subclass::prelude::*}; + use adw::{gdk, gio, glib, prelude::*, subclass::prelude::*}; use glib::{subclass::InitializingObject, WeakRef}; - use std::cell::Cell; + use std::cell::{Cell, RefCell}; use tracing::{event, Level}; #[derive(gtk::CompositeTemplate, glib::Properties, Default)] @@ -15,6 +15,8 @@ mod imp { pub(super) model: WeakRef, #[property(get, set)] _playlist_pos: Cell, + #[property(get, set)] + playing_cover_art: RefCell>, } #[glib::object_subclass]