m'pris
This commit is contained in:
parent
162a151595
commit
5cd88a0711
2 changed files with 25 additions and 3 deletions
|
@ -222,6 +222,16 @@ impl Player {
|
|||
*/
|
||||
}
|
||||
|
||||
pub async fn on_playlist_count_changed(
|
||||
&self,
|
||||
emitter: &SignalEmitter<'_>,
|
||||
) -> Result<(), zbus::fdo::Error> {
|
||||
self.can_go_next_changed(emitter).await?;
|
||||
self.can_go_previous_changed(emitter).await?;
|
||||
self.can_play_changed(emitter).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn window(&self) -> Window {
|
||||
self.window.upgrade().unwrap()
|
||||
}
|
||||
|
@ -370,17 +380,17 @@ impl Player {
|
|||
|
||||
#[zbus(property)]
|
||||
fn can_go_next(&self) -> bool {
|
||||
true // TODO
|
||||
self.window().playlist_count() > 0
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
fn can_go_previous(&self) -> bool {
|
||||
true // TODO
|
||||
self.window().playlist_count() > 0
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
fn can_play(&self) -> bool {
|
||||
true // TODO
|
||||
self.window().playlist_count() > 0
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
|
|
|
@ -597,6 +597,18 @@ mod imp {
|
|||
6 => {
|
||||
assert_eq!(event.name, "playlist-count");
|
||||
self.obj().notify("playlist-count");
|
||||
|
||||
// mpris can-go-next depends on this
|
||||
if let Some(iface_ref) = self.mpris_player() {
|
||||
glib::spawn_future_local(async move {
|
||||
iface_ref
|
||||
.get()
|
||||
.await
|
||||
.on_playlist_count_changed(iface_ref.signal_emitter())
|
||||
.await
|
||||
.unwrap();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
7 => {
|
||||
|
|
Loading…
Reference in a new issue