Skip to content

Commit

Permalink
Merge pull request #153 from hoodie/feature/hendriks/update-zbus-3
Browse files Browse the repository at this point in the history
update zbus to 3
  • Loading branch information
hoodie committed Dec 3, 2022
2 parents a494ea8 + ada8859 commit 6020bab
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog

## [Unreleased](https://github.com/hoodie/notify-rust/compare/v4.5.10...HEAD) (2022-09-25)
## [Unreleased](https://github.com/hoodie/notify-rust/compare/v4.5.10...HEAD) (2022-12-03)

### Features

* update zbus dependency to 3.x
([4c496dc](https://github.com/hoodie/notify-rust/commit/4c496dc8c718b38f2108c9858f1e0c2e15cd5bff))

### [v4.5.10](https://github.com/hoodie/notify-rust/compare/v4.5.9...v4.5.10) (2022-09-25)

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "2", optional = true }
zbus = { version = "3", optional = true }
serde = { version = "1", optional = true }

[target.'cfg(target_os="macos")'.dependencies]
Expand Down
19 changes: 16 additions & 3 deletions src/xdg/zbus_rs.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{error::*, notification::Notification, xdg};
use zbus::blocking::Connection;
use zbus::{blocking::Connection, MatchRule};

use super::{ActionResponse, ActionResponseHandler, CloseReason};

Expand Down Expand Up @@ -125,12 +125,25 @@ pub fn handle_action(id: u32, func: impl ActionResponseHandler) {
}

fn wait_for_action_signal(connection: &Connection, id: u32, handler: impl ActionResponseHandler) {

let action_signal_rule = MatchRule::builder()
.msg_type(zbus::MessageType::Signal)
.interface("org.freedesktop.Notifications").unwrap()
.member("ActionInvoked").unwrap()
.build();

let proxy = zbus::blocking::fdo::DBusProxy::new(connection).unwrap();
proxy
.add_match("interface='org.freedesktop.Notifications',member='ActionInvoked'")
.add_match_rule(action_signal_rule)
.unwrap();

let close_signal_rule = MatchRule::builder()
.msg_type(zbus::MessageType::Signal)
.interface("org.freedesktop.Notifications").unwrap()
.member("NotificationClosed").unwrap()
.build();
proxy
.add_match("interface='org.freedesktop.Notifications',member='NotificationClosed'")
.add_match_rule(close_signal_rule)
.unwrap();

for msg in zbus::blocking::MessageIterator::from(connection).flatten() {
Expand Down

0 comments on commit 6020bab

Please sign in to comment.