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

@ -17,13 +17,24 @@ tokio = { version = "1.36.0", features = [
"io-util",
"io-std",
] }
cosmic-notifications-config = { git = "https://github.com/pop-os/cosmic-notifications" }
cosmic-notifications-util = { git = "https://github.com/pop-os/cosmic-notifications" }
i18n-embed-fl.workspace = true
i18n-embed.workspace = true
rust-embed.workspace = true
tracing-log.workspace = true
cosmic-notifications-config = { git = "https://github.com/pop-os/cosmic-notifications" }
# cosmic-notifications-util = { path = "../../cosmic-notifications-daemon/cosmic-notifications-util" }
# cosmic-notifications-config = { path = "../../cosmic-notifications-daemon/cosmic-notifications-config" }
tracing = "0.1"
ron = "0.8"
sendfd = { version = "0.4", features = ["tokio"] }
bytemuck = "1"
tracing-subscriber.workspace = true
tracing.workspace = true
url = "2.5.0"
tracing-log.workspace = true
zbus.workspace = true
zbus.features = ["tokio", "p2p"]
# Application i18n
i18n-embed = { version = "0.13.4", features = [
"fluent-system",
"desktop-requester",
] }
i18n-embed-fl = "0.6.4"
rust-embed = "6.3.0"
rust-embed-utils = "7.5.0"
url = "2.5.0"

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?;