From 6a08ce823e9bfe66616f8c5a4bf69ebe456115a8 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 27 Aug 2024 19:43:57 -0700 Subject: [PATCH] job: Rename DBus interfaces Job and JobManager to Job1 and JobManager1 --- src/job.rs | 21 +++++++++---------- src/proxy/{job.rs => job1.rs} | 6 +++--- src/proxy/{job_manager.rs => job_manager1.rs} | 6 +++--- src/proxy/mod.rs | 8 +++---- 4 files changed, 20 insertions(+), 21 deletions(-) rename src/proxy/{job.rs => job1.rs} (92%) rename src/proxy/{job_manager.rs => job_manager1.rs} (89%) diff --git a/src/job.rs b/src/job.rs index 5aa3cde..0c14d8f 100644 --- a/src/job.rs +++ b/src/job.rs @@ -25,7 +25,7 @@ use zbus::{interface, zvariant, Connection, Interface, InterfaceRef, SignalConte use zbus_xml::Node; use crate::error::{to_zbus_fdo_error, zbus_to_zbus_fdo}; -use crate::proxy::{JobManagerProxy, JobProxy}; +use crate::proxy::{JobManager1Proxy, Job1Proxy}; use crate::Service; const JOB_PREFIX: &str = "/com/steampowered/SteamOSManager1/Jobs"; @@ -54,7 +54,7 @@ pub struct JobManagerService { } struct MirroredJob { - job: JobProxy<'static>, + job: Job1Proxy<'static>, } pub enum JobManagerCommand { @@ -135,7 +135,7 @@ impl JobManager { return Ok(object_path.clone()); } - let proxy = JobProxy::builder(connection) + let proxy = Job1Proxy::builder(connection) .destination("com.steampowered.SteamOSManager1")? .path(path)? .build() @@ -166,7 +166,7 @@ impl JobManager { } } -#[interface(name = "com.steampowered.SteamOSManager1.JobManager")] +#[interface(name = "com.steampowered.SteamOSManager1.JobManager1")] impl JobManagerInterface { #[zbus(signal)] async fn job_started( @@ -232,7 +232,7 @@ impl Job { } } -#[interface(name = "com.steampowered.SteamOSManager1.Job")] +#[interface(name = "com.steampowered.SteamOSManager1.Job1")] impl Job { pub async fn pause(&mut self) -> fdo::Result<()> { if self.paused { @@ -285,7 +285,7 @@ impl Job { } } -#[interface(name = "com.steampowered.SteamOSManager1.Job")] +#[interface(name = "com.steampowered.SteamOSManager1.Job1")] impl MirroredJob { pub async fn pause(&mut self) -> fdo::Result<()> { self.job.pause().await.map_err(zbus_to_zbus_fdo) @@ -355,7 +355,7 @@ impl Service for JobManagerService { const NAME: &'static str = "job-manager"; async fn run(&mut self) -> Result<()> { - let jm = JobManagerProxy::new(&self.connection).await?; + let jm = JobManager1Proxy::new(&self.connection).await?; let mut stream = jm.receive_job_started().await?; loop { @@ -381,7 +381,6 @@ impl Service for JobManagerService { #[cfg(test)] pub(crate) mod test { use super::*; - use crate::proxy::JobProxy; use crate::testing; use anyhow::anyhow; @@ -409,7 +408,7 @@ pub(crate) mod test { let job = tokio::spawn(async move { let connection = ConnectionBuilder::session()?.build().await?; - let jm = JobManagerProxy::builder(&connection) + let jm = JobManager1Proxy::builder(&connection) .destination(sender)? .build() .await?; @@ -498,7 +497,7 @@ pub(crate) mod test { struct MockJob {} - #[zbus::interface(name = "com.steampowered.SteamOSManager1.Job")] + #[zbus::interface(name = "com.steampowered.SteamOSManager1.Job1")] impl MockJob { pub async fn pause(&mut self) -> fdo::Result<()> { Err(fdo::Error::Failed(String::from("pause"))) @@ -552,7 +551,7 @@ pub(crate) mod test { .await .expect("mirror_job"); let name = connection.unique_name().unwrap().clone(); - let proxy = JobProxy::builder(&connection) + let proxy = Job1Proxy::builder(&connection) .destination(BusName::Unique(name.into())) .expect("destination") .path(path) diff --git a/src/proxy/job.rs b/src/proxy/job1.rs similarity index 92% rename from src/proxy/job.rs rename to src/proxy/job1.rs index c944f9b..72e5376 100644 --- a/src/proxy/job.rs +++ b/src/proxy/job1.rs @@ -1,4 +1,4 @@ -//! # D-Bus interface proxy for: `com.steampowered.SteamOSManager1.Job` +//! # D-Bus interface proxy for: `com.steampowered.SteamOSManager1.Job1` //! //! This code was generated by `zbus-xmlgen` `4.1.0` from D-Bus introspection data. //! Source: `com.steampowered.SteamOSManager1.xml`. @@ -13,11 +13,11 @@ //! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces, use zbus::proxy; #[proxy( - interface = "com.steampowered.SteamOSManager1.Job", + interface = "com.steampowered.SteamOSManager1.Job1", default_service = "com.steampowered.SteamOSManager1", assume_defaults = true )] -trait Job { +trait Job1 { /// Cancel method fn cancel(&self, force: bool) -> zbus::Result<()>; diff --git a/src/proxy/job_manager.rs b/src/proxy/job_manager1.rs similarity index 89% rename from src/proxy/job_manager.rs rename to src/proxy/job_manager1.rs index 0153cec..aa37c5e 100644 --- a/src/proxy/job_manager.rs +++ b/src/proxy/job_manager1.rs @@ -1,4 +1,4 @@ -//! # D-Bus interface proxy for: `com.steampowered.SteamOSManager1.JobManager` +//! # D-Bus interface proxy for: `com.steampowered.SteamOSManager1.JobManager1` //! //! This code was generated by `zbus-xmlgen` `4.1.0` from D-Bus introspection data. //! Source: `com.steampowered.SteamOSManager1.xml`. @@ -13,12 +13,12 @@ //! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces, use zbus::proxy; #[proxy( - interface = "com.steampowered.SteamOSManager1.JobManager", + interface = "com.steampowered.SteamOSManager1.JobManager1", default_service = "com.steampowered.SteamOSManager1", default_path = "/com/steampowered/SteamOSManager1/Jobs", assume_defaults = true )] -trait JobManager { +trait JobManager1 { /// JobStarted signal #[zbus(signal)] fn job_started(&self, job: zbus::zvariant::ObjectPath<'_>) -> zbus::Result<()>; diff --git a/src/proxy/mod.rs b/src/proxy/mod.rs index 72f49a5..8b5048c 100644 --- a/src/proxy/mod.rs +++ b/src/proxy/mod.rs @@ -8,11 +8,11 @@ // Re-export relevant proxies // TODO Some of these should get renamed -mod job; -mod job_manager; +mod job1; +mod job_manager1; mod udev_events; -pub use crate::proxy::job::JobProxy; -pub use crate::proxy::job_manager::JobManagerProxy; +pub use crate::proxy::job1::Job1Proxy; +pub use crate::proxy::job_manager1::JobManager1Proxy; pub use crate::proxy::udev_events::UdevEventsProxy; // Deprecated interface