Skip to content

Commit

Permalink
Merge pull request #163 from hoodie/feature/zbus-3.5
Browse files Browse the repository at this point in the history
zbus 3.5
  • Loading branch information
hoodie committed Dec 3, 2022
2 parents 0c2a33c + 2c3b997 commit 74e2ab1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
6 changes: 2 additions & 4 deletions Cargo.toml
Expand Up @@ -24,9 +24,7 @@ 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", optional = true }
zbus = { version = "3.5", optional = true }
serde = { version = "1", optional = true }

[target.'cfg(target_os="macos")'.dependencies]
Expand All @@ -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"]

Expand Down
5 changes: 4 additions & 1 deletion 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;
Expand All @@ -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)]
Expand Down Expand Up @@ -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()))
Expand Down
10 changes: 8 additions & 2 deletions src/lib.rs
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
4 changes: 3 additions & 1 deletion src/xdg/mod.rs
Expand Up @@ -4,6 +4,8 @@

#[cfg(feature = "dbus")]
use dbus::ffidisp::Connection as DbusConnection;
#[cfg(feature = "zbus")]
use zbus::zvariant;

use crate::{error::*, notification::Notification};

Expand Down Expand Up @@ -404,7 +406,7 @@ pub fn get_server_information() -> Result<ServerInformation> {
/// 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,
Expand Down

0 comments on commit 74e2ab1

Please sign in to comment.