diff --git a/src/ui/app.rs b/src/ui/app.rs index 9bbd01a..da57383 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -74,7 +74,7 @@ pub struct App { #[derive(Debug)] pub enum Msg { - UpdateView, + ClockTicking, BuildProfile, EnableDebugViewChanged(bool), DoStartStopXRService, @@ -151,7 +151,7 @@ impl SimpleComponent for App { self.reset(); match message { - Msg::UpdateView => { + Msg::ClockTicking => { match &mut self.xrservice_runner { None => {} Some(runner) => { @@ -407,7 +407,6 @@ impl SimpleComponent for App { selected_profile: config.get_selected_profile(&profiles), }) .forward(sender.input_sender(), |message| match message { - MainViewOutMsg::UpdateView => Msg::UpdateView, MainViewOutMsg::EnableDebugViewChanged(val) => Msg::EnableDebugViewChanged(val), MainViewOutMsg::DoStartStopXRService => Msg::DoStartStopXRService, MainViewOutMsg::ProfileSelected(name) => Msg::ProfileSelected(name), @@ -418,7 +417,7 @@ impl SimpleComponent for App { enable_debug_view: config.debug_view_enabled, }) .forward(sender.input_sender(), |message| match message { - _ => Msg::UpdateView, + _ => Msg::ClockTicking, }), about_dialog: AboutDialog::builder() .transient_for(root) @@ -496,7 +495,7 @@ impl SimpleComponent for App { let timer_sender = sender.clone(); glib::timeout_add_local(Duration::from_millis(1000), move || { - timer_sender.input(Msg::UpdateView); + timer_sender.input(Msg::ClockTicking); return glib::Continue(true); }); diff --git a/src/ui/install_wivrn_box.rs b/src/ui/install_wivrn_box.rs index 660e4b9..0a58a81 100644 --- a/src/ui/install_wivrn_box.rs +++ b/src/ui/install_wivrn_box.rs @@ -7,7 +7,7 @@ use crate::{ }; use gtk::prelude::*; use relm4::prelude::*; -use std::{cell::Cell, thread::JoinHandle}; +use std::thread::JoinHandle; #[derive(PartialEq, Eq, Debug, Clone)] pub enum InstallWivrnStatus { @@ -21,7 +21,7 @@ pub struct InstallWivrnBox { selected_profile: Profile, install_wivrn_status: InstallWivrnStatus, #[tracker::do_not_track] - download_thread: Cell>>>, + download_thread: Option>>, #[tracker::do_not_track] install_runner: Option, } @@ -135,10 +135,9 @@ impl SimpleComponent for InstallWivrnBox { match message { Self::Input::ClockTicking => { - if self.download_thread.get_mut().is_some() { + if self.download_thread.is_some() { let finished = self .download_thread - .get_mut() .as_ref() .unwrap() .is_finished(); @@ -173,10 +172,10 @@ impl SimpleComponent for InstallWivrnBox { } Self::Input::DownloadWivrn => { self.set_install_wivrn_status(InstallWivrnStatus::InProgress); - self.download_thread.set(Some(download_file( + self.download_thread = Some(download_file( "https://github.com/Meumeu/WiVRn/releases/latest/download/WiVRn-oculus-release.apk".into(), wivrn_apk_download_path() - ))); + )); } Self::Input::InstallWivrnApk => { let mut runner = get_adb_install_runner(&wivrn_apk_download_path()); @@ -197,7 +196,7 @@ impl SimpleComponent for InstallWivrnBox { let model = Self { selected_profile: init.selected_profile, install_wivrn_status: InstallWivrnStatus::Done(None), - download_thread: Cell::new(None), + download_thread: None, install_runner: None, tracker: 0, }; diff --git a/src/ui/main_view.rs b/src/ui/main_view.rs index 76b713f..17827a5 100644 --- a/src/ui/main_view.rs +++ b/src/ui/main_view.rs @@ -44,7 +44,6 @@ pub enum MainViewMsg { #[derive(Debug)] pub enum MainViewOutMsg { - UpdateView, EnableDebugViewChanged(bool), DoStartStopXRService, ProfileSelected(String),