signals signals
This commit is contained in:
parent
83e627d3d2
commit
7279532745
1 changed files with 22 additions and 5 deletions
|
@ -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"))]
|
||||
|
|
Loading…
Reference in a new issue