Fix no ui download images (#195)

This commit is contained in:
Philip Kristoffersen
2022-07-27 12:12:08 +02:00
committed by GitHub
parent 583e0faef0
commit f6eb8c38bf
2 changed files with 7 additions and 4 deletions
+5 -2
View File
@@ -107,7 +107,7 @@ impl MyEguiApp {
} }
} }
pub fn run_sync(&mut self) { pub fn run_sync(&mut self, wait: bool ) {
let (sender, reciever) = watch::channel(SyncProgress::NotStarted); let (sender, reciever) = watch::channel(SyncProgress::NotStarted);
let settings = self.settings.clone(); let settings = self.settings.clone();
if settings.steam.stop_steam { if settings.steam.stop_steam {
@@ -115,7 +115,7 @@ impl MyEguiApp {
} }
self.status_reciever = reciever; self.status_reciever = reciever;
self.rt.spawn_blocking(move || { let handle = self.rt.spawn_blocking(move || {
MyEguiApp::save_settings_to_file(&settings); MyEguiApp::save_settings_to_file(&settings);
let mut some_sender = Some(sender); let mut some_sender = Some(sender);
backup_shortcuts(&settings.steam); backup_shortcuts(&settings.steam);
@@ -133,6 +133,9 @@ impl MyEguiApp {
crate::steam::ensure_steam_started(&settings.steam); crate::steam::ensure_steam_started(&settings.steam);
} }
}); });
if wait {
self.rt.block_on(handle).unwrap();
}
} }
pub fn save_settings_to_file(settings: &Settings) { pub fn save_settings_to_file(settings: &Settings) {
+2 -2
View File
@@ -181,7 +181,7 @@ impl App for MyEguiApp {
.clicked() .clicked()
&& !syncing && !syncing
{ {
self.run_sync(); self.run_sync(false);
} }
}); });
} }
@@ -272,7 +272,7 @@ fn setup(ctx: &egui::Context) {
} }
pub fn run_sync() { pub fn run_sync() {
let mut app = MyEguiApp::new(); let mut app = MyEguiApp::new();
app.run_sync(); app.run_sync(true);
} }
pub fn run_ui(args: Vec<String>) -> Result<(), Box<dyn Error>> { pub fn run_ui(args: Vec<String>) -> Result<(), Box<dyn Error>> {