diff --git a/Cargo.toml b/Cargo.toml index 2a89b78..960915c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,5 +18,5 @@ futures-util = "0.3.30" serde = { version = "1.0", features = ["derive"] } thiserror = "1.0" time = { version = "0.3", features = ["parsing"] } -zbus = { version = "3.15.0" } -zvariant = { version = "3.15.0"} +zbus = { version = "4.2.1" } +zvariant = { version = "4.1.0"} diff --git a/cosmic-settings-daemon/src/lib.rs b/cosmic-settings-daemon/src/lib.rs index e4a59eb..7493f61 100644 --- a/cosmic-settings-daemon/src/lib.rs +++ b/cosmic-settings-daemon/src/lib.rs @@ -19,9 +19,9 @@ //! //! …consequently `zbus-xmlgen` did not generate code for the above interfaces. -use zbus::{dbus_proxy, names::OwnedWellKnownName}; +use zbus::{names::OwnedWellKnownName, proxy}; -#[dbus_proxy( +#[proxy( interface = "com.system76.CosmicSettingsDaemon", default_service = "com.system76.CosmicSettingsDaemon", default_path = "/com/system76/CosmicSettingsDaemon" @@ -54,22 +54,22 @@ trait CosmicSettingsDaemon { ) -> zbus::Result<(zbus::zvariant::OwnedObjectPath, OwnedWellKnownName)>; /// DisplayBrightness property - #[dbus_proxy(property)] + #[zbus(property)] fn display_brightness(&self) -> zbus::Result; fn set_display_brightness(&self, value: i32) -> zbus::Result<()>; /// KeyboardBrightness property - #[dbus_proxy(property)] + #[zbus(property)] fn keyboard_brightness(&self) -> zbus::Result; fn set_keyboard_brightness(&self, value: i32) -> zbus::Result<()>; } -#[dbus_proxy( +#[proxy( interface = "com.system76.CosmicSettingsDaemon.Config", default_service = "com.system76.CosmicSettingsDaemon.Config" )] trait Config { /// Changed signal - #[dbus_proxy(signal)] + #[zbus(signal)] async fn changed(&self, id: String, key: String) -> zbus::Result<()>; } diff --git a/geoclue2/src/lib.rs b/geoclue2/src/lib.rs index 723ef12..2584fa5 100644 --- a/geoclue2/src/lib.rs +++ b/geoclue2/src/lib.rs @@ -1,6 +1,6 @@ use serde_repr::{Deserialize_repr, Serialize_repr}; use zbus::{ - dbus_proxy, + proxy, zvariant::{ObjectPath, OwnedValue, Type}, Result, }; @@ -43,32 +43,32 @@ impl TryFrom for Accuracy { } } -#[dbus_proxy( +#[proxy( default_service = "org.freedesktop.GeoClue2", interface = "org.freedesktop.GeoClue2.Manager", default_path = "/org/freedesktop/GeoClue2/Manager" )] 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. - #[dbus_proxy(object = "Client")] + #[zbus(object = "Client")] fn get_client(&self); /// Use this method to explicitly destroy a client, created using GetClient() or CreateClient(). /// /// Long-running applications, should either use this to delete associated client(s) when not needed, or disconnect from the D-Bus connection used for communicating with Geoclue (which is implicit on client process termination). - #[dbus_proxy(object = "Client")] + #[zbus(object = "Client")] fn delete_client<'a>(&self, client: ObjectPath<'a>); /// InUse property - #[dbus_proxy(property)] + #[zbus(property)] fn in_use(&self) -> Result; /// AvailableAccuracyLevel property - #[dbus_proxy(property)] + #[zbus(property)] fn available_accuracy_level(&self) -> zbus::Result; } -#[dbus_proxy( +#[proxy( default_service = "org.freedesktop.GeoClue2", interface = "org.freedesktop.GeoClue2.Client" )] @@ -80,7 +80,7 @@ trait Client { fn stop(&self) -> zbus::Result<()>; /// LocationUpdated signal - #[dbus_proxy(signal)] + #[zbus(signal)] fn location_updated( &self, old: zbus::zvariant::ObjectPath<'_>, @@ -88,60 +88,60 @@ trait Client { ) -> zbus::Result<()>; /// Active property - #[dbus_proxy(property)] + #[zbus(property)] fn active(&self) -> zbus::Result; /// DesktopId property - #[dbus_proxy(property)] + #[zbus(property)] fn desktop_id(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn set_desktop_id(&self, value: &str) -> zbus::Result<()>; /// DistanceThreshold property - #[dbus_proxy(property)] + #[zbus(property)] fn distance_threshold(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn set_distance_threshold(&self, value: u32) -> zbus::Result<()>; /// Location property - #[dbus_proxy(property, object = "Location")] + #[zbus(property, object = "Location")] fn location(&self) -> zbus::Result; /// RequestedAccuracyLevel property - #[dbus_proxy(property)] + #[zbus(property)] fn requested_accuracy_level(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn set_requested_accuracy_level(&self, value: u32) -> zbus::Result<()>; /// TimeThreshold property - #[dbus_proxy(property)] + #[zbus(property)] fn time_threshold(&self) -> zbus::Result; fn set_time_threshold(&self, value: u32) -> zbus::Result<()>; } -#[dbus_proxy( +#[proxy( default_service = "org.freedesktop.GeoClue2", interface = "org.freedesktop.GeoClue2.Location" )] trait Location { /// The latitude of the location, in degrees. - #[dbus_proxy(property)] + #[zbus(property)] fn latitude(&self) -> Result; /// The longitude of the location, in degrees. - #[dbus_proxy(property)] + #[zbus(property)] fn longitude(&self) -> Result; /// The accuracy of the location fix, in meters. - #[dbus_proxy(property)] + #[zbus(property)] fn accuracy(&self) -> Result; /// The altitude of the location fix, in meters. /// When unknown, its set to minimum f64 value, -1.7976931348623157e+308. - #[dbus_proxy(property)] + #[zbus(property)] fn altitude(&self) -> Result; /// Speed in meters per second. /// When unknown, it's set to -1.0. - #[dbus_proxy(property)] + #[zbus(property)] fn speed(&self) -> Result; /// The heading direction in degrees with respect to North direction, in clockwise order. That means North becomes 0 degree, East: 90 degrees, South: 180 degrees, West: 270 degrees and so on. When unknown, it's set to -1.0. - #[dbus_proxy(property)] + #[zbus(property)] fn heading(&self) -> Result; } diff --git a/mpris2/src/bindings/media_player.rs b/mpris2/src/bindings/media_player.rs index 33f7c5f..80b5251 100644 --- a/mpris2/src/bindings/media_player.rs +++ b/mpris2/src/bindings/media_player.rs @@ -20,9 +20,9 @@ //! //! …consequently `zbus-xmlgen` did not generate code for the above interfaces. -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.mpris.MediaPlayer2", default_path = "/org/mpris/MediaPlayer2" )] @@ -34,30 +34,30 @@ trait MediaPlayer2 { fn raise(&self) -> zbus::Result<()>; /// CanQuit property - #[dbus_proxy(property)] + #[zbus(property)] fn can_quit(&self) -> zbus::Result; /// CanRaise property - #[dbus_proxy(property)] + #[zbus(property)] fn can_raise(&self) -> zbus::Result; /// DesktopEntry property - #[dbus_proxy(property)] + #[zbus(property)] fn desktop_entry(&self) -> zbus::Result; /// HasTrackList property - #[dbus_proxy(property)] + #[zbus(property)] fn has_track_list(&self) -> zbus::Result; /// Identity property - #[dbus_proxy(property)] + #[zbus(property)] fn identity(&self) -> zbus::Result; /// SupportedMimeTypes property - #[dbus_proxy(property)] + #[zbus(property)] fn supported_mime_types(&self) -> zbus::Result>; /// SupportedUriSchemes property - #[dbus_proxy(property)] + #[zbus(property)] fn supported_uri_schemes(&self) -> zbus::Result>; } diff --git a/mpris2/src/bindings/player.rs b/mpris2/src/bindings/player.rs index 9f2ae11..923f925 100644 --- a/mpris2/src/bindings/player.rs +++ b/mpris2/src/bindings/player.rs @@ -21,9 +21,9 @@ //! …consequently `zbus-xmlgen` did not generate code for the above interfaces. use crate::track::TrackId; -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.mpris.MediaPlayer2.Player", default_path = "/org/mpris/MediaPlayer2" )] @@ -56,76 +56,76 @@ trait Player { fn stop(&self) -> zbus::Result<()>; /// Seeked signal - #[dbus_proxy(signal)] + #[zbus(signal)] fn seeked(&self, position: i64) -> zbus::Result<()>; /// CanControl property - #[dbus_proxy(property)] + #[zbus(property)] fn can_control(&self) -> zbus::Result; /// CanGoNext property - #[dbus_proxy(property)] + #[zbus(property)] fn can_go_next(&self) -> zbus::Result; /// CanGoPrevious property - #[dbus_proxy(property)] + #[zbus(property)] fn can_go_previous(&self) -> zbus::Result; /// CanPause property - #[dbus_proxy(property)] + #[zbus(property)] fn can_pause(&self) -> zbus::Result; /// CanPlay property - #[dbus_proxy(property)] + #[zbus(property)] fn can_play(&self) -> zbus::Result; /// CanSeek property - #[dbus_proxy(property)] + #[zbus(property)] fn can_seek(&self) -> zbus::Result; /// MaximumRate property - #[dbus_proxy(property)] + #[zbus(property)] fn maximum_rate(&self) -> zbus::Result; /// Metadata property - #[dbus_proxy(property)] + #[zbus(property)] fn metadata( &self, ) -> zbus::Result>; /// MinimumRate property - #[dbus_proxy(property)] + #[zbus(property)] fn minimum_rate(&self) -> zbus::Result; /// PlaybackStatus property - #[dbus_proxy(property)] + #[zbus(property)] fn playback_status(&self) -> zbus::Result; /// Position property - #[dbus_proxy(property)] + #[zbus(property)] fn position(&self) -> zbus::Result; /// Rate property - #[dbus_proxy(property)] + #[zbus(property)] fn rate(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn set_rate(&self, value: f64) -> zbus::Result<()>; /// Shuffle property (optional) - #[dbus_proxy(property)] + #[zbus(property)] fn shuffle(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn set_shuffle(&self, value: bool) -> zbus::Result<()>; /// LoopStatus property (optional) - #[dbus_proxy(property)] + #[zbus(property)] fn loop_status(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn set_loop_status(&self, value: String) -> zbus::Result<()>; /// Volume property - #[dbus_proxy(property)] + #[zbus(property)] fn volume(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn set_volume(&self, value: f64) -> zbus::Result<()>; } diff --git a/mpris2/src/bindings/playlist.rs b/mpris2/src/bindings/playlist.rs index da667f9..b1f991a 100644 --- a/mpris2/src/bindings/playlist.rs +++ b/mpris2/src/bindings/playlist.rs @@ -20,9 +20,9 @@ //! …consequently `zbus-xmlgen` did not generate code for the above interfaces. use crate::playlists::{id::PlaylistId, ordering::PlaylistOrdering, playlist::Playlist}; -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.mpris.MediaPlayer2.Playlists", default_path = "/org/mpris/MediaPlayer2" )] @@ -40,18 +40,18 @@ trait Playlists { ) -> zbus::Result>; /// PlaylistChanged signal - #[dbus_proxy(signal)] + #[zbus(signal)] fn playlist_changed(&self, playlist: Playlist) -> zbus::Result<()>; /// ActivePlaylist property - #[dbus_proxy(property)] + #[zbus(property)] fn active_playlist(&self) -> zbus::Result<(bool, Playlist)>; /// Orderings property - #[dbus_proxy(property)] + #[zbus(property)] fn orderings(&self) -> zbus::Result>; /// PlaylistCount property - #[dbus_proxy(property)] + #[zbus(property)] fn playlist_count(&self) -> zbus::Result; } diff --git a/mpris2/src/bindings/track_list.rs b/mpris2/src/bindings/track_list.rs index 6b916e7..b40adfa 100644 --- a/mpris2/src/bindings/track_list.rs +++ b/mpris2/src/bindings/track_list.rs @@ -20,9 +20,9 @@ //! …consequently `zbus-xmlgen` did not generate code for the above interfaces. use crate::track::TrackId; -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.mpris.MediaPlayer2.TrackList", default_path = "/org/mpris/MediaPlayer2" )] @@ -44,15 +44,15 @@ trait TrackList { fn remove_track(&self, track_id: &TrackId) -> zbus::Result<()>; /// TrackListReplaced signal - #[dbus_proxy(signal)] + #[zbus(signal)] fn track_list_replaced(&self, tracks: Vec, current_track: TrackId) -> zbus::Result<()>; /// CanEditTracks property - #[dbus_proxy(property)] + #[zbus(property)] fn can_edit_tracks(&self) -> zbus::Result; /// Tracks property - #[dbus_proxy(property)] + #[zbus(property)] fn tracks(&self) -> zbus::Result>; } diff --git a/mpris2/src/media_player.rs b/mpris2/src/media_player.rs index 244b147..dd93f73 100644 --- a/mpris2/src/media_player.rs +++ b/mpris2/src/media_player.rs @@ -46,8 +46,8 @@ impl MediaPlayer { /// Returns an instance to the `org.mpris.MediaPlayer2.Player` interface of this object. pub async fn player(&self) -> Result { - PlayerProxy::builder(self.proxy.connection()) - .destination(self.proxy.destination().to_owned())? + PlayerProxy::builder(self.proxy.inner().connection()) + .destination(self.proxy.inner().destination().to_owned())? .build() .await .map(Player::from) @@ -58,8 +58,8 @@ impl MediaPlayer { /// if a track list is available. pub async fn track_list(&self) -> Result> { if self.proxy.has_track_list().await? { - TrackListProxy::builder(self.proxy.connection()) - .destination(self.proxy.destination().to_owned())? + TrackListProxy::builder(self.proxy.inner().connection()) + .destination(self.proxy.inner().destination().to_owned())? .build() .await .map(TrackList::from) @@ -74,8 +74,8 @@ impl MediaPlayer { /// if a track list is available. pub async fn playlists(&self) -> Result> { if self.proxy.has_track_list().await? { - PlaylistsProxy::builder(self.proxy.connection()) - .destination(self.proxy.destination().to_owned())? + PlaylistsProxy::builder(self.proxy.inner().connection()) + .destination(self.proxy.inner().destination().to_owned())? .build() .await .map(Playlists::from) diff --git a/mpris2/src/metadata.rs b/mpris2/src/metadata.rs index 44dadd3..704054b 100644 --- a/mpris2/src/metadata.rs +++ b/mpris2/src/metadata.rs @@ -448,27 +448,27 @@ impl MetadataValue { impl<'a> From<&ZValue<'a>> for MetadataValue { fn from(value: &ZValue) -> Self { - match value { - ZValue::U8(u) => Self::UInt(*u as u64), - ZValue::Bool(b) => Self::Bool(*b), - ZValue::I16(i) => Self::Int(*i as i64), - ZValue::U16(u) => Self::UInt(*u as u64), - ZValue::I32(i) => Self::Int(*i as i64), - ZValue::U32(u) => Self::UInt(*u as u64), - ZValue::I64(i) => Self::Int(*i), - ZValue::U64(u) => Self::UInt(*u), - ZValue::F64(f) => Self::Double(*f), - ZValue::Str(s) => Self::Str(s.to_string()), - ZValue::ObjectPath(path) => Self::Str(path.to_string()), - ZValue::Array(a) => Self::Array(a.iter().map(|v| v.into()).collect()), - ZValue::Dict(d) => Self::Dict( - HashMap::::try_from(d.to_owned()) + match value.try_clone() { + Ok(ZValue::U8(u)) => Self::UInt(u as u64), + Ok(ZValue::Bool(b)) => Self::Bool(b), + Ok(ZValue::I16(i)) => Self::Int(i as i64), + Ok(ZValue::U16(u)) => Self::UInt(u as u64), + Ok(ZValue::I32(i)) => Self::Int(i as i64), + Ok(ZValue::U32(u)) => Self::UInt(u as u64), + Ok(ZValue::I64(i)) => Self::Int(i), + Ok(ZValue::U64(u)) => Self::UInt(u), + Ok(ZValue::F64(f)) => Self::Double(f), + Ok(ZValue::Str(s)) => Self::Str(s.to_string()), + Ok(ZValue::ObjectPath(path)) => Self::Str(path.to_string()), + Ok(ZValue::Array(a)) => Self::Array(a.iter().map(|v| v.into()).collect()), + Ok(ZValue::Dict(d)) => Self::Dict( + HashMap::::try_from(d) .unwrap() .into_iter() .map(|(k, v)| (k, (&v).into())) .collect(), ), - ZValue::Value(value) => Self::from(&**value), + Ok(ZValue::Value(value)) => Self::from(&*value), _ => Self::__Unsupported, } } diff --git a/mpris2/src/player.rs b/mpris2/src/player.rs index 4ed4c7d..468a8d3 100644 --- a/mpris2/src/player.rs +++ b/mpris2/src/player.rs @@ -33,8 +33,8 @@ impl Player { /// Returns this player's `org.mpris.MediaPlayer2` instance pub async fn media_player(&self) -> Result { - let proxy = MediaPlayer2Proxy::builder(self.proxy.connection()) - .destination(self.proxy.destination().to_owned())? + let proxy = MediaPlayer2Proxy::builder(self.proxy.inner().connection()) + .destination(self.proxy.inner().destination().to_owned())? .build() .await?; Ok(proxy.into()) diff --git a/mpris2/src/playlists/ordering.rs b/mpris2/src/playlists/ordering.rs index 444dd23..432a7f0 100644 --- a/mpris2/src/playlists/ordering.rs +++ b/mpris2/src/playlists/ordering.rs @@ -8,7 +8,7 @@ use std::{ fmt::{self, Display}, str::FromStr, }; -use zvariant::{OwnedValue, Signature, Type, Value}; +use zvariant::{Signature, Type, Value}; #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum PlaylistOrdering { @@ -38,7 +38,9 @@ impl<'a> TryFrom> for PlaylistOrdering { Value::Str(value) => Self::from_str(&value), _ => Err(Error::IncorrectValue { wanted: "Str", - actual: OwnedValue::from(value), + actual: value + .try_to_owned() + .map_err(|e| Error::Zbus(zbus::Error::Variant(e)))?, }), } } diff --git a/networkmanager/src/active_connection.rs b/networkmanager/src/active_connection.rs index fb64f3a..dd5b315 100644 --- a/networkmanager/src/active_connection.rs +++ b/networkmanager/src/active_connection.rs @@ -21,7 +21,7 @@ impl<'a> ActiveConnection<'a> { let devices = self.0.devices().await?; let mut out = Vec::with_capacity(devices.len()); for device in devices { - let device = DeviceProxy::builder(self.0.connection()) + let device = DeviceProxy::builder(self.0.inner().connection()) .path(device)? .build() .await?; @@ -31,7 +31,7 @@ impl<'a> ActiveConnection<'a> { } pub async fn ip4_config(&self) -> Result> { - let config = Ipv4ConfigProxy::builder(self.0.connection()) + let config = Ipv4ConfigProxy::builder(self.0.inner().connection()) .path(self.0.ip4_config().await?)? .build() .await?; @@ -39,7 +39,7 @@ impl<'a> ActiveConnection<'a> { } pub async fn ip6_config(&self) -> Result> { - let config = Ipv6ConfigProxy::builder(self.0.connection()) + let config = Ipv6ConfigProxy::builder(self.0.inner().connection()) .path(self.0.ip6_config().await?)? .build() .await?; diff --git a/networkmanager/src/config/ip4.rs b/networkmanager/src/config/ip4.rs index 816ea68..a6bcda6 100644 --- a/networkmanager/src/config/ip4.rs +++ b/networkmanager/src/config/ip4.rs @@ -30,7 +30,7 @@ impl<'a> Ipv4Config<'a> { .filter_map(|mut map| { let address = { let address_str = map.remove("address")?; - let address_str = address_str.downcast_ref()?; + let address_str = address_str.downcast_ref().ok()?; Ipv4Addr::from_str(address_str).ok()? }; let prefix = u32::try_from(map.remove("prefix")?).ok()?; diff --git a/networkmanager/src/config/ip6.rs b/networkmanager/src/config/ip6.rs index 698401c..2f1f28d 100644 --- a/networkmanager/src/config/ip6.rs +++ b/networkmanager/src/config/ip6.rs @@ -29,7 +29,7 @@ impl<'a> Ipv6Config<'a> { .filter_map(|mut map| { let address = { let address_str = map.remove("address")?; - let address_str = address_str.downcast_ref()?; + let address_str = address_str.downcast_ref().ok()?; Ipv6Addr::from_str(address_str).ok()? }; let prefix = u32::try_from(map.remove("prefix")?).ok()?; diff --git a/networkmanager/src/device.rs b/networkmanager/src/device.rs index 87dae05..c173d21 100644 --- a/networkmanager/src/device.rs +++ b/networkmanager/src/device.rs @@ -28,7 +28,7 @@ pub struct Device<'a>(DeviceProxy<'a>); impl<'a> Device<'a> { pub async fn active_connection(&self) -> Result> { let active_connection = self.0.active_connection().await?; - Ok(ActiveConnectionProxy::builder(self.0.connection()) + Ok(ActiveConnectionProxy::builder(self.0.inner().connection()) .path(active_connection)? .build() .await? @@ -39,7 +39,7 @@ impl<'a> Device<'a> { let available_connections = self.0.available_connections().await?; let mut out = Vec::with_capacity(available_connections.len()); for connection in available_connections { - let connection = ActiveConnectionProxy::builder(self.0.connection()) + let connection = ActiveConnectionProxy::builder(self.0.inner().connection()) .path(connection)? .build() .await?; @@ -62,36 +62,36 @@ impl<'a> Device<'a> { pub async fn downcast_to_device(&'a self) -> Result>> { match self.device_type().await? { DeviceType::Bluetooth => Ok(Some(SpecificDevice::Bluetooth( - BluetoothDeviceProxy::builder(self.0.connection()) - .path(self.0.path())? + BluetoothDeviceProxy::builder(self.0.inner().connection()) + .path(self.0.inner().path())? .build() .await? .into(), ))), DeviceType::Ethernet => Ok(Some(SpecificDevice::Wired( - WiredDeviceProxy::builder(self.0.connection()) - .path(self.0.path())? + WiredDeviceProxy::builder(self.0.inner().connection()) + .path(self.0.inner().path())? .build() .await? .into(), ))), DeviceType::Wifi => Ok(Some(SpecificDevice::Wireless( - WirelessDeviceProxy::builder(self.0.connection()) - .path(self.0.path())? + WirelessDeviceProxy::builder(self.0.inner().connection()) + .path(self.0.inner().path())? .build() .await? .into(), ))), DeviceType::TunTap => Ok(Some(SpecificDevice::TunTap( - TunDeviceProxy::builder(self.0.connection()) - .path(self.0.path())? + TunDeviceProxy::builder(self.0.inner().connection()) + .path(self.0.inner().path())? .build() .await? .into(), ))), DeviceType::WireGuard => Ok(Some(SpecificDevice::WireGuard( - WireGuardDeviceProxy::builder(self.0.connection()) - .path(self.0.path())? + WireGuardDeviceProxy::builder(self.0.inner().connection()) + .path(self.0.inner().path())? .build() .await? .into(), @@ -105,7 +105,7 @@ impl<'a> Device<'a> { } pub async fn ip4_config(&self) -> Result> { - let config = Ipv4ConfigProxy::builder(self.0.connection()) + let config = Ipv4ConfigProxy::builder(self.0.inner().connection()) .path(self.0.ip4_config().await?)? .build() .await?; @@ -113,7 +113,7 @@ impl<'a> Device<'a> { } pub async fn ip6_config(&self) -> Result> { - let config = Ipv6ConfigProxy::builder(self.0.connection()) + let config = Ipv6ConfigProxy::builder(self.0.inner().connection()) .path(self.0.ip6_config().await?)? .build() .await?; diff --git a/networkmanager/src/device/bluetooth.rs b/networkmanager/src/device/bluetooth.rs index 2607313..bb50705 100644 --- a/networkmanager/src/device/bluetooth.rs +++ b/networkmanager/src/device/bluetooth.rs @@ -10,8 +10,8 @@ pub struct BluetoothDevice<'a>(BluetoothDeviceProxy<'a>); impl<'a> BluetoothDevice<'a> { pub async fn upcast(&'a self) -> Result> { - DeviceProxy::builder(self.0.connection()) - .path(self.0.path())? + DeviceProxy::builder(self.0.inner().connection()) + .path(self.0.inner().path())? .build() .await .map(Device::from) diff --git a/networkmanager/src/device/tun.rs b/networkmanager/src/device/tun.rs index b6fb6a3..7310285 100644 --- a/networkmanager/src/device/tun.rs +++ b/networkmanager/src/device/tun.rs @@ -10,8 +10,8 @@ pub struct TunDevice<'a>(TunDeviceProxy<'a>); impl<'a> TunDevice<'a> { pub async fn upcast(&'a self) -> Result> { - DeviceProxy::builder(self.0.connection()) - .path(self.0.path())? + DeviceProxy::builder(self.0.inner().connection()) + .path(self.0.inner().path())? .build() .await .map(Device::from) diff --git a/networkmanager/src/device/wired.rs b/networkmanager/src/device/wired.rs index 33427bf..098250a 100644 --- a/networkmanager/src/device/wired.rs +++ b/networkmanager/src/device/wired.rs @@ -10,8 +10,8 @@ pub struct WiredDevice<'a>(WiredDeviceProxy<'a>); impl<'a> WiredDevice<'a> { pub async fn upcast(&'a self) -> Result> { - DeviceProxy::builder(self.0.connection()) - .path(self.0.path())? + DeviceProxy::builder(self.0.inner().connection()) + .path(self.0.inner().path())? .build() .await .map(Device::from) diff --git a/networkmanager/src/device/wireguard.rs b/networkmanager/src/device/wireguard.rs index 4668cc3..1d82428 100644 --- a/networkmanager/src/device/wireguard.rs +++ b/networkmanager/src/device/wireguard.rs @@ -10,8 +10,8 @@ pub struct WireGuardDevice<'a>(WireGuardDeviceProxy<'a>); impl<'a> WireGuardDevice<'a> { pub async fn upcast(&'a self) -> Result> { - DeviceProxy::builder(self.0.connection()) - .path(self.0.path())? + DeviceProxy::builder(self.0.inner().connection()) + .path(self.0.inner().path())? .build() .await .map(Device::from) diff --git a/networkmanager/src/device/wireless.rs b/networkmanager/src/device/wireless.rs index a904e41..ee7a0ff 100644 --- a/networkmanager/src/device/wireless.rs +++ b/networkmanager/src/device/wireless.rs @@ -20,7 +20,7 @@ impl<'a> WirelessDevice<'a> { let access_points = self.0.get_access_points().await?; let mut out = Vec::with_capacity(access_points.len()); for access_point in access_points { - let access_point = AccessPointProxy::builder(self.0.connection()) + let access_point = AccessPointProxy::builder(self.0.inner().connection()) .path(access_point)? .build() .await?; @@ -33,7 +33,7 @@ impl<'a> WirelessDevice<'a> { let access_points = self.0.get_all_access_points().await?; let mut out = Vec::with_capacity(access_points.len()); for access_point in access_points { - let access_point = AccessPointProxy::builder(self.0.connection()) + let access_point = AccessPointProxy::builder(self.0.inner().connection()) .path(access_point)? .build() .await?; @@ -46,7 +46,7 @@ impl<'a> WirelessDevice<'a> { let access_points = self.0.access_points().await?; let mut out = Vec::with_capacity(access_points.len()); for access_point in access_points { - let access_point = AccessPointProxy::builder(self.0.connection()) + let access_point = AccessPointProxy::builder(self.0.inner().connection()) .path(access_point)? .build() .await?; @@ -56,7 +56,7 @@ impl<'a> WirelessDevice<'a> { } pub async fn active_access_point(&self) -> Result> { - AccessPointProxy::builder(self.0.connection()) + AccessPointProxy::builder(self.0.inner().connection()) .path(self.0.active_access_point().await?)? .build() .await @@ -64,8 +64,8 @@ impl<'a> WirelessDevice<'a> { } pub async fn upcast(&'a self) -> Result> { - DeviceProxy::builder(self.0.connection()) - .path(self.0.path())? + DeviceProxy::builder(self.0.inner().connection()) + .path(self.0.inner().path())? .build() .await .map(Device::from) diff --git a/networkmanager/src/interface/access_point.rs b/networkmanager/src/interface/access_point.rs index 043759a..02473be 100644 --- a/networkmanager/src/interface/access_point.rs +++ b/networkmanager/src/interface/access_point.rs @@ -20,50 +20,50 @@ //! //! …consequently `zbus-xmlgen` did not generate code for the above interfaces. -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.freedesktop.NetworkManager.AccessPoint", default_service = "org.freedesktop.NetworkManager" )] trait AccessPoint { /// Flags property - #[dbus_proxy(property)] + #[zbus(property)] fn flags(&self) -> zbus::Result; /// Frequency property - #[dbus_proxy(property)] + #[zbus(property)] fn frequency(&self) -> zbus::Result; /// HwAddress property - #[dbus_proxy(property)] + #[zbus(property)] fn hw_address(&self) -> zbus::Result; /// LastSeen property - #[dbus_proxy(property)] + #[zbus(property)] fn last_seen(&self) -> zbus::Result; /// MaxBitrate property - #[dbus_proxy(property)] + #[zbus(property)] fn max_bitrate(&self) -> zbus::Result; /// Mode property - #[dbus_proxy(property)] + #[zbus(property)] fn mode(&self) -> zbus::Result; /// RsnFlags property - #[dbus_proxy(property)] + #[zbus(property)] fn rsn_flags(&self) -> zbus::Result; /// Ssid property - #[dbus_proxy(property)] + #[zbus(property)] fn ssid(&self) -> zbus::Result>; /// Strength property - #[dbus_proxy(property)] + #[zbus(property)] fn strength(&self) -> zbus::Result; /// WpaFlags property - #[dbus_proxy(property)] + #[zbus(property)] fn wpa_flags(&self) -> zbus::Result; } diff --git a/networkmanager/src/interface/active_connection.rs b/networkmanager/src/interface/active_connection.rs index d16d6bf..1231dc6 100644 --- a/networkmanager/src/interface/active_connection.rs +++ b/networkmanager/src/interface/active_connection.rs @@ -20,74 +20,74 @@ //! //! …consequently `zbus-xmlgen` did not generate code for the above interfaces. -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.freedesktop.NetworkManager.Connection.Active", default_service = "org.freedesktop.NetworkManager" )] pub trait ActiveConnection { /// Connection property - #[dbus_proxy(property)] + #[zbus(property)] fn connection_(&self) -> zbus::Result; /// Default property - #[dbus_proxy(property)] + #[zbus(property)] fn default(&self) -> zbus::Result; /// Default6 property - #[dbus_proxy(property)] + #[zbus(property)] fn default6(&self) -> zbus::Result; /// Devices property - #[dbus_proxy(property)] + #[zbus(property)] fn devices(&self) -> zbus::Result>; /// Dhcp4Config property - #[dbus_proxy(property)] + #[zbus(property)] fn dhcp4_config(&self) -> zbus::Result; /// Dhcp6Config property - #[dbus_proxy(property)] + #[zbus(property)] fn dhcp6_config(&self) -> zbus::Result; /// Id property - #[dbus_proxy(property)] + #[zbus(property)] fn id(&self) -> zbus::Result; /// Ip4Config property - #[dbus_proxy(property)] + #[zbus(property)] fn ip4_config(&self) -> zbus::Result; /// Ip6Config property - #[dbus_proxy(property)] + #[zbus(property)] fn ip6_config(&self) -> zbus::Result; /// Master property - #[dbus_proxy(property)] + #[zbus(property)] fn master(&self) -> zbus::Result; /// SpecificObject property - #[dbus_proxy(property)] + #[zbus(property)] fn specific_object(&self) -> zbus::Result; /// State property - #[dbus_proxy(property)] + #[zbus(property)] fn state(&self) -> zbus::Result; /// StateFlags property - #[dbus_proxy(property)] + #[zbus(property)] fn state_flags(&self) -> zbus::Result; /// Type property - #[dbus_proxy(property)] + #[zbus(property)] fn type_(&self) -> zbus::Result; /// Uuid property - #[dbus_proxy(property)] + #[zbus(property)] fn uuid(&self) -> zbus::Result; /// Vpn property - #[dbus_proxy(property)] + #[zbus(property)] fn vpn(&self) -> zbus::Result; } diff --git a/networkmanager/src/interface/config/ip4.rs b/networkmanager/src/interface/config/ip4.rs index 49c7405..674e476 100644 --- a/networkmanager/src/interface/config/ip4.rs +++ b/networkmanager/src/interface/config/ip4.rs @@ -20,68 +20,68 @@ //! //! …consequently `zbus-xmlgen` did not generate code for the above interfaces. -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.freedesktop.NetworkManager.IP4Config", default_service = "org.freedesktop.NetworkManager" )] pub trait Ipv4Config { /// AddressData property - #[dbus_proxy(property)] + #[zbus(property)] fn address_data( &self, ) -> zbus::Result>>; /// Addresses property - #[dbus_proxy(property)] + #[zbus(property)] fn addresses(&self) -> zbus::Result>>; /// DnsOptions property - #[dbus_proxy(property)] + #[zbus(property)] fn dns_options(&self) -> zbus::Result>; /// DnsPriority property - #[dbus_proxy(property)] + #[zbus(property)] fn dns_priority(&self) -> zbus::Result; /// Domains property - #[dbus_proxy(property)] + #[zbus(property)] fn domains(&self) -> zbus::Result>; /// Gateway property - #[dbus_proxy(property)] + #[zbus(property)] fn gateway(&self) -> zbus::Result; /// NameserverData property - #[dbus_proxy(property)] + #[zbus(property)] fn nameserver_data( &self, ) -> zbus::Result>>; /// Nameservers property - #[dbus_proxy(property)] + #[zbus(property)] fn nameservers(&self) -> zbus::Result>; /// RouteData property - #[dbus_proxy(property)] + #[zbus(property)] fn route_data( &self, ) -> zbus::Result>>; /// Routes property - #[dbus_proxy(property)] + #[zbus(property)] fn routes(&self) -> zbus::Result>>; /// Searches property - #[dbus_proxy(property)] + #[zbus(property)] fn searches(&self) -> zbus::Result>; /// WinsServerData property - #[dbus_proxy(property)] + #[zbus(property)] fn wins_server_data(&self) -> zbus::Result>; /// WinsServers property - #[dbus_proxy(property)] + #[zbus(property)] fn wins_servers(&self) -> zbus::Result>; } diff --git a/networkmanager/src/interface/config/ip6.rs b/networkmanager/src/interface/config/ip6.rs index ee0f600..fbfc999 100644 --- a/networkmanager/src/interface/config/ip6.rs +++ b/networkmanager/src/interface/config/ip6.rs @@ -20,54 +20,54 @@ //! //! …consequently `zbus-xmlgen` did not generate code for the above interfaces. -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.freedesktop.NetworkManager.IP6Config", default_service = "org.freedesktop.NetworkManager" )] pub trait Ipv6Config { /// AddressData property - #[dbus_proxy(property)] + #[zbus(property)] fn address_data( &self, ) -> zbus::Result>>; /// Addresses property - #[dbus_proxy(property)] + #[zbus(property)] fn addresses(&self) -> zbus::Result, u32, Vec)>>; /// DnsOptions property - #[dbus_proxy(property)] + #[zbus(property)] fn dns_options(&self) -> zbus::Result>; /// DnsPriority property - #[dbus_proxy(property)] + #[zbus(property)] fn dns_priority(&self) -> zbus::Result; /// Domains property - #[dbus_proxy(property)] + #[zbus(property)] fn domains(&self) -> zbus::Result>; /// Gateway property - #[dbus_proxy(property)] + #[zbus(property)] fn gateway(&self) -> zbus::Result; /// Nameservers property - #[dbus_proxy(property)] + #[zbus(property)] fn nameservers(&self) -> zbus::Result>>; /// RouteData property - #[dbus_proxy(property)] + #[zbus(property)] fn route_data( &self, ) -> zbus::Result>>; /// Routes property - #[dbus_proxy(property)] + #[zbus(property)] fn routes(&self) -> zbus::Result, u32, Vec, u32)>>; /// Searches property - #[dbus_proxy(property)] + #[zbus(property)] fn searches(&self) -> zbus::Result>; } diff --git a/networkmanager/src/interface/device.rs b/networkmanager/src/interface/device.rs index e3fa403..b85daad 100644 --- a/networkmanager/src/interface/device.rs +++ b/networkmanager/src/interface/device.rs @@ -26,23 +26,23 @@ pub mod wired; pub mod wireguard; pub mod wireless; -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.freedesktop.NetworkManager.Device.Generic", default_service = "org.freedesktop.NetworkManager" )] pub trait GenericDevice { /// HwAddress property - #[dbus_proxy(property)] + #[zbus(property)] fn hw_address(&self) -> zbus::Result; /// TypeDescription property - #[dbus_proxy(property)] + #[zbus(property)] fn type_description(&self) -> zbus::Result; } -#[dbus_proxy( +#[proxy( interface = "org.freedesktop.NetworkManager.Device", default_service = "org.freedesktop.NetworkManager" )] @@ -77,132 +77,132 @@ pub trait Device { ) -> zbus::Result<()>; /// ActiveConnection property - #[dbus_proxy(property)] + #[zbus(property)] fn active_connection(&self) -> zbus::Result; /// Autoconnect property - #[dbus_proxy(property)] + #[zbus(property)] fn autoconnect(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn set_autoconnect(&self, value: bool) -> zbus::Result<()>; /// AvailableConnections property - #[dbus_proxy(property)] + #[zbus(property)] fn available_connections(&self) -> zbus::Result>; /// Capabilities property - #[dbus_proxy(property)] + #[zbus(property)] fn capabilities(&self) -> zbus::Result; /// DeviceType property - #[dbus_proxy(property)] + #[zbus(property)] fn device_type(&self) -> zbus::Result; /// Dhcp4Config property - #[dbus_proxy(property)] + #[zbus(property)] fn dhcp4_config(&self) -> zbus::Result; /// Dhcp6Config property - #[dbus_proxy(property)] + #[zbus(property)] fn dhcp6_config(&self) -> zbus::Result; /// Driver property - #[dbus_proxy(property)] + #[zbus(property)] fn driver(&self) -> zbus::Result; /// DriverVersion property - #[dbus_proxy(property)] + #[zbus(property)] fn driver_version(&self) -> zbus::Result; /// FirmwareMissing property - #[dbus_proxy(property)] + #[zbus(property)] fn firmware_missing(&self) -> zbus::Result; /// FirmwareVersion property - #[dbus_proxy(property)] + #[zbus(property)] fn firmware_version(&self) -> zbus::Result; /// HwAddress property - #[dbus_proxy(property)] + #[zbus(property)] fn hw_address(&self) -> zbus::Result; /// Interface property - #[dbus_proxy(property)] + #[zbus(property)] fn interface(&self) -> zbus::Result; /// InterfaceFlags property - #[dbus_proxy(property)] + #[zbus(property)] fn interface_flags(&self) -> zbus::Result; /// Ip4Address property - #[dbus_proxy(property)] + #[zbus(property)] fn ip4_address(&self) -> zbus::Result; /// Ip4Config property - #[dbus_proxy(property)] + #[zbus(property)] fn ip4_config(&self) -> zbus::Result; /// Ip4Connectivity property - #[dbus_proxy(property)] + #[zbus(property)] fn ip4_connectivity(&self) -> zbus::Result; /// Ip6Config property - #[dbus_proxy(property)] + #[zbus(property)] fn ip6_config(&self) -> zbus::Result; /// Ip6Connectivity property - #[dbus_proxy(property)] + #[zbus(property)] fn ip6_connectivity(&self) -> zbus::Result; /// IpInterface property - #[dbus_proxy(property)] + #[zbus(property)] fn ip_interface(&self) -> zbus::Result; /// LldpNeighbors property - #[dbus_proxy(property)] + #[zbus(property)] fn lldp_neighbors( &self, ) -> zbus::Result>>; /// Managed property - #[dbus_proxy(property)] + #[zbus(property)] fn managed(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn set_managed(&self, value: bool) -> zbus::Result<()>; /// Metered property - #[dbus_proxy(property)] + #[zbus(property)] fn metered(&self) -> zbus::Result; /// Mtu property - #[dbus_proxy(property)] + #[zbus(property)] fn mtu(&self) -> zbus::Result; /// NmPluginMissing property - #[dbus_proxy(property)] + #[zbus(property)] fn nm_plugin_missing(&self) -> zbus::Result; /// Path property - #[dbus_proxy(property)] + #[zbus(property)] fn path_(&self) -> zbus::Result; /// PhysicalPortId property - #[dbus_proxy(property)] + #[zbus(property)] fn physical_port_id(&self) -> zbus::Result; /// Real property - #[dbus_proxy(property)] + #[zbus(property)] fn real(&self) -> zbus::Result; /// State property - #[dbus_proxy(property)] + #[zbus(property)] fn state(&self) -> zbus::Result; /// StateReason property - #[dbus_proxy(property)] + #[zbus(property)] fn state_reason(&self) -> zbus::Result<(u32, u32)>; /// Udi property - #[dbus_proxy(property)] + #[zbus(property)] fn udi(&self) -> zbus::Result; } diff --git a/networkmanager/src/interface/device/bluetooth.rs b/networkmanager/src/interface/device/bluetooth.rs index 740e9a7..d6a7054 100644 --- a/networkmanager/src/interface/device/bluetooth.rs +++ b/networkmanager/src/interface/device/bluetooth.rs @@ -11,22 +11,22 @@ //! section of the zbus documentation. //! -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.freedesktop.NetworkManager.Device.Bluetooth", default_service = "org.freedesktop.NetworkManager" )] pub trait BluetoothDevice { /// BtCapabilities property - #[dbus_proxy(property)] + #[zbus(property)] fn bt_capabilities(&self) -> zbus::Result; /// HwAddress property - #[dbus_proxy(property)] + #[zbus(property)] fn hw_address(&self) -> zbus::Result; /// Name property - #[dbus_proxy(property)] + #[zbus(property)] fn name(&self) -> zbus::Result; } diff --git a/networkmanager/src/interface/device/tun.rs b/networkmanager/src/interface/device/tun.rs index 754e0db..a7d7363 100644 --- a/networkmanager/src/interface/device/tun.rs +++ b/networkmanager/src/interface/device/tun.rs @@ -11,38 +11,38 @@ //! section of the zbus documentation. //! -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.freedesktop.NetworkManager.Device.Tun", default_service = "org.freedesktop.NetworkManager" )] pub trait TunDevice { /// Group property - #[dbus_proxy(property)] + #[zbus(property)] fn group(&self) -> zbus::Result; /// HwAddress property - #[dbus_proxy(property)] + #[zbus(property)] fn hw_address(&self) -> zbus::Result; /// Mode property - #[dbus_proxy(property)] + #[zbus(property)] fn mode(&self) -> zbus::Result; /// MultiQueue property - #[dbus_proxy(property)] + #[zbus(property)] fn multi_queue(&self) -> zbus::Result; /// NoPi property - #[dbus_proxy(property)] + #[zbus(property)] fn no_pi(&self) -> zbus::Result; /// Owner property - #[dbus_proxy(property)] + #[zbus(property)] fn owner(&self) -> zbus::Result; /// VnetHdr property - #[dbus_proxy(property)] + #[zbus(property)] fn vnet_hdr(&self) -> zbus::Result; } diff --git a/networkmanager/src/interface/device/wired.rs b/networkmanager/src/interface/device/wired.rs index 8f7311a..b31097f 100644 --- a/networkmanager/src/interface/device/wired.rs +++ b/networkmanager/src/interface/device/wired.rs @@ -20,30 +20,30 @@ //! //! …consequently `zbus-xmlgen` did not generate code for the above interfaces. -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.freedesktop.NetworkManager.Device.Wired", default_service = "org.freedesktop.NetworkManager" )] trait WiredDevice { /// Carrier property - #[dbus_proxy(property)] + #[zbus(property)] fn carrier(&self) -> zbus::Result; /// HwAddress property - #[dbus_proxy(property)] + #[zbus(property)] fn hw_address(&self) -> zbus::Result; /// PermHwAddress property - #[dbus_proxy(property)] + #[zbus(property)] fn perm_hw_address(&self) -> zbus::Result; /// S390Subchannels property - #[dbus_proxy(property)] + #[zbus(property)] fn s390subchannels(&self) -> zbus::Result>; /// Speed property - #[dbus_proxy(property)] + #[zbus(property)] fn speed(&self) -> zbus::Result; } diff --git a/networkmanager/src/interface/device/wireguard.rs b/networkmanager/src/interface/device/wireguard.rs index de86c2d..5f5a587 100644 --- a/networkmanager/src/interface/device/wireguard.rs +++ b/networkmanager/src/interface/device/wireguard.rs @@ -11,22 +11,22 @@ //! section of the zbus documentation. //! -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.freedesktop.NetworkManager.Device.WireGuard", default_service = "org.freedesktop.NetworkManager" )] pub trait WireGuardDevice { /// FwMark property - #[dbus_proxy(property)] + #[zbus(property)] fn fw_mark(&self) -> zbus::Result; /// ListenPort property - #[dbus_proxy(property)] + #[zbus(property)] fn listen_port(&self) -> zbus::Result; /// PublicKey property - #[dbus_proxy(property)] + #[zbus(property)] fn public_key(&self) -> zbus::Result>; } diff --git a/networkmanager/src/interface/device/wireless.rs b/networkmanager/src/interface/device/wireless.rs index dd915fd..df2d815 100644 --- a/networkmanager/src/interface/device/wireless.rs +++ b/networkmanager/src/interface/device/wireless.rs @@ -20,9 +20,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.NetworkManager.Device.Wireless", default_service = "org.freedesktop.NetworkManager" )] @@ -40,45 +40,45 @@ pub trait WirelessDevice { ) -> zbus::Result<()>; /// AccessPointAdded signal - #[dbus_proxy(signal)] + #[zbus(signal)] fn access_point_added(&self, access_point: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>; /// AccessPointRemoved signal - #[dbus_proxy(signal)] + #[zbus(signal)] fn access_point_removed( &self, access_point: zbus::zvariant::ObjectPath<'_>, ) -> zbus::Result<()>; /// AccessPoints property - #[dbus_proxy(property)] + #[zbus(property)] fn access_points(&self) -> zbus::Result>; /// ActiveAccessPoint property - #[dbus_proxy(property)] + #[zbus(property)] fn active_access_point(&self) -> zbus::Result; /// Bitrate property - #[dbus_proxy(property)] + #[zbus(property)] fn bitrate(&self) -> zbus::Result; /// HwAddress property - #[dbus_proxy(property)] + #[zbus(property)] fn hw_address(&self) -> zbus::Result; /// LastScan property - #[dbus_proxy(property)] + #[zbus(property)] fn last_scan(&self) -> zbus::Result; /// Mode property - #[dbus_proxy(property)] + #[zbus(property)] fn mode(&self) -> zbus::Result; /// PermHwAddress property - #[dbus_proxy(property)] + #[zbus(property)] fn perm_hw_address(&self) -> zbus::Result; /// WirelessCapabilities property - #[dbus_proxy(property)] + #[zbus(property)] fn wireless_capabilities(&self) -> zbus::Result; } diff --git a/networkmanager/src/interface/mod.rs b/networkmanager/src/interface/mod.rs index 69f8ca4..903edce 100644 --- a/networkmanager/src/interface/mod.rs +++ b/networkmanager/src/interface/mod.rs @@ -29,9 +29,9 @@ pub mod enums; pub mod settings; pub mod statistics; -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.freedesktop.NetworkManager", default_service = "org.freedesktop.NetworkManager", default_path = "/org/freedesktop/NetworkManager" @@ -136,125 +136,125 @@ pub trait NetworkManager { fn sleep(&self, sleep: bool) -> zbus::Result<()>; /// CheckPermissions signal - #[dbus_proxy(signal)] + #[zbus(signal)] fn check_permissions(&self) -> zbus::Result<()>; /// DeviceAdded signal - #[dbus_proxy(signal)] + #[zbus(signal)] fn device_added(&self, device_path: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>; /// DeviceRemoved signal - #[dbus_proxy(signal)] + #[zbus(signal)] fn device_removed(&self, device_path: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>; /// ActivatingConnection property - #[dbus_proxy(property)] + #[zbus(property)] fn activating_connection(&self) -> zbus::Result; /// ActiveConnections property - #[dbus_proxy(property)] + #[zbus(property)] fn active_connections(&self) -> zbus::Result>; /// AllDevices property - #[dbus_proxy(property)] + #[zbus(property)] fn all_devices(&self) -> zbus::Result>; /// Capabilities property - #[dbus_proxy(property)] + #[zbus(property)] fn capabilities(&self) -> zbus::Result>; /// Checkpoints property - #[dbus_proxy(property)] + #[zbus(property)] fn checkpoints(&self) -> zbus::Result>; /// Connectivity property - #[dbus_proxy(property)] + #[zbus(property)] fn connectivity(&self) -> zbus::Result; /// ConnectivityCheckAvailable property - #[dbus_proxy(property)] + #[zbus(property)] fn connectivity_check_available(&self) -> zbus::Result; /// ConnectivityCheckEnabled property - #[dbus_proxy(property)] + #[zbus(property)] fn connectivity_check_enabled(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn set_connectivity_check_enabled(&self, value: bool) -> zbus::Result<()>; /// ConnectivityCheckUri property - #[dbus_proxy(property)] + #[zbus(property)] fn connectivity_check_uri(&self) -> zbus::Result; /// Devices property - #[dbus_proxy(property)] + #[zbus(property)] fn devices(&self) -> zbus::Result>; /// GlobalDnsConfiguration property - #[dbus_proxy(property)] + #[zbus(property)] fn global_dns_configuration( &self, ) -> zbus::Result>; - #[dbus_proxy(property)] + #[zbus(property)] fn set_global_dns_configuration( &self, value: std::collections::HashMap<&str, zbus::zvariant::Value<'_>>, ) -> zbus::Result<()>; /// Metered property - #[dbus_proxy(property)] + #[zbus(property)] fn metered(&self) -> zbus::Result; /// NetworkingEnabled property - #[dbus_proxy(property)] + #[zbus(property)] fn networking_enabled(&self) -> zbus::Result; /// PrimaryConnection property - #[dbus_proxy(property)] + #[zbus(property)] fn primary_connection(&self) -> zbus::Result; /// PrimaryConnectionType property - #[dbus_proxy(property)] + #[zbus(property)] fn primary_connection_type(&self) -> zbus::Result; /// Startup property - #[dbus_proxy(property)] + #[zbus(property)] fn startup(&self) -> zbus::Result; /// State property - #[dbus_proxy(property)] + #[zbus(property)] fn state(&self) -> zbus::Result; /// Version property - #[dbus_proxy(property)] + #[zbus(property)] fn version(&self) -> zbus::Result; /// WimaxEnabled property - #[dbus_proxy(property)] + #[zbus(property)] fn wimax_enabled(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn set_wimax_enabled(&self, value: bool) -> zbus::Result<()>; /// WimaxHardwareEnabled property - #[dbus_proxy(property)] + #[zbus(property)] fn wimax_hardware_enabled(&self) -> zbus::Result; /// WirelessEnabled property - #[dbus_proxy(property)] + #[zbus(property)] fn wireless_enabled(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn set_wireless_enabled(&self, value: bool) -> zbus::Result<()>; /// WirelessHardwareEnabled property - #[dbus_proxy(property)] + #[zbus(property)] fn wireless_hardware_enabled(&self) -> zbus::Result; /// WwanEnabled property - #[dbus_proxy(property)] + #[zbus(property)] fn wwan_enabled(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn set_wwan_enabled(&self, value: bool) -> zbus::Result<()>; /// WwanHardwareEnabled property - #[dbus_proxy(property)] + #[zbus(property)] fn wwan_hardware_enabled(&self) -> zbus::Result; } diff --git a/networkmanager/src/interface/settings.rs b/networkmanager/src/interface/settings.rs index fcdd08e..371081c 100644 --- a/networkmanager/src/interface/settings.rs +++ b/networkmanager/src/interface/settings.rs @@ -22,9 +22,9 @@ pub mod connection; -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.freedesktop.NetworkManager.Settings", default_service = "org.freedesktop.NetworkManager", default_path = "/org/freedesktop/NetworkManager/Settings" @@ -78,22 +78,22 @@ pub trait Settings { fn save_hostname(&self, hostname: &str) -> zbus::Result<()>; /// ConnectionRemoved signal - #[dbus_proxy(signal)] + #[zbus(signal)] fn connection_removed(&self, connection: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>; /// NewConnection signal - #[dbus_proxy(signal)] + #[zbus(signal)] fn new_connection(&self, connection: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>; /// CanModify property - #[dbus_proxy(property)] + #[zbus(property)] fn can_modify(&self) -> zbus::Result; /// Connections property - #[dbus_proxy(property)] + #[zbus(property)] fn connections(&self) -> zbus::Result>; /// Hostname property - #[dbus_proxy(property)] + #[zbus(property)] fn hostname(&self) -> zbus::Result; } diff --git a/networkmanager/src/interface/settings/connection.rs b/networkmanager/src/interface/settings/connection.rs index 6453c79..b0ce1f7 100644 --- a/networkmanager/src/interface/settings/connection.rs +++ b/networkmanager/src/interface/settings/connection.rs @@ -20,9 +20,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.NetworkManager.Settings.Connection", default_service = "org.freedesktop.NetworkManager" )] @@ -87,22 +87,22 @@ pub trait ConnectionSettings { ) -> zbus::Result<()>; /// Removed signal - #[dbus_proxy(signal)] + #[zbus(signal)] fn removed(&self) -> zbus::Result<()>; /// Updated signal - #[dbus_proxy(signal)] + #[zbus(signal)] fn updated(&self) -> zbus::Result<()>; /// Filename property - #[dbus_proxy(property)] + #[zbus(property)] fn filename(&self) -> zbus::Result; /// Flags property - #[dbus_proxy(property)] + #[zbus(property)] fn flags(&self) -> zbus::Result; /// Unsaved property - #[dbus_proxy(property)] + #[zbus(property)] fn unsaved(&self) -> zbus::Result; } diff --git a/networkmanager/src/interface/statistics.rs b/networkmanager/src/interface/statistics.rs index 9cd036f..cbf4fd0 100644 --- a/networkmanager/src/interface/statistics.rs +++ b/networkmanager/src/interface/statistics.rs @@ -20,24 +20,24 @@ //! //! …consequently `zbus-xmlgen` did not generate code for the above interfaces. -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.freedesktop.NetworkManager.Device.Statistics", default_service = "org.freedesktop.NetworkManager" )] pub trait Statistics { /// RefreshRateMs property - #[dbus_proxy(property)] + #[zbus(property)] fn refresh_rate_ms(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn set_refresh_rate_ms(&self, value: u32) -> zbus::Result<()>; /// RxBytes property - #[dbus_proxy(property)] + #[zbus(property)] fn rx_bytes(&self) -> zbus::Result; /// TxBytes property - #[dbus_proxy(property)] + #[zbus(property)] fn tx_bytes(&self) -> zbus::Result; } diff --git a/networkmanager/src/nm.rs b/networkmanager/src/nm.rs index e9a94ca..847d4b3 100644 --- a/networkmanager/src/nm.rs +++ b/networkmanager/src/nm.rs @@ -35,14 +35,14 @@ impl<'a> NetworkManager<'a> { connection: &'a Connection<'a>, device: &'a Device<'a>, ) -> Result> { - let connection = connection.path(); - let device = device.path(); + let connection = connection.inner().path(); + let device = device.inner().path(); let specific_object = ObjectPath::from_static_str("/").unwrap(); let active_connection_path = self .0 .activate_connection(connection, device, &specific_object) .await?; - ActiveConnectionProxy::builder(self.0.connection()) + ActiveConnectionProxy::builder(self.0.inner().connection()) .path(active_connection_path)? .build() .await @@ -53,7 +53,7 @@ impl<'a> NetworkManager<'a> { let active_connections = self.0.active_connections().await?; let mut out = Vec::with_capacity(active_connections.len()); for active_connection in active_connections { - let active_connection = ActiveConnectionProxy::builder(self.0.connection()) + let active_connection = ActiveConnectionProxy::builder(self.0.inner().connection()) .path(active_connection)? .build() .await?; @@ -74,14 +74,16 @@ impl<'a> NetworkManager<'a> { } pub async fn deactivate_connection(&self, connection: &'a ActiveConnection<'a>) -> Result<()> { - self.0.deactivate_connection(connection.path()).await + self.0 + .deactivate_connection(connection.inner().path()) + .await } pub async fn devices(&self) -> Result>> { let devices = self.0.get_all_devices().await?; let mut out = Vec::with_capacity(devices.len()); for device in devices { - let device = DeviceProxy::builder(self.0.connection()) + let device = DeviceProxy::builder(self.0.inner().connection()) .path(device)? .build() .await?; @@ -94,7 +96,7 @@ impl<'a> NetworkManager<'a> { let devices = self.0.get_all_devices().await?; let mut out = Vec::with_capacity(devices.len()); for device in devices { - let device = DeviceProxy::builder(self.0.connection()) + let device = DeviceProxy::builder(self.0.inner().connection()) .path(device)? .build() .await?; @@ -108,6 +110,6 @@ impl<'a> NetworkManager<'a> { } pub async fn settings(&'a self) -> Result> { - NetworkManagerSettings::new(self.0.connection()).await + NetworkManagerSettings::new(self.0.inner().connection()).await } } diff --git a/networkmanager/src/settings.rs b/networkmanager/src/settings.rs index 1c70f79..932f95d 100644 --- a/networkmanager/src/settings.rs +++ b/networkmanager/src/settings.rs @@ -27,7 +27,7 @@ impl<'a> NetworkManagerSettings<'a> { let connections = self.0.list_connections().await?; let mut out = Vec::with_capacity(connections.len()); for connection in connections { - let connection = ConnectionSettingsProxy::builder(self.0.connection()) + let connection = ConnectionSettingsProxy::builder(self.0.inner().connection()) .path(connection)? .build() .await?; diff --git a/networkmanager/src/settings/connection.rs b/networkmanager/src/settings/connection.rs index 10291a1..799a823 100644 --- a/networkmanager/src/settings/connection.rs +++ b/networkmanager/src/settings/connection.rs @@ -42,7 +42,7 @@ macro_rules! derive_value_build { ret } - pub fn build<'a>(&'a self) -> std::collections::HashMap> { + pub fn build(&self) -> std::collections::HashMap> { let mut out = std::collections::HashMap::new(); $( if let Some(val) = &self.$arg { diff --git a/switcheroo-control/src/lib.rs b/switcheroo-control/src/lib.rs index 5dedad7..0ad8318 100644 --- a/switcheroo-control/src/lib.rs +++ b/switcheroo-control/src/lib.rs @@ -22,34 +22,34 @@ use std::collections::HashMap; use zbus::{ - dbus_proxy, + proxy, zvariant::{self, OwnedValue}, }; -#[dbus_proxy( +#[proxy( interface = "net.hadess.SwitcherooControl", default_service = "net.hadess.SwitcherooControl", default_path = "/net/hadess/SwitcherooControl" )] trait SwitcherooControl { /// GPUs property - #[dbus_proxy(property, name = "GPUs")] + #[zbus(property, name = "GPUs")] fn gpus( &self, ) -> zbus::Result>>; /// HasDualGpu property - #[dbus_proxy(property)] + #[zbus(property)] fn has_dual_gpu(&self) -> zbus::Result; /// NumGPUs property - #[dbus_proxy(property, name = "NumGPUs")] + #[zbus(property, name = "NumGPUs")] fn num_gpus(&self) -> zbus::Result; } impl<'a> SwitcherooControlProxy<'a> { pub fn get_cached_gpus(&self) -> zbus::Result> { - let res = self.cached_gpus().map_err(|err| zbus::Error::from(err))?; + let res = self.cached_gpus()?; if let Some(res) = res { convert_gpus(res) } else { @@ -66,7 +66,7 @@ impl<'a> SwitcherooControlProxy<'a> { impl<'a> SwitcherooControlProxyBlocking<'a> { pub fn get_cached_gpus(&self) -> zbus::Result> { - let res = self.cached_gpus().map_err(|err| zbus::Error::from(err))?; + let res = self.cached_gpus()?; if let Some(res) = res { convert_gpus(res) } else { @@ -88,12 +88,12 @@ impl TryFrom> for Gpu { let name = value .get("Name") .ok_or(zvariant::Error::IncorrectType)? - .to_owned() + .try_clone()? .try_into()?; let environment: Vec = value .get("Environment") .ok_or(zvariant::Error::IncorrectType)? - .to_owned() + .try_clone()? .try_into()?; let environment: HashMap = environment .chunks_exact(2) diff --git a/timedate/Cargo.toml b/timedate/Cargo.toml index d82f9d8..84f3347 100644 --- a/timedate/Cargo.toml +++ b/timedate/Cargo.toml @@ -17,11 +17,8 @@ zbus.workspace = true [dev-dependencies] chrono = "0.4.23" chrono-tz = "0.8.1" - -[dev-dependencies.zbus] -version = "3.14" -default-features = false -features = ["tokio"] +zbus.workspace = true +zbus.features = ["tokio"] [dev-dependencies.tokio] version = "1.25.0" diff --git a/timedate/src/lib.rs b/timedate/src/lib.rs index bc8bc8b..3601408 100644 --- a/timedate/src/lib.rs +++ b/timedate/src/lib.rs @@ -15,9 +15,9 @@ //! * [`zbus::fdo::PropertiesProxy`] //! -use zbus::dbus_proxy; +use zbus::proxy; -#[dbus_proxy( +#[proxy( interface = "org.freedesktop.timedate1", default_service = "org.freedesktop.timedate1", default_path = "/org/freedesktop/timedate1" @@ -27,7 +27,7 @@ trait TimeDate { fn list_timezones(&self) -> zbus::Result>; /// Control whether the RTC is in local time zone or UTC. - #[dbus_proxy(name = "SetLocalRTC")] + #[zbus(name = "SetLocalRTC")] fn set_local_rtc( &self, local_rtc: bool, @@ -36,7 +36,7 @@ trait TimeDate { ) -> zbus::Result<()>; /// Control whether the system clock is synchronized with the network using `systemd-timesyncd`. - #[dbus_proxy(name = "SetNTP")] + #[zbus(name = "SetNTP")] fn set_ntp(&self, use_ntp: bool, interactive: bool) -> zbus::Result<()>; /// Change the system clock. @@ -46,30 +46,30 @@ trait TimeDate { fn set_timezone(&self, timezone: &str, interactive: bool) -> zbus::Result<()>; /// Shows whether a service to perform time synchronization over network is available. - #[dbus_proxy(property, name = "CanNTP")] + #[zbus(property, name = "CanNTP")] fn can_ntp(&self) -> zbus::Result; /// Shows whether the RTC is configured to use UTC or the local time zone. - #[dbus_proxy(property, name = "LocalRTC")] + #[zbus(property, name = "LocalRTC")] fn local_rtc(&self) -> zbus::Result; /// Shows whether the NTP service is enabled. - #[dbus_proxy(property, name = "NTP")] + #[zbus(property, name = "NTP")] fn ntp(&self) -> zbus::Result; /// Shows whether the kernel reports the time as synchronized. - #[dbus_proxy(property, name = "NTPSynchronized")] + #[zbus(property, name = "NTPSynchronized")] fn ntp_synchronized(&self) -> zbus::Result; /// Shows the current time in RTC. - #[dbus_proxy(property, name = "RTCTimeUSec")] + #[zbus(property, name = "RTCTimeUSec")] fn rtctime_usec(&self) -> zbus::Result; /// Shows the current time. - #[dbus_proxy(property, name = "TimeUSec")] + #[zbus(property, name = "TimeUSec")] fn time_usec(&self) -> zbus::Result; /// Shows the currently-configured time zone. - #[dbus_proxy(property)] + #[zbus(property)] fn timezone(&self) -> zbus::Result; } diff --git a/upower/src/device.rs b/upower/src/device.rs index 5448d20..31bb0a1 100644 --- a/upower/src/device.rs +++ b/upower/src/device.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: MPL-2.0 use serde_repr::{Deserialize_repr, Serialize_repr}; -use zbus::dbus_proxy; +use zbus::proxy; use zbus::zvariant::OwnedValue; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Deserialize_repr, Serialize_repr, OwnedValue)] @@ -43,80 +43,80 @@ pub enum BatteryLevel { Full = 8, } -#[dbus_proxy( +#[proxy( interface = "org.freedesktop.UPower.Device", default_service = "org.freedesktop.UPower", assume_defaults = false )] trait Device { - #[dbus_proxy(property)] + #[zbus(property)] fn battery_level(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn capacity(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn energy(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn energy_empty(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn energy_full(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn energy_full_design(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn has_history(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn has_statistics(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn icon_name(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn is_present(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn is_rechargeable(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn luminosity(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn model(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn native_path(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn online(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn percentage(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn power_supply(&self) -> zbus::Result; fn refresh(&self) -> zbus::Result<()>; - #[dbus_proxy(property)] + #[zbus(property)] fn serial(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn state(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn temperature(&self) -> zbus::Result; - #[dbus_proxy(property, name = "Type")] + #[zbus(property, name = "Type")] fn type_(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn vendor(&self) -> zbus::Result; - #[dbus_proxy(property)] + #[zbus(property)] fn voltage(&self) -> zbus::Result; } diff --git a/upower/src/upower.rs b/upower/src/upower.rs index 1bfe4ab..5c11604 100644 --- a/upower/src/upower.rs +++ b/upower/src/upower.rs @@ -1,11 +1,11 @@ // Copyright 2021 System76 // SPDX-License-Identifier: MPL-2.0 -use zbus::dbus_proxy; +use zbus::proxy; use crate::device::{DeviceProxy, DeviceProxyBlocking}; -#[dbus_proxy(interface = "org.freedesktop.UPower", assume_defaults = true)] +#[proxy(interface = "org.freedesktop.UPower", assume_defaults = true)] trait UPower { /// EnumerateDevices method fn enumerate_devices(&self) -> zbus::Result>; @@ -14,30 +14,30 @@ trait UPower { fn get_critical_action(&self) -> zbus::Result; /// GetDisplayDevice method - #[dbus_proxy(object = "Device")] + #[zbus(object = "Device")] fn get_display_device(&self); /// DeviceAdded signal - #[dbus_proxy(signal)] + #[zbus(signal)] fn device_added(&self, device: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>; /// DeviceRemoved signal - #[dbus_proxy(signal)] + #[zbus(signal)] fn device_removed(&self, device: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>; /// DaemonVersion property - #[dbus_proxy(property)] + #[zbus(property)] fn daemon_version(&self) -> zbus::Result; /// LidIsClosed property - #[dbus_proxy(property)] + #[zbus(property)] fn lid_is_closed(&self) -> zbus::Result; /// LidIsPresent property - #[dbus_proxy(property)] + #[zbus(property)] fn lid_is_present(&self) -> zbus::Result; /// OnBattery property - #[dbus_proxy(property)] + #[zbus(property)] fn on_battery(&self) -> zbus::Result; }