Update to zbus 5.x

https://github.com/dbus2/zbus/releases/tag/zbus-5.0.0

Now requires `pub` on uses of `#[proxy]` if the generated types should
be `pub`.
This commit is contained in:
Ian Douglas Scott 2024-10-28 14:22:30 -07:00 committed by Michael Murphy
parent ac5713df52
commit 3b86984332
26 changed files with 30 additions and 32 deletions

View file

@ -24,5 +24,5 @@ serde = { version = "1.0", features = ["derive"] }
thiserror = "1.0"
time = { version = "0.3", features = ["parsing"] }
tracing = "0.1.40"
zbus = { version = "4.2.1" }
zvariant = { version = "4.1.0" }
zbus = { version = "5.7.1" }
zvariant = { version = "5.5.3" }

View file

@ -30,7 +30,7 @@ use crate::{UserProxy, UserProxyBlocking};
default_service = "org.freedesktop.Accounts",
default_path = "/org/freedesktop/Accounts"
)]
trait Accounts {
pub trait Accounts {
/// CacheUser method
fn cache_user(&self, name: &str) -> zbus::Result<zbus::zvariant::OwnedObjectPath>;

View file

@ -28,7 +28,7 @@ use zbus::proxy;
default_service = "org.freedesktop.Accounts",
// default_path = "/org/freedesktop/Accounts/User1000"
)]
trait User {
pub trait User {
/// GetPasswordExpirationPolicy method
fn get_password_expiration_policy(&self) -> zbus::Result<(i64, i64, i64, i64, i64, i64)>;

View file

@ -20,7 +20,7 @@
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces,
use zbus::proxy;
#[proxy(interface = "org.bluez.Adapter1", default_service = "org.bluez")]
trait Adapter1 {
pub trait Adapter1 {
/// ConnectDevice method
fn connect_device(
&self,

View file

@ -23,7 +23,7 @@ use zbus::proxy;
default_service = "org.bluez",
default_path = "/org/bluez"
)]
trait AgentManager1 {
pub trait AgentManager1 {
/// RegisterAgent method
fn register_agent(
&self,

View file

@ -20,7 +20,7 @@
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces,
use zbus::proxy;
#[proxy(interface = "org.bluez.Battery1", default_service = "org.bluez")]
trait Battery1 {
pub trait Battery1 {
/// Percentage property
#[zbus(property)]
fn percentage(&self) -> zbus::Result<u8>;

View file

@ -22,7 +22,7 @@
//! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces,
use zbus::proxy;
#[proxy(interface = "org.bluez.Device1", default_service = "org.bluez")]
trait Device1 {
pub trait Device1 {
/// CancelPairing method
fn cancel_pairing(&self) -> zbus::Result<()>;

View file

@ -23,7 +23,7 @@ use zbus::proxy;
default_service = "org.bluez",
default_path = "/org/bluez"
)]
trait HealthManager1 {
pub trait HealthManager1 {
/// CreateApplication method
fn create_application(
&self,

View file

@ -25,7 +25,7 @@ use zbus::proxy;
default_service = "org.bluez",
default_path = "/org/bluez"
)]
trait ProfileManager1 {
pub trait ProfileManager1 {
/// RegisterProfile method
fn register_profile(
&self,

View file

@ -26,7 +26,7 @@ use zbus::{names::OwnedWellKnownName, proxy};
default_service = "com.system76.CosmicSettingsDaemon",
default_path = "/com/system76/CosmicSettingsDaemon"
)]
trait CosmicSettingsDaemon {
pub trait CosmicSettingsDaemon {
/// DecreaseDisplayBrightness method
fn decrease_display_brightness(&self) -> zbus::Result<()>;
@ -68,7 +68,7 @@ trait CosmicSettingsDaemon {
interface = "com.system76.CosmicSettingsDaemon.Config",
default_service = "com.system76.CosmicSettingsDaemon.Config"
)]
trait Config {
pub trait Config {
/// Changed signal
#[zbus(signal)]
async fn changed(&self, id: String, key: String) -> zbus::Result<()>;

View file

@ -48,7 +48,7 @@ impl TryFrom<OwnedValue> for Accuracy {
interface = "org.freedesktop.GeoClue2.Manager",
default_path = "/org/freedesktop/GeoClue2/Manager"
)]
trait Manager {
pub trait Manager {
/// Retrieves a client object which can only be used by the calling application only. On the first call from a specific D-Bus peer, this method will create the client object but subsequent calls will return the path of the existing client.
#[zbus(object = "Client")]
fn get_client(&self);
@ -72,7 +72,7 @@ trait Manager {
default_service = "org.freedesktop.GeoClue2",
interface = "org.freedesktop.GeoClue2.Client"
)]
trait Client {
pub trait Client {
/// Start method
fn start(&self) -> zbus::Result<()>;
@ -123,7 +123,7 @@ trait Client {
default_service = "org.freedesktop.GeoClue2",
interface = "org.freedesktop.GeoClue2.Location"
)]
trait Location {
pub trait Location {
/// The latitude of the location, in degrees.
#[zbus(property)]
fn latitude(&self) -> Result<f64>;

View file

@ -9,7 +9,7 @@ categories = ["os::linux-apis"]
keywords = ["dbus", "hostname", "hostname1", "zbus", "freedesktop"]
[dependencies]
zbus = "4.2.1"
zbus.workspace = true
[dev-dependencies]
pico-args = "0.5.0"

View file

@ -26,7 +26,7 @@ use zbus::proxy;
default_service = "org.freedesktop.hostname1",
default_path = "/org/freedesktop/hostname1"
)]
trait Hostname1 {
pub trait Hostname1 {
/// Describe method
fn describe(&self) -> zbus::Result<String>;

View file

@ -9,7 +9,7 @@ use zbus::proxy;
default_service = "org.freedesktop.locale1",
default_path = "/org/freedesktop/locale1"
)]
trait locale1 {
pub trait locale1 {
/// SetLocale method
fn set_locale(&self, locale: &[&str], interactive: bool) -> zbus::Result<()>;

View file

@ -26,7 +26,7 @@ use zbus::proxy;
interface = "org.mpris.MediaPlayer2",
default_path = "/org/mpris/MediaPlayer2"
)]
trait MediaPlayer2 {
pub trait MediaPlayer2 {
/// Quit method
fn quit(&self) -> zbus::Result<()>;

View file

@ -27,7 +27,7 @@ use zbus::proxy;
interface = "org.mpris.MediaPlayer2.Player",
default_path = "/org/mpris/MediaPlayer2"
)]
trait Player {
pub trait Player {
/// Next method
fn next(&self) -> zbus::Result<()>;

View file

@ -26,7 +26,7 @@ use zbus::proxy;
interface = "org.mpris.MediaPlayer2.Playlists",
default_path = "/org/mpris/MediaPlayer2"
)]
trait Playlists {
pub trait Playlists {
/// ActivatePlaylist method
fn activate_playlist(&self, playlist_id: &PlaylistId) -> zbus::Result<()>;

View file

@ -26,7 +26,7 @@ use zbus::proxy;
interface = "org.mpris.MediaPlayer2.TrackList",
default_path = "/org/mpris/MediaPlayer2"
)]
trait TrackList {
pub trait TrackList {
/// AddTrack method
fn add_track(&self, uri: &str, after_track: &TrackId, set_as_current: bool)
-> zbus::Result<()>;

View file

@ -25,9 +25,7 @@ pub enum PlaylistOrdering {
}
impl Type for PlaylistOrdering {
fn signature() -> Signature<'static> {
String::signature()
}
const SIGNATURE: &'static Signature = String::SIGNATURE;
}
impl<'a> TryFrom<Value<'a>> for PlaylistOrdering {

View file

@ -26,7 +26,7 @@ use zbus::proxy;
interface = "org.freedesktop.NetworkManager.AccessPoint",
default_service = "org.freedesktop.NetworkManager"
)]
trait AccessPoint {
pub trait AccessPoint {
/// Flags property
#[zbus(property)]
fn flags(&self) -> zbus::Result<u32>;

View file

@ -26,7 +26,7 @@ use zbus::proxy;
interface = "org.freedesktop.NetworkManager.Device.Wired",
default_service = "org.freedesktop.NetworkManager"
)]
trait WiredDevice {
pub trait WiredDevice {
/// Carrier property
#[zbus(property)]
fn carrier(&self) -> zbus::Result<bool>;

View file

@ -31,7 +31,7 @@ use zbus::{
default_service = "net.hadess.SwitcherooControl",
default_path = "/net/hadess/SwitcherooControl"
)]
trait SwitcherooControl {
pub trait SwitcherooControl {
/// GPUs property
#[zbus(property, name = "GPUs")]
fn gpus(

View file

@ -22,7 +22,7 @@ use zbus::proxy;
default_service = "org.freedesktop.timedate1",
default_path = "/org/freedesktop/timedate1"
)]
trait TimeDate {
pub trait TimeDate {
/// A list of time zones known on the local system as an array of names.
fn list_timezones(&self) -> zbus::Result<Vec<String>>;

View file

@ -68,7 +68,7 @@ pub enum BatteryLevel {
default_service = "org.freedesktop.UPower",
assume_defaults = false
)]
trait Device {
pub trait Device {
#[zbus(property)]
fn battery_level(&self) -> zbus::Result<BatteryLevel>;

View file

@ -8,7 +8,7 @@ use zbus::proxy;
interface = "org.freedesktop.UPower.KbdBacklight",
default_path = "/org/freedesktop/UPower/KbdBacklight"
)]
trait KbdBacklight {
pub trait KbdBacklight {
/// GetBrightness method
fn get_brightness(&self) -> zbus::Result<i32>;

View file

@ -6,7 +6,7 @@ use zbus::proxy;
use crate::device::{DeviceProxy, DeviceProxyBlocking};
#[proxy(interface = "org.freedesktop.UPower", assume_defaults = true)]
trait UPower {
pub trait UPower {
/// EnumerateDevices method
fn enumerate_devices(&self) -> zbus::Result<Vec<zbus::zvariant::OwnedObjectPath>>;