zbus update

This commit is contained in:
Ashley Wulber 2024-05-16 21:29:28 -04:00 committed by Michael Murphy
parent 2e9660f2a8
commit 87250b5e50
23 changed files with 613 additions and 484 deletions

View file

@ -19,9 +19,9 @@
//!
//! …consequently `zbus-xmlgen` did not generate code for the above interfaces.
use zbus::dbus_proxy;
use zbus::proxy;
#[dbus_proxy(
#[proxy(
interface = "org.freedesktop.Notifications",
default_service = "org.freedesktop.Notifications",
default_path = "/org/freedesktop/Notifications"
@ -50,10 +50,10 @@ trait Notifications {
) -> zbus::Result<u32>;
/// ActionInvoked signal
#[dbus_proxy(signal)]
#[zbus(signal)]
fn action_invoked(&self, id: u32, action_key: &str) -> zbus::Result<()>;
/// NotificationClosed signal
#[dbus_proxy(signal)]
#[zbus(signal)]
fn notification_closed(&self, id: u32, reason: u32) -> zbus::Result<()>;
}

View file

@ -13,9 +13,9 @@ use std::{
use tracing::{error, trace};
use zbus::{
dbus_proxy,
connection::Builder,
export::futures_util::{SinkExt, StreamExt},
ConnectionBuilder,
proxy,
};
#[derive(Debug)]
@ -80,13 +80,13 @@ pub fn notifications(proxy: NotificationsAppletProxy<'static>) -> Subscription<N
)
}
#[dbus_proxy(
#[proxy(
default_service = "com.system76.NotificationsApplet",
interface = "com.system76.NotificationsApplet",
default_path = "/com/system76/NotificationsApplet"
)]
trait NotificationsApplet {
#[dbus_proxy(signal)]
#[zbus(signal)]
fn notify(
&self,
app_name: &str,
@ -108,7 +108,7 @@ pub async fn get_proxy() -> anyhow::Result<NotificationsAppletProxy<'static>> {
let stream = unsafe { std::os::unix::net::UnixStream::from_raw_fd(raw_fd) };
stream.set_nonblocking(true)?;
let stream = tokio::net::UnixStream::from_std(stream)?;
let conn = ConnectionBuilder::socket(stream).p2p().build().await?;
let conn = Builder::socket(stream).p2p().build().await?;
trace!("Applet connection created");
let proxy = NotificationsAppletProxy::new(&conn).await?;