diff --git a/src/manager/user.rs b/src/manager/user.rs index a7441de..7ebb516 100644 --- a/src/manager/user.rs +++ b/src/manager/user.rs @@ -19,6 +19,7 @@ use crate::daemon::user::Command; use crate::daemon::DaemonCommand; use crate::error::{to_zbus_error, to_zbus_fdo_error, zbus_to_zbus_fdo}; use crate::hardware::check_support; +use crate::job::JobManager; use crate::power::{ get_available_cpu_scaling_governors, get_cpu_scaling_governor, get_gpu_clocks, get_gpu_performance_level, get_gpu_power_profile, get_gpu_power_profiles, get_tdp_limit, @@ -41,6 +42,21 @@ macro_rules! method { }; } +macro_rules! job_method { + ($self:expr, $method:expr, $($args:expr),+) => { + $self.job_manager.mirror_job::( + $self.proxy.connection(), + method!($self, $method, $($args),+)? + ).await + }; + ($self:expr, $method:expr) => { + $self.job_manager.mirror_job::( + $self.proxy.connection(), + method!($self, $method)? + ).await + }; +} + macro_rules! getter { ($self:expr, $prop:expr) => { $self @@ -65,6 +81,7 @@ pub struct SteamOSManager { proxy: Proxy<'static>, hdmi_cec: HdmiCecControl<'static>, channel: Sender, + job_manager: JobManager, } impl SteamOSManager { @@ -82,6 +99,7 @@ impl SteamOSManager { .cache_properties(CacheProperties::No) .build() .await?, + job_manager: JobManager::new(connection).await?, channel, }) } @@ -170,25 +188,25 @@ impl SteamOSManager { } } - async fn update_bios(&self) -> fdo::Result { - method!(self, "UpdateBios") + async fn update_bios(&mut self) -> fdo::Result { + job_method!(self, "UpdateBios") } - async fn update_dock(&self) -> fdo::Result { - method!(self, "UpdateDock") + async fn update_dock(&mut self) -> fdo::Result { + job_method!(self, "UpdateDock") } - async fn trim_devices(&self) -> fdo::Result { - method!(self, "TrimDevices") + async fn trim_devices(&mut self) -> fdo::Result { + job_method!(self, "TrimDevices") } async fn format_device( - &self, + &mut self, device: &str, label: &str, validate: bool, ) -> fdo::Result { - method!(self, "FormatDevice", device, label, validate) + job_method!(self, "FormatDevice", device, label, validate) } #[zbus(property(emits_changed_signal = "false"))]