signals signals

This commit is contained in:
Erica Z 2024-11-01 18:01:14 +01:00
parent 83e627d3d2
commit 7279532745

View file

@ -83,6 +83,23 @@ impl Player {
),
);
playbin.connect_notify_local(
Some("state"),
glib::clone!(
#[strong]
player_ref,
move |_playbin: &crate::Playbin, _| {
let player_ref = player_ref.clone();
glib::spawn_future_local(async move {
player_ref.get_mut().await
.playback_status_changed(player_ref.signal_emitter())
.await
.unwrap();
});
}
),
);
playbin.connect_notify_local(
Some("volume"),
glib::clone!(
@ -305,27 +322,27 @@ impl Player {
#[zbus(property)]
fn can_go_next(&self) -> bool {
self.playbin.upgrade().unwrap().state() != crate::playbin::State::Stopped
true
}
#[zbus(property)]
fn can_go_previous(&self) -> bool {
self.playbin.upgrade().unwrap().state() != crate::playbin::State::Stopped
true
}
#[zbus(property)]
fn can_play(&self) -> bool {
self.playbin.upgrade().unwrap().state() != crate::playbin::State::Stopped
true
}
#[zbus(property)]
fn can_pause(&self) -> bool {
self.playbin.upgrade().unwrap().state() != crate::playbin::State::Stopped
true
}
#[zbus(property)]
fn can_seek(&self) -> bool {
self.playbin.upgrade().unwrap().state() != crate::playbin::State::Stopped
true
}
#[zbus(property(emits_changed_signal = "const"))]