"fix" play button

This commit is contained in:
Erica Z 2024-10-28 10:22:42 +01:00
parent a5091d42e0
commit e925dc33cc
2 changed files with 3 additions and 2 deletions

View file

@ -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 <string>;
valign: center;
sensitive: bind $can_press_play (template.playbin as <$Playbin>.state as <$PlaybinState>, template.playbin as <$Playbin>.play_queue_position) as <bool>;
sensitive: bind $can_press_play (template.playbin as <$Playbin>.state as <$PlaybinState>, template.playbin as <$Playbin>.play_queue as <Gio.ListStore>.n-items) as <bool>;
clicked => $on_play_pause_clicked ();
}

View file

@ -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) {