From 9790844ee3e4943e9e75d5d33a2c6f86563b6f0a Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Sat, 24 Aug 2024 08:44:11 +0200 Subject: [PATCH] feat: make wivrn install box async component --- src/ui/install_wivrn_box.rs | 20 +++++++++++++------- src/ui/main_view.rs | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/ui/install_wivrn_box.rs b/src/ui/install_wivrn_box.rs index e2dc3b9..4c16b4f 100644 --- a/src/ui/install_wivrn_box.rs +++ b/src/ui/install_wivrn_box.rs @@ -52,11 +52,12 @@ pub struct InstallWivrnBoxInit { pub root_win: gtk::Window, } -#[relm4::component(pub)] -impl SimpleComponent for InstallWivrnBox { +#[relm4::component(pub async)] +impl AsyncComponent for InstallWivrnBox { type Init = InstallWivrnBoxInit; type Input = InstallWivrnBoxMsg; type Output = (); + type CommandOutput = (); view! { gtk::Box { @@ -121,7 +122,12 @@ impl SimpleComponent for InstallWivrnBox { } } - fn update(&mut self, message: Self::Input, sender: ComponentSender) { + async fn update( + &mut self, + message: Self::Input, + sender: AsyncComponentSender, + _root: &Self::Root, + ) { self.reset(); match message { @@ -218,11 +224,11 @@ impl SimpleComponent for InstallWivrnBox { } } - fn init( + async fn init( init: Self::Init, root: Self::Root, - sender: ComponentSender, - ) -> ComponentParts { + sender: AsyncComponentSender, + ) -> AsyncComponentParts { let model = Self { selected_profile: init.selected_profile, install_wivrn_status: InstallWivrnStatus::Done(None), @@ -234,7 +240,7 @@ impl SimpleComponent for InstallWivrnBox { let widgets = view_output!(); - ComponentParts { model, widgets } + AsyncComponentParts { model, widgets } } } diff --git a/src/ui/main_view.rs b/src/ui/main_view.rs index 49dc361..86035da 100644 --- a/src/ui/main_view.rs +++ b/src/ui/main_view.rs @@ -42,7 +42,7 @@ pub struct MainView { #[tracker::do_not_track] profiles_dropdown: Option, #[tracker::do_not_track] - install_wivrn_box: Controller, + install_wivrn_box: AsyncController, #[tracker::do_not_track] steam_launch_options_box: Controller, #[tracker::do_not_track]