From 15622b903e301c4042bac6306c9aaf39ccbff0c4 Mon Sep 17 00:00:00 2001 From: Hendrik Sollich Date: Sat, 3 Dec 2022 15:16:36 +0100 Subject: [PATCH 1/3] build: specify to use at least zbus 3.5 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index e1b6cf7b3..96d7847d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ lazy_static = { version = "1", optional = true } image = { version = "0.24", optional = true } zvariant = { version = "3", optional = true } zvariant_derive = { version = "3", optional = true } -zbus = { version = "3", optional = true } +zbus = { version = "3.5", optional = true } serde = { version = "1", optional = true } [target.'cfg(target_os="macos")'.dependencies] From a84b26bee55218a112d1707fabe8d8a9014d108e Mon Sep 17 00:00:00 2001 From: Hendrik Sollich Date: Sat, 3 Dec 2022 15:17:03 +0100 Subject: [PATCH 2/3] build: remove redundant extra zbus deps these are reexported by zbus now --- Cargo.toml | 4 +--- src/hints.rs | 5 ++++- src/xdg/mod.rs | 4 +++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 96d7847d9..97db0c86b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,8 +24,6 @@ include = [ dbus = { version = "0.9", optional = true } lazy_static = { version = "1", optional = true } image = { version = "0.24", optional = true } -zvariant = { version = "3", optional = true } -zvariant_derive = { version = "3", optional = true } zbus = { version = "3.5", optional = true } serde = { version = "1", optional = true } @@ -40,7 +38,7 @@ winrt-notification = { package = "tauri-winrt-notification", version = "0.1" } default = ["z"] server = [] d = ["dbus"] -z = ["zbus", "zvariant", "zvariant_derive", "serde"] +z = ["zbus", "serde"] debug_namespace = [] images = ["image", "lazy_static"] diff --git a/src/hints.rs b/src/hints.rs index cfc2037d9..6a0c9b84f 100644 --- a/src/hints.rs +++ b/src/hints.rs @@ -1,6 +1,7 @@ #![cfg_attr(rustfmt, rustfmt_skip)] -mod constants; +#[cfg(all(feature = "zbus", unix, not(target_os = "macos")))] +use zbus::zvariant; #[cfg(all(unix, not(target_os = "macos")))] pub(crate) mod message; @@ -15,6 +16,7 @@ use crate::Urgency; #[cfg(all(feature = "zbus", unix, not(target_os = "macos")))] use crate::notification::Notification; #[cfg(all(feature = "zbus", unix, not(target_os = "macos")))] use std::collections::HashMap; +mod constants; #[cfg(all(unix, not(target_os = "macos")))] #[derive(Eq, PartialEq, Hash, Clone, Debug)] @@ -151,6 +153,7 @@ impl Hint {} fn test_hints_to_map() { // custom value should only be there once if the names are identical + let n1 = crate::Notification::new() .hint(Hint::Custom("foo".into(), "bar1".into())) .hint(Hint::Custom("foo".into(), "bar2".into())) diff --git a/src/xdg/mod.rs b/src/xdg/mod.rs index 77d04a28f..11ed2637d 100644 --- a/src/xdg/mod.rs +++ b/src/xdg/mod.rs @@ -4,6 +4,8 @@ #[cfg(feature = "dbus")] use dbus::ffidisp::Connection as DbusConnection; +#[cfg(feature = "zbus")] +use zbus::zvariant; use crate::{error::*, notification::Notification}; @@ -404,7 +406,7 @@ pub fn get_server_information() -> Result { /// Return value of `get_server_information()`. #[derive(Debug)] #[cfg_attr(feature = "serde", derive(serde::Deserialize))] -#[cfg_attr(feature = "zbus", derive(zvariant_derive::Type))] +#[cfg_attr(feature = "zbus", derive(zvariant::Type))] pub struct ServerInformation { /// The product name of the server. pub name: String, From 2c3b99726ff7a3f8deaadb5076bd7b20db4591b5 Mon Sep 17 00:00:00 2001 From: Hendrik Sollich Date: Sat, 3 Dec 2022 15:22:29 +0100 Subject: [PATCH 3/3] style: tiny bit of manual formatting --- src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 95751a8d8..83d4de714 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -149,10 +149,13 @@ #[cfg(all(feature = "dbus", unix, not(target_os = "macos")))] extern crate dbus; + #[cfg(target_os = "macos")] extern crate mac_notification_sys; + #[cfg(target_os = "windows")] extern crate winrt_notification; + #[macro_use] #[cfg(all(feature = "images", unix, not(target_os = "macos")))] extern crate lazy_static; @@ -162,23 +165,26 @@ mod hints; mod miniver; mod notification; mod timeout; +pub(crate) mod urgency; #[cfg(target_os = "macos")] mod macos; + #[cfg(target_os = "windows")] mod windows; + #[cfg(all(unix, not(target_os = "macos")))] mod xdg; #[cfg(all(feature = "images", unix, not(target_os = "macos")))] mod image; + #[cfg(all(feature = "server", feature = "dbus", unix, not(target_os = "macos")))] pub mod server; -pub(crate) mod urgency; - #[cfg(target_os = "macos")] pub use mac_notification_sys::{get_bundle_identifier_or_default, set_application}; + #[cfg(target_os = "macos")] pub use macos::NotificationHandle;