From bb995f204a77deb4daef492f4d873793620fa53d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 16:48:39 +0000 Subject: [PATCH 1/3] fix(deps): update rust crate zbus to v4 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index ac7088dd..66f0f3ad 100644 --- a/Cargo.toml +++ b/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.1", optional = true } serde = { version = "1", optional = true } log = "0.4" env_logger ={ version ="0.10", optional = true } From 983cbffae3e898d28c119024eef1b2d510998559 Mon Sep 17 00:00:00 2001 From: Hendrik Sollich Date: Wed, 3 Apr 2024 16:19:29 +0200 Subject: [PATCH 2/3] refactor: adapt to zbus 4.x api changes --- src/notification.rs | 2 +- src/xdg/zbus_rs.rs | 42 ++++++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/notification.rs b/src/notification.rs index 6bf148d4..78428f55 100644 --- a/src/notification.rs +++ b/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 { diff --git a/src/xdg/zbus_rs.rs b/src/xdg/zbus_rs.rs index ab6985e8..d1b370dd 100644 --- a/src/xdg/zbus_rs.rs +++ b/src/xdg/zbus_rs.rs @@ -155,6 +155,7 @@ async fn send_notification_via_connection_at_bus( ) .await? .body() + .deserialize() .unwrap(); Ok(reply) } @@ -193,7 +194,8 @@ pub async fn get_capabilities_at_bus(bus: NotificationBus) -> Result &(), ) .await? - .body()?; + .body() + .deserialize()?; Ok(info) } @@ -212,7 +214,8 @@ pub async fn get_server_information_at_bus(bus: NotificationBus) -> Result { - 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(_) => {} } + _ => {} } } } From dce3f1d6939d50ce24dc961b9eb9f9bcab9d1e0c Mon Sep 17 00:00:00 2001 From: Hendrik Sollich Date: Thu, 4 Apr 2024 00:43:38 +0200 Subject: [PATCH 3/3] ci: require only building on 2 most recent compilers for zbus 4 on linux --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4a3d24c..82f1d614 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: rust: - stable - beta - - stable minus 6 releases + - stable minus 2 releases feature: - d - d,images