Skip to content

Commit

Permalink
revert: zbus 4 -> 3 (#1203)
Browse files Browse the repository at this point in the history
* revert: zbus 4 -> 3

This reverts commit 71ba502.

* chore: update dependencies

* chore: manually edit lockfile

* chore: dependency updates
  • Loading branch information
w-lfchen authored Sep 26, 2024
1 parent 8661abf commit e242d40
Show file tree
Hide file tree
Showing 8 changed files with 455 additions and 335 deletions.
644 changes: 382 additions & 262 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ anyhow = "1.0.86"
bincode = "1.3.3"
cached = "0.53.1"
chrono = "0.4.38"
chrono-tz = "0.9.0"
chrono-tz = "0.10.0"
clap = { version = "4.5.1", features = ["derive"] }
clap_complete = "4.5.12"
codespan-reporting = "0.11"
Expand All @@ -35,8 +35,8 @@ jaq-parse = "1.0.3"
jaq-std = "1.6.0"
jaq-interpret = "1.5.0"
jaq-syn = "1.6.0"
lalrpop = { version = "0.20.2", features = ["unicode"] }
lalrpop-util = { version = "0.20.2", features = ["unicode"] }
lalrpop = { version = "0.21", features = ["unicode"] }
lalrpop-util = { version = "0.21", features = ["unicode"] }
libc = "0.2"
log = "0.4"
maplit = "1"
Expand All @@ -60,7 +60,7 @@ tokio-util = "0.7.11"
tokio = { version = "1.39.2", features = ["full"] }
unescape = "0.1"
wait-timeout = "0.2"
zbus = { version = "4.4.0", default-features = false, features = ["tokio"] }
zbus = { version = "3.15.2", default-features = false, features = ["tokio"] }

[profile.dev]
split-debuginfo = "unpacked"
4 changes: 2 additions & 2 deletions crates/notifier_host/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub async fn run_host(host: &mut dyn Host, snw: &proxy::StatusNotifierWatcherPro

// initial items first
for svc in try_!(snw.registered_status_notifier_items().await) {
match Item::from_address(snw.inner().connection(), &svc).await {
match Item::from_address(snw.connection(), &svc).await {
Ok(item) => {
item_names.insert(svc.to_owned());
host.add_item(&svc, item);
Expand All @@ -110,7 +110,7 @@ pub async fn run_host(host: &mut dyn Host, snw: &proxy::StatusNotifierWatcherPro
if item_names.contains(svc) {
log::info!("Got duplicate new item: {:?}", svc);
} else {
match Item::from_address(snw.inner().connection(), svc).await {
match Item::from_address(snw.connection(), svc).await {
Ok(item) => {
item_names.insert(svc.to_owned());
host.add_item(svc, item);
Expand Down
8 changes: 4 additions & 4 deletions crates/notifier_host/src/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ pub async fn load_icon_from_sni(
let icon_from_name: std::result::Result<gtk::gdk_pixbuf::Pixbuf, IconError> = (async {
// fetch icon name
let icon_name = sni.icon_name().await;
log::debug!("dbus: {} icon_name -> {:?}", sni.inner().destination(), icon_name);
log::debug!("dbus: {} icon_name -> {:?}", sni.destination(), icon_name);
let icon_name = match icon_name {
Ok(s) if s.is_empty() => return Err(IconError::NotAvailable),
Ok(s) => s,
Expand All @@ -152,7 +152,7 @@ pub async fn load_icon_from_sni(

// otherwise, fetch icon theme and lookup using icon_from_name
let icon_theme_path = sni.icon_theme_path().await;
log::debug!("dbus: {} icon_theme_path -> {:?}", sni.inner().destination(), icon_theme_path);
log::debug!("dbus: {} icon_theme_path -> {:?}", sni.destination(), icon_theme_path);
let icon_theme_path = match icon_theme_path {
Ok(p) if p.is_empty() => None,
Ok(p) => Some(p),
Expand All @@ -179,7 +179,7 @@ pub async fn load_icon_from_sni(
match icon_from_name {
Ok(p) => return Some(p), // got an icon!
Err(IconError::NotAvailable) => {} // this error is expected, don't log
Err(e) => log::warn!("failed to get icon by name for {}: {}", sni.inner().destination(), e),
Err(e) => log::warn!("failed to get icon by name for {}: {}", sni.destination(), e),
};

// Can't get it from name + theme, try the pixmap
Expand All @@ -199,7 +199,7 @@ pub async fn load_icon_from_sni(
match icon_from_pixmaps {
Ok(p) => return Some(p),
Err(IconError::NotAvailable) => {}
Err(e) => log::warn!("failed to get icon pixmap for {}: {}", sni.inner().destination(), e),
Err(e) => log::warn!("failed to get icon pixmap for {}: {}", sni.destination(), e),
};

// Tray didn't provide a valid icon so use the default fallback one.
Expand Down
2 changes: 1 addition & 1 deletion crates/notifier_host/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl Item {
}

pub async fn set_menu(&mut self, widget: &gtk::EventBox) -> zbus::Result<()> {
let menu = dbusmenu_gtk3::Menu::new(self.sni.inner().destination(), &self.sni.menu().await?);
let menu = dbusmenu_gtk3::Menu::new(self.sni.destination(), &self.sni.menu().await?);
menu.set_attach_widget(Some(widget));
self.gtk_menu = Some(menu);
Ok(())
Expand Down
69 changes: 35 additions & 34 deletions crates/notifier_host/src/proxy/dbus_status_notifier_item.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
//! # D-Bus interface proxy for: `org.kde.StatusNotifierItem`
//! # DBus interface proxy for: `org.kde.StatusNotifierItem`
//!
//! This code was generated by `zbus-xmlgen` `4.1.0` from D-Bus introspection data.
//! Source: `dbus_status_notifier_item.xml`.
//! This code was generated by `zbus-xmlgen` `3.1.0` from DBus introspection data.
//! Source: `dbus-status-notifier-item.xml`.
//!
//! You may prefer to adapt it, instead of using it verbatim.
//!
//! More information can be found in the [Writing a client proxy] section of the zbus
//! documentation.
//!
//!
//! [Writing a client proxy]: https://dbus2.github.io/zbus/client.html
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces,
use zbus::proxy;
#[proxy(interface = "org.kde.StatusNotifierItem", assume_defaults = true)]
//! More information can be found in the
//! [Writing a client proxy](https://dbus.pages.freedesktop.org/zbus/client.html)
//! section of the zbus documentation.

// suppress warning from generated code
#![allow(clippy::type_complexity)]

use zbus::dbus_proxy;

#[dbus_proxy(interface = "org.kde.StatusNotifierItem", assume_defaults = true)]
trait StatusNotifierItem {
/// Activate method
fn activate(&self, x: i32, y: i32) -> zbus::Result<()>;
Expand All @@ -27,87 +29,86 @@ trait StatusNotifierItem {
fn secondary_activate(&self, x: i32, y: i32) -> zbus::Result<()>;

/// NewAttentionIcon signal
#[zbus(signal)]
#[dbus_proxy(signal)]
fn new_attention_icon(&self) -> zbus::Result<()>;

/// NewIcon signal
#[zbus(signal)]
#[dbus_proxy(signal)]
fn new_icon(&self) -> zbus::Result<()>;

/// NewOverlayIcon signal
#[zbus(signal)]
#[dbus_proxy(signal)]
fn new_overlay_icon(&self) -> zbus::Result<()>;

/// NewStatus signal
#[zbus(signal)]
#[dbus_proxy(signal)]
fn new_status(&self, status: &str) -> zbus::Result<()>;

/// NewTitle signal
#[zbus(signal)]
#[dbus_proxy(signal)]
fn new_title(&self) -> zbus::Result<()>;

/// NewToolTip signal
#[zbus(signal)]
#[dbus_proxy(signal)]
fn new_tool_tip(&self) -> zbus::Result<()>;

/// AttentionIconName property
#[zbus(property)]
#[dbus_proxy(property)]
fn attention_icon_name(&self) -> zbus::Result<String>;

/// AttentionIconPixmap property
#[zbus(property)]
#[dbus_proxy(property)]
fn attention_icon_pixmap(&self) -> zbus::Result<Vec<(i32, i32, Vec<u8>)>>;

/// AttentionMovieName property
#[zbus(property)]
#[dbus_proxy(property)]
fn attention_movie_name(&self) -> zbus::Result<String>;

/// Category property
#[zbus(property)]
#[dbus_proxy(property)]
fn category(&self) -> zbus::Result<String>;

/// IconName property
#[zbus(property)]
#[dbus_proxy(property(emits_changed_signal = "false"))]
fn icon_name(&self) -> zbus::Result<String>;

/// IconPixmap property
#[zbus(property)]
#[dbus_proxy(property(emits_changed_signal = "false"))]
fn icon_pixmap(&self) -> zbus::Result<Vec<(i32, i32, Vec<u8>)>>;

/// IconThemePath property
#[zbus(property)]
#[dbus_proxy(property)]
fn icon_theme_path(&self) -> zbus::Result<String>;

/// Id property
#[zbus(property)]
#[dbus_proxy(property)]
fn id(&self) -> zbus::Result<String>;

/// ItemIsMenu property
#[zbus(property)]
#[dbus_proxy(property)]
fn item_is_menu(&self) -> zbus::Result<bool>;

/// Menu property
#[zbus(property)]
#[dbus_proxy(property)]
fn menu(&self) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;

/// OverlayIconName property
#[zbus(property)]
#[dbus_proxy(property)]
fn overlay_icon_name(&self) -> zbus::Result<String>;

/// OverlayIconPixmap property
#[zbus(property)]
#[dbus_proxy(property)]
fn overlay_icon_pixmap(&self) -> zbus::Result<Vec<(i32, i32, Vec<u8>)>>;

/// Status property
#[zbus(property)]
#[dbus_proxy(property)]
fn status(&self) -> zbus::Result<String>;

/// Title property
#[zbus(property)]
#[dbus_proxy(property)]
fn title(&self) -> zbus::Result<String>;

/// ToolTip property
#[zbus(property)]
#[allow(clippy::type_complexity)]
fn tool_tip(&self) -> zbus::Result<(String, Vec<(i32, i32, Vec<u8>)>, String, String)>;
#[dbus_proxy(property)]
fn tool_tip(&self) -> zbus::Result<(String, Vec<(i32, i32, Vec<u8>)>)>;
}
35 changes: 17 additions & 18 deletions crates/notifier_host/src/proxy/dbus_status_notifier_watcher.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
//! # D-Bus interface proxy for: `org.kde.StatusNotifierWatcher`
//! # DBus interface proxy for: `org.kde.StatusNotifierWatcher`
//!
//! This code was generated by `zbus-xmlgen` `4.1.0` from D-Bus introspection data.
//! Source: `dbus_status_notifier_watcher.xml`.
//! This code was generated by `zbus-xmlgen` `3.1.0` from DBus introspection data.
//! Source: `dbus-status-notifier-watcher.xml`.
//!
//! You may prefer to adapt it, instead of using it verbatim.
//!
//! More information can be found in the [Writing a client proxy] section of the zbus
//! documentation.
//!
//!
//! [Writing a client proxy]: https://dbus2.github.io/zbus/client.html
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces,
use zbus::proxy;
#[proxy(
//! More information can be found in the
//! [Writing a client proxy](https://dbus.pages.freedesktop.org/zbus/client.html)
//! section of the zbus documentation.

use zbus::dbus_proxy;

#[dbus_proxy(
default_service = "org.kde.StatusNotifierWatcher",
interface = "org.kde.StatusNotifierWatcher",
default_path = "/StatusNotifierWatcher"
Expand All @@ -25,30 +24,30 @@ trait StatusNotifierWatcher {
fn register_status_notifier_item(&self, service: &str) -> zbus::Result<()>;

/// StatusNotifierHostRegistered signal
#[zbus(signal)]
#[dbus_proxy(signal)]
fn status_notifier_host_registered(&self) -> zbus::Result<()>;

/// StatusNotifierHostUnregistered signal
#[zbus(signal)]
#[dbus_proxy(signal)]
fn status_notifier_host_unregistered(&self) -> zbus::Result<()>;

/// StatusNotifierItemRegistered signal
#[zbus(signal)]
#[dbus_proxy(signal)]
fn status_notifier_item_registered(&self, service: &str) -> zbus::Result<()>;

/// StatusNotifierItemUnregistered signal
#[zbus(signal)]
#[dbus_proxy(signal)]
fn status_notifier_item_unregistered(&self, service: &str) -> zbus::Result<()>;

/// IsStatusNotifierHostRegistered property
#[zbus(property)]
#[dbus_proxy(property)]
fn is_status_notifier_host_registered(&self) -> zbus::Result<bool>;

/// ProtocolVersion property
#[zbus(property)]
#[dbus_proxy(property)]
fn protocol_version(&self) -> zbus::Result<i32>;

/// RegisteredStatusNotifierItems property
#[zbus(property)]
#[dbus_proxy(property)]
fn registered_status_notifier_items(&self) -> zbus::Result<Vec<String>>;
}
20 changes: 10 additions & 10 deletions crates/notifier_host/src/watcher.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::names;
use zbus::{export::ordered_stream::OrderedStreamExt, interface, Interface};
use zbus::{dbus_interface, export::ordered_stream::OrderedStreamExt, Interface};

/// An instance of [`org.kde.StatusNotifierWatcher`]. It only tracks what tray items and trays
/// exist, and doesn't have any logic for displaying items (for that, see [`Host`][`crate::Host`]).
Expand All @@ -23,7 +23,7 @@ pub struct Watcher {
///
/// Methods and properties correspond to methods and properties on the DBus service that can be
/// used by others, while signals are events that we generate that other services listen to.
#[interface(name = "org.kde.StatusNotifierWatcher")]
#[dbus_interface(name = "org.kde.StatusNotifierWatcher")]
impl Watcher {
/// RegisterStatusNotifierHost method
async fn register_status_notifier_host(
Expand Down Expand Up @@ -89,15 +89,15 @@ impl Watcher {
}

/// StatusNotifierHostRegistered signal.
#[zbus(signal)]
#[dbus_interface(signal)]
async fn status_notifier_host_registered(ctxt: &zbus::SignalContext<'_>) -> zbus::Result<()>;

/// StatusNotifierHostUnregistered signal
#[zbus(signal)]
#[dbus_interface(signal)]
async fn status_notifier_host_unregistered(ctxt: &zbus::SignalContext<'_>) -> zbus::Result<()>;

/// IsStatusNotifierHostRegistered property
#[zbus(property)]
#[dbus_interface(property)]
async fn is_status_notifier_host_registered(&self) -> bool {
let hosts = self.hosts.lock().unwrap(); // unwrap: mutex poisoning is okay
!hosts.is_empty()
Expand Down Expand Up @@ -159,15 +159,15 @@ impl Watcher {
}

/// StatusNotifierItemRegistered signal
#[zbus(signal)]
#[dbus_interface(signal)]
async fn status_notifier_item_registered(ctxt: &zbus::SignalContext<'_>, service: &str) -> zbus::Result<()>;

/// StatusNotifierItemUnregistered signal
#[zbus(signal)]
#[dbus_interface(signal)]
async fn status_notifier_item_unregistered(ctxt: &zbus::SignalContext<'_>, service: &str) -> zbus::Result<()>;

/// RegisteredStatusNotifierItems property
#[zbus(property)]
#[dbus_interface(property)]
async fn registered_status_notifier_items(&self) -> Vec<String> {
let items = self.items.lock().unwrap(); // unwrap: mutex poisoning is okay
items.iter().cloned().collect()
Expand All @@ -176,7 +176,7 @@ impl Watcher {
// ------------------------------------------------------------------------

/// ProtocolVersion property
#[zbus(property)]
#[dbus_interface(property)]
fn protocol_version(&self) -> i32 {
0
}
Expand Down Expand Up @@ -244,7 +244,7 @@ async fn parse_service<'a>(
) -> zbus::fdo::Result<(zbus::names::UniqueName<'static>, &'a str)> {
if service.starts_with('/') {
// they sent us just the object path
if let Some(sender) = hdr.sender() {
if let Some(sender) = hdr.sender()? {
Ok((sender.to_owned(), service))
} else {
log::warn!("unknown sender");
Expand Down

0 comments on commit e242d40

Please sign in to comment.