diff --git a/src/mpris.rs b/src/mpris.rs index 1f0f289..71b3efb 100644 --- a/src/mpris.rs +++ b/src/mpris.rs @@ -18,14 +18,15 @@ impl Mpris { #[zbus::interface(name = "org.mpris.MediaPlayer2")] impl Mpris { - async fn raise(&self) { - // TODO: don't unwrap - self.window.upgrade().unwrap().present(); + fn raise(&self) { + self.window.upgrade().expect("main window was finalized").present(); } - async fn quit(&self) { - // TODO: don't unwrap - self.window.upgrade().unwrap().close(); + fn quit(&self) { + match self.window.upgrade() { + None => {}, // guess there's nothing to do + Some(window) => window.close(), + } } #[zbus(property)] @@ -40,7 +41,8 @@ impl Mpris { #[zbus(property)] // TODO: report that if the argument is just _ the attribute panics - async fn set_fullscreen(&self, _fullscreen: bool) -> zbus::Result<()> { + // TODO: why can't this return zbus::fdo::Result?? + fn set_fullscreen(&self, _fullscreen: bool) -> zbus::Result<()> { Err(zbus::Error::Unsupported) }