From e925dc33ccfd0d693840f5930afc1255b34b2ecd Mon Sep 17 00:00:00 2001 From: Erica Z Date: Mon, 28 Oct 2024 10:22:42 +0100 Subject: [PATCH] "fix" play button --- src/ui/playbar.blp | 3 ++- src/ui/playbar.vala | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ui/playbar.blp b/src/ui/playbar.blp index 6ced696..1ee9160 100644 --- a/src/ui/playbar.blp +++ b/src/ui/playbar.blp @@ -1,5 +1,6 @@ using Gtk 4.0; using Adw 1; +using Gio 2.0; template $UiPlaybar: Adw.Bin { child: CenterBox { @@ -119,7 +120,7 @@ template $UiPlaybar: Adw.Bin { Button { icon-name: bind $play_pause_icon_name (template.playbin as <$Playbin>.state as <$PlaybinState>) as ; valign: center; - sensitive: bind $can_press_play (template.playbin as <$Playbin>.state as <$PlaybinState>, template.playbin as <$Playbin>.play_queue_position) as ; + sensitive: bind $can_press_play (template.playbin as <$Playbin>.state as <$PlaybinState>, template.playbin as <$Playbin>.play_queue as .n-items) as ; clicked => $on_play_pause_clicked (); } diff --git a/src/ui/playbar.vala b/src/ui/playbar.vala index a92bb7b..b98514e 100644 --- a/src/ui/playbar.vala +++ b/src/ui/playbar.vala @@ -42,7 +42,7 @@ class Ui.Playbar : Adw.Bin { } [GtkCallback] private bool can_press_play (PlaybinState state, uint n_items) { - return state != PlaybinState.STOPPED || n_items > 0; + return !(state == PlaybinState.STOPPED && n_items == 0); } [GtkCallback] private string mute_button_icon_name (bool mute) {