revert: zbus 4 -> 3 (#1203)

* revert: zbus 4 -> 3

This reverts commit 71ba502442.

* chore: update dependencies

* chore: manually edit lockfile

* chore: dependency updates
This commit is contained in:
Wölfchen 2024-09-26 17:22:24 +00:00 committed by GitHub
parent 8661abf2bf
commit e242d40e35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 455 additions and 335 deletions

644
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -13,7 +13,7 @@ anyhow = "1.0.86"
bincode = "1.3.3" bincode = "1.3.3"
cached = "0.53.1" cached = "0.53.1"
chrono = "0.4.38" chrono = "0.4.38"
chrono-tz = "0.9.0" chrono-tz = "0.10.0"
clap = { version = "4.5.1", features = ["derive"] } clap = { version = "4.5.1", features = ["derive"] }
clap_complete = "4.5.12" clap_complete = "4.5.12"
codespan-reporting = "0.11" codespan-reporting = "0.11"
@ -35,8 +35,8 @@ jaq-parse = "1.0.3"
jaq-std = "1.6.0" jaq-std = "1.6.0"
jaq-interpret = "1.5.0" jaq-interpret = "1.5.0"
jaq-syn = "1.6.0" jaq-syn = "1.6.0"
lalrpop = { version = "0.20.2", features = ["unicode"] } lalrpop = { version = "0.21", features = ["unicode"] }
lalrpop-util = { version = "0.20.2", features = ["unicode"] } lalrpop-util = { version = "0.21", features = ["unicode"] }
libc = "0.2" libc = "0.2"
log = "0.4" log = "0.4"
maplit = "1" maplit = "1"
@ -60,7 +60,7 @@ tokio-util = "0.7.11"
tokio = { version = "1.39.2", features = ["full"] } tokio = { version = "1.39.2", features = ["full"] }
unescape = "0.1" unescape = "0.1"
wait-timeout = "0.2" 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] [profile.dev]
split-debuginfo = "unpacked" split-debuginfo = "unpacked"

View file

@ -88,7 +88,7 @@ pub async fn run_host(host: &mut dyn Host, snw: &proxy::StatusNotifierWatcherPro
// initial items first // initial items first
for svc in try_!(snw.registered_status_notifier_items().await) { 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) => { Ok(item) => {
item_names.insert(svc.to_owned()); item_names.insert(svc.to_owned());
host.add_item(&svc, item); host.add_item(&svc, item);
@ -110,7 +110,7 @@ pub async fn run_host(host: &mut dyn Host, snw: &proxy::StatusNotifierWatcherPro
if item_names.contains(svc) { if item_names.contains(svc) {
log::info!("Got duplicate new item: {:?}", svc); log::info!("Got duplicate new item: {:?}", svc);
} else { } else {
match Item::from_address(snw.inner().connection(), svc).await { match Item::from_address(snw.connection(), svc).await {
Ok(item) => { Ok(item) => {
item_names.insert(svc.to_owned()); item_names.insert(svc.to_owned());
host.add_item(svc, item); host.add_item(svc, item);

View file

@ -136,7 +136,7 @@ pub async fn load_icon_from_sni(
let icon_from_name: std::result::Result<gtk::gdk_pixbuf::Pixbuf, IconError> = (async { let icon_from_name: std::result::Result<gtk::gdk_pixbuf::Pixbuf, IconError> = (async {
// fetch icon name // fetch icon name
let icon_name = sni.icon_name().await; 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 { let icon_name = match icon_name {
Ok(s) if s.is_empty() => return Err(IconError::NotAvailable), Ok(s) if s.is_empty() => return Err(IconError::NotAvailable),
Ok(s) => s, Ok(s) => s,
@ -152,7 +152,7 @@ pub async fn load_icon_from_sni(
// otherwise, fetch icon theme and lookup using icon_from_name // otherwise, fetch icon theme and lookup using icon_from_name
let icon_theme_path = sni.icon_theme_path().await; 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 { let icon_theme_path = match icon_theme_path {
Ok(p) if p.is_empty() => None, Ok(p) if p.is_empty() => None,
Ok(p) => Some(p), Ok(p) => Some(p),
@ -179,7 +179,7 @@ pub async fn load_icon_from_sni(
match icon_from_name { match icon_from_name {
Ok(p) => return Some(p), // got an icon! Ok(p) => return Some(p), // got an icon!
Err(IconError::NotAvailable) => {} // this error is expected, don't log 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 // Can't get it from name + theme, try the pixmap
@ -199,7 +199,7 @@ pub async fn load_icon_from_sni(
match icon_from_pixmaps { match icon_from_pixmaps {
Ok(p) => return Some(p), Ok(p) => return Some(p),
Err(IconError::NotAvailable) => {} 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. // Tray didn't provide a valid icon so use the default fallback one.

View file

@ -82,7 +82,7 @@ impl Item {
} }
pub async fn set_menu(&mut self, widget: &gtk::EventBox) -> zbus::Result<()> { 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)); menu.set_attach_widget(Some(widget));
self.gtk_menu = Some(menu); self.gtk_menu = Some(menu);
Ok(()) Ok(())

View file

@ -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. //! This code was generated by `zbus-xmlgen` `3.1.0` from DBus introspection data.
//! Source: `dbus_status_notifier_item.xml`. //! Source: `dbus-status-notifier-item.xml`.
//! //!
//! You may prefer to adapt it, instead of using it verbatim. //! 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 //! More information can be found in the
//! documentation. //! [Writing a client proxy](https://dbus.pages.freedesktop.org/zbus/client.html)
//! //! section of the zbus documentation.
//!
//! [Writing a client proxy]: https://dbus2.github.io/zbus/client.html // suppress warning from generated code
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces, #![allow(clippy::type_complexity)]
use zbus::proxy;
#[proxy(interface = "org.kde.StatusNotifierItem", assume_defaults = true)] use zbus::dbus_proxy;
#[dbus_proxy(interface = "org.kde.StatusNotifierItem", assume_defaults = true)]
trait StatusNotifierItem { trait StatusNotifierItem {
/// Activate method /// Activate method
fn activate(&self, x: i32, y: i32) -> zbus::Result<()>; fn activate(&self, x: i32, y: i32) -> zbus::Result<()>;
@ -27,87 +29,86 @@ trait StatusNotifierItem {
fn secondary_activate(&self, x: i32, y: i32) -> zbus::Result<()>; fn secondary_activate(&self, x: i32, y: i32) -> zbus::Result<()>;
/// NewAttentionIcon signal /// NewAttentionIcon signal
#[zbus(signal)] #[dbus_proxy(signal)]
fn new_attention_icon(&self) -> zbus::Result<()>; fn new_attention_icon(&self) -> zbus::Result<()>;
/// NewIcon signal /// NewIcon signal
#[zbus(signal)] #[dbus_proxy(signal)]
fn new_icon(&self) -> zbus::Result<()>; fn new_icon(&self) -> zbus::Result<()>;
/// NewOverlayIcon signal /// NewOverlayIcon signal
#[zbus(signal)] #[dbus_proxy(signal)]
fn new_overlay_icon(&self) -> zbus::Result<()>; fn new_overlay_icon(&self) -> zbus::Result<()>;
/// NewStatus signal /// NewStatus signal
#[zbus(signal)] #[dbus_proxy(signal)]
fn new_status(&self, status: &str) -> zbus::Result<()>; fn new_status(&self, status: &str) -> zbus::Result<()>;
/// NewTitle signal /// NewTitle signal
#[zbus(signal)] #[dbus_proxy(signal)]
fn new_title(&self) -> zbus::Result<()>; fn new_title(&self) -> zbus::Result<()>;
/// NewToolTip signal /// NewToolTip signal
#[zbus(signal)] #[dbus_proxy(signal)]
fn new_tool_tip(&self) -> zbus::Result<()>; fn new_tool_tip(&self) -> zbus::Result<()>;
/// AttentionIconName property /// AttentionIconName property
#[zbus(property)] #[dbus_proxy(property)]
fn attention_icon_name(&self) -> zbus::Result<String>; fn attention_icon_name(&self) -> zbus::Result<String>;
/// AttentionIconPixmap property /// AttentionIconPixmap property
#[zbus(property)] #[dbus_proxy(property)]
fn attention_icon_pixmap(&self) -> zbus::Result<Vec<(i32, i32, Vec<u8>)>>; fn attention_icon_pixmap(&self) -> zbus::Result<Vec<(i32, i32, Vec<u8>)>>;
/// AttentionMovieName property /// AttentionMovieName property
#[zbus(property)] #[dbus_proxy(property)]
fn attention_movie_name(&self) -> zbus::Result<String>; fn attention_movie_name(&self) -> zbus::Result<String>;
/// Category property /// Category property
#[zbus(property)] #[dbus_proxy(property)]
fn category(&self) -> zbus::Result<String>; fn category(&self) -> zbus::Result<String>;
/// IconName property /// IconName property
#[zbus(property)] #[dbus_proxy(property(emits_changed_signal = "false"))]
fn icon_name(&self) -> zbus::Result<String>; fn icon_name(&self) -> zbus::Result<String>;
/// IconPixmap property /// IconPixmap property
#[zbus(property)] #[dbus_proxy(property(emits_changed_signal = "false"))]
fn icon_pixmap(&self) -> zbus::Result<Vec<(i32, i32, Vec<u8>)>>; fn icon_pixmap(&self) -> zbus::Result<Vec<(i32, i32, Vec<u8>)>>;
/// IconThemePath property /// IconThemePath property
#[zbus(property)] #[dbus_proxy(property)]
fn icon_theme_path(&self) -> zbus::Result<String>; fn icon_theme_path(&self) -> zbus::Result<String>;
/// Id property /// Id property
#[zbus(property)] #[dbus_proxy(property)]
fn id(&self) -> zbus::Result<String>; fn id(&self) -> zbus::Result<String>;
/// ItemIsMenu property /// ItemIsMenu property
#[zbus(property)] #[dbus_proxy(property)]
fn item_is_menu(&self) -> zbus::Result<bool>; fn item_is_menu(&self) -> zbus::Result<bool>;
/// Menu property /// Menu property
#[zbus(property)] #[dbus_proxy(property)]
fn menu(&self) -> zbus::Result<zbus::zvariant::OwnedObjectPath>; fn menu(&self) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;
/// OverlayIconName property /// OverlayIconName property
#[zbus(property)] #[dbus_proxy(property)]
fn overlay_icon_name(&self) -> zbus::Result<String>; fn overlay_icon_name(&self) -> zbus::Result<String>;
/// OverlayIconPixmap property /// OverlayIconPixmap property
#[zbus(property)] #[dbus_proxy(property)]
fn overlay_icon_pixmap(&self) -> zbus::Result<Vec<(i32, i32, Vec<u8>)>>; fn overlay_icon_pixmap(&self) -> zbus::Result<Vec<(i32, i32, Vec<u8>)>>;
/// Status property /// Status property
#[zbus(property)] #[dbus_proxy(property)]
fn status(&self) -> zbus::Result<String>; fn status(&self) -> zbus::Result<String>;
/// Title property /// Title property
#[zbus(property)] #[dbus_proxy(property)]
fn title(&self) -> zbus::Result<String>; fn title(&self) -> zbus::Result<String>;
/// ToolTip property /// ToolTip property
#[zbus(property)] #[dbus_proxy(property)]
#[allow(clippy::type_complexity)] fn tool_tip(&self) -> zbus::Result<(String, Vec<(i32, i32, Vec<u8>)>)>;
fn tool_tip(&self) -> zbus::Result<(String, Vec<(i32, i32, Vec<u8>)>, String, String)>;
} }

View file

@ -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. //! This code was generated by `zbus-xmlgen` `3.1.0` from DBus introspection data.
//! Source: `dbus_status_notifier_watcher.xml`. //! Source: `dbus-status-notifier-watcher.xml`.
//! //!
//! You may prefer to adapt it, instead of using it verbatim. //! 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 //! More information can be found in the
//! documentation. //! [Writing a client proxy](https://dbus.pages.freedesktop.org/zbus/client.html)
//! //! section of the zbus documentation.
//!
//! [Writing a client proxy]: https://dbus2.github.io/zbus/client.html use zbus::dbus_proxy;
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces,
use zbus::proxy; #[dbus_proxy(
#[proxy(
default_service = "org.kde.StatusNotifierWatcher", default_service = "org.kde.StatusNotifierWatcher",
interface = "org.kde.StatusNotifierWatcher", interface = "org.kde.StatusNotifierWatcher",
default_path = "/StatusNotifierWatcher" default_path = "/StatusNotifierWatcher"
@ -25,30 +24,30 @@ trait StatusNotifierWatcher {
fn register_status_notifier_item(&self, service: &str) -> zbus::Result<()>; fn register_status_notifier_item(&self, service: &str) -> zbus::Result<()>;
/// StatusNotifierHostRegistered signal /// StatusNotifierHostRegistered signal
#[zbus(signal)] #[dbus_proxy(signal)]
fn status_notifier_host_registered(&self) -> zbus::Result<()>; fn status_notifier_host_registered(&self) -> zbus::Result<()>;
/// StatusNotifierHostUnregistered signal /// StatusNotifierHostUnregistered signal
#[zbus(signal)] #[dbus_proxy(signal)]
fn status_notifier_host_unregistered(&self) -> zbus::Result<()>; fn status_notifier_host_unregistered(&self) -> zbus::Result<()>;
/// StatusNotifierItemRegistered signal /// StatusNotifierItemRegistered signal
#[zbus(signal)] #[dbus_proxy(signal)]
fn status_notifier_item_registered(&self, service: &str) -> zbus::Result<()>; fn status_notifier_item_registered(&self, service: &str) -> zbus::Result<()>;
/// StatusNotifierItemUnregistered signal /// StatusNotifierItemUnregistered signal
#[zbus(signal)] #[dbus_proxy(signal)]
fn status_notifier_item_unregistered(&self, service: &str) -> zbus::Result<()>; fn status_notifier_item_unregistered(&self, service: &str) -> zbus::Result<()>;
/// IsStatusNotifierHostRegistered property /// IsStatusNotifierHostRegistered property
#[zbus(property)] #[dbus_proxy(property)]
fn is_status_notifier_host_registered(&self) -> zbus::Result<bool>; fn is_status_notifier_host_registered(&self) -> zbus::Result<bool>;
/// ProtocolVersion property /// ProtocolVersion property
#[zbus(property)] #[dbus_proxy(property)]
fn protocol_version(&self) -> zbus::Result<i32>; fn protocol_version(&self) -> zbus::Result<i32>;
/// RegisteredStatusNotifierItems property /// RegisteredStatusNotifierItems property
#[zbus(property)] #[dbus_proxy(property)]
fn registered_status_notifier_items(&self) -> zbus::Result<Vec<String>>; fn registered_status_notifier_items(&self) -> zbus::Result<Vec<String>>;
} }

View file

@ -1,5 +1,5 @@
use crate::names; 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 /// 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`]). /// exist, and doesn't have any logic for displaying items (for that, see [`Host`][`crate::Host`]).
@ -23,7 +23,7 @@ pub struct Watcher {
/// ///
/// Methods and properties correspond to methods and properties on the DBus service that can be /// 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. /// 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 { impl Watcher {
/// RegisterStatusNotifierHost method /// RegisterStatusNotifierHost method
async fn register_status_notifier_host( async fn register_status_notifier_host(
@ -89,15 +89,15 @@ impl Watcher {
} }
/// StatusNotifierHostRegistered signal. /// StatusNotifierHostRegistered signal.
#[zbus(signal)] #[dbus_interface(signal)]
async fn status_notifier_host_registered(ctxt: &zbus::SignalContext<'_>) -> zbus::Result<()>; async fn status_notifier_host_registered(ctxt: &zbus::SignalContext<'_>) -> zbus::Result<()>;
/// StatusNotifierHostUnregistered signal /// StatusNotifierHostUnregistered signal
#[zbus(signal)] #[dbus_interface(signal)]
async fn status_notifier_host_unregistered(ctxt: &zbus::SignalContext<'_>) -> zbus::Result<()>; async fn status_notifier_host_unregistered(ctxt: &zbus::SignalContext<'_>) -> zbus::Result<()>;
/// IsStatusNotifierHostRegistered property /// IsStatusNotifierHostRegistered property
#[zbus(property)] #[dbus_interface(property)]
async fn is_status_notifier_host_registered(&self) -> bool { async fn is_status_notifier_host_registered(&self) -> bool {
let hosts = self.hosts.lock().unwrap(); // unwrap: mutex poisoning is okay let hosts = self.hosts.lock().unwrap(); // unwrap: mutex poisoning is okay
!hosts.is_empty() !hosts.is_empty()
@ -159,15 +159,15 @@ impl Watcher {
} }
/// StatusNotifierItemRegistered signal /// StatusNotifierItemRegistered signal
#[zbus(signal)] #[dbus_interface(signal)]
async fn status_notifier_item_registered(ctxt: &zbus::SignalContext<'_>, service: &str) -> zbus::Result<()>; async fn status_notifier_item_registered(ctxt: &zbus::SignalContext<'_>, service: &str) -> zbus::Result<()>;
/// StatusNotifierItemUnregistered signal /// StatusNotifierItemUnregistered signal
#[zbus(signal)] #[dbus_interface(signal)]
async fn status_notifier_item_unregistered(ctxt: &zbus::SignalContext<'_>, service: &str) -> zbus::Result<()>; async fn status_notifier_item_unregistered(ctxt: &zbus::SignalContext<'_>, service: &str) -> zbus::Result<()>;
/// RegisteredStatusNotifierItems property /// RegisteredStatusNotifierItems property
#[zbus(property)] #[dbus_interface(property)]
async fn registered_status_notifier_items(&self) -> Vec<String> { async fn registered_status_notifier_items(&self) -> Vec<String> {
let items = self.items.lock().unwrap(); // unwrap: mutex poisoning is okay let items = self.items.lock().unwrap(); // unwrap: mutex poisoning is okay
items.iter().cloned().collect() items.iter().cloned().collect()
@ -176,7 +176,7 @@ impl Watcher {
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/// ProtocolVersion property /// ProtocolVersion property
#[zbus(property)] #[dbus_interface(property)]
fn protocol_version(&self) -> i32 { fn protocol_version(&self) -> i32 {
0 0
} }
@ -244,7 +244,7 @@ async fn parse_service<'a>(
) -> zbus::fdo::Result<(zbus::names::UniqueName<'static>, &'a str)> { ) -> zbus::fdo::Result<(zbus::names::UniqueName<'static>, &'a str)> {
if service.starts_with('/') { if service.starts_with('/') {
// they sent us just the object path // they sent us just the object path
if let Some(sender) = hdr.sender() { if let Some(sender) = hdr.sender()? {
Ok((sender.to_owned(), service)) Ok((sender.to_owned(), service))
} else { } else {
log::warn!("unknown sender"); log::warn!("unknown sender");