From 56d4057d87113370df32e852974adfbae9a16275 Mon Sep 17 00:00:00 2001 From: Erica Z Date: Fri, 1 Nov 2024 13:02:27 +0100 Subject: [PATCH] some fixes --- src/mpris.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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) }