From 00848ae5e41ec24fbdd538f2c78fdd89c93f9a1d Mon Sep 17 00:00:00 2001 From: Philip Kristoffersen Date: Tue, 6 Sep 2022 19:14:31 +0200 Subject: [PATCH] itch reset settings on empty string (#227) * Add option to reset all images * Reset itch settings on empty string --- src/ui/ui_settings.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ui/ui_settings.rs b/src/ui/ui_settings.rs index 30692d6..7b0c9fc 100644 --- a/src/ui/ui_settings.rs +++ b/src/ui/ui_settings.rs @@ -197,9 +197,19 @@ self.settings.heroic.default_launch_through_heroic{ .unwrap_or(&mut empty_string); ui.label("Itch.io Folder: "); if ui.text_edit_singleline(itch_location).changed() { - self.settings.itch.location = Some(itch_location.to_string()); + self.settings.itch.location = if itch_location.is_empty(){ + None + }else { + Some(itch_location.to_string()) + }; + }else{ + if !itch_location.is_empty(){ + if ui.button("Reset").on_hover_text("Reset the itch path, let BoilR guess again").clicked(){ + self.settings.itch.location = None; + } + } } - + }); #[cfg(target_family = "unix")] {