Patch-Source: https://github.com/hoodie/notify-rust/pull/202

ncspot uses zbus v4, but notify-rust v3 - avoid bundling two versions
of zbus.
--
From d573a839894f6c73e69232e3d7e8b8aa2037e633 Mon Sep 17 00:00:00 2001
From: Lucas Nogueira <lucas@tauri.studio>
Date: Tue, 20 Feb 2024 09:09:20 -0300
Subject: [PATCH] chore: update to zbus v4

---
 Cargo.toml          |  2 +-
 src/notification.rs |  2 +-
 src/xdg/zbus_rs.rs  | 43 ++++++++++++++++++++++---------------------
 3 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index f6df4f18c..de59b374c 100644
--- a/vendor/notify-rust/Cargo.toml
+++ b/vendor/notify-rust/Cargo.toml
@@ -24,7 +24,7 @@ include = [
 dbus = { version = "0.9", optional = true }
 lazy_static = { version = "1", optional = true }
 image = { version = "0.24", optional = true }
-zbus = { version = "3.10", optional = true }
+zbus = { version = "4", optional = true }
 serde = { version = "1", optional = true }
 log = "0.4"
 env_logger ={ version ="0.10", optional = true }
diff --git a/src/notification.rs b/src/notification.rs
index 20bb2e110..4e1c6e132 100644
--- a/vendor/notify-rust/src/notification.rs
+++ b/vendor/notify-rust/src/notification.rs
@@ -452,7 +452,7 @@ impl Notification {
         windows::show_notification(self)
     }
 
-    /// Wraps show() but prints notification to stdout.
+    /// Wraps `show()` but prints notification to stdout.
     #[cfg(all(unix, not(target_os = "macos")))]
     #[deprecated = "this was never meant to be public API"]
     pub fn show_debug(&mut self) -> Result<xdg::NotificationHandle> {
diff --git a/src/xdg/zbus_rs.rs b/src/xdg/zbus_rs.rs
index ab6985e80..4e244f85e 100644
--- a/vendor/notify-rust/src/xdg/zbus_rs.rs
+++ b/vendor/notify-rust/src/xdg/zbus_rs.rs
@@ -155,7 +155,7 @@ async fn send_notification_via_connection_at_bus(
         )
         .await?
         .body()
-        .unwrap();
+        .deserialize()?;
     Ok(reply)
 }
 
@@ -193,7 +193,8 @@ pub async fn get_capabilities_at_bus(bus: NotificationBus) -> Result<Vec<String>
             &(),
         )
         .await?
-        .body()?;
+        .body()
+        .deserialize()?;
     Ok(info)
 }
 
@@ -212,7 +213,8 @@ pub async fn get_server_information_at_bus(bus: NotificationBus) -> Result<xdg::
             &(),
         )
         .await?
-        .body()?;
+        .body()
+        .deserialize()?;
 
     Ok(info)
 }
@@ -255,29 +257,28 @@ async fn wait_for_action_signal(
     proxy.add_match_rule(close_signal_rule).await.unwrap();
 
     while let Ok(Some(msg)) = zbus::MessageStream::from(connection).try_next().await {
-        if let Ok(header) = msg.header() {
-            if let Ok(zbus::MessageType::Signal) = header.message_type() {
-                match header.member() {
-                    Ok(Some(name)) if name == "ActionInvoked" => {
-                        match msg.body::<(u32, String)>() {
-                            Ok((nid, action)) if nid == id => {
-                                handler.call(&ActionResponse::Custom(&action));
-                                break;
-                            }
-                            _ => {}
+        let header = msg.header();
+        if let zbus::MessageType::Signal = header.message_type() {
+            match header.member() {
+                Some(name) if name == "ActionInvoked" => {
+                    match msg.body().deserialize::<(u32, String)>() {
+                        Ok((nid, action)) if nid == id => {
+                            handler.call(&ActionResponse::Custom(&action));
+                            break;
                         }
+                        _ => {}
                     }
-                    Ok(Some(name)) if name == "NotificationClosed" => {
-                        match msg.body::<(u32, u32)>() {
-                            Ok((nid, reason)) if nid == id => {
-                                handler.call(&ActionResponse::Closed(reason.into()));
-                                break;
-                            }
-                            _ => {}
+                }
+                Some(name) if name == "NotificationClosed" => {
+                    match msg.body().deserialize::<(u32, u32)>() {
+                        Ok((nid, reason)) if nid == id => {
+                            handler.call(&ActionResponse::Closed(reason.into()));
+                            break;
                         }
+                        _ => {}
                     }
-                    Ok(_) | Err(_) => {}
                 }
+                _ => {}
             }
         }
     }
