From 78c1facd5b9c0e75fef7ac26adf7e2fb78553a88 Mon Sep 17 00:00:00 2001 From: Eduardo Flores Date: Mon, 21 Aug 2023 13:09:36 -0700 Subject: [PATCH] chore: allow &str as input for the icon theme --- src/app/settings.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/app/settings.rs b/src/app/settings.rs index 0745fc95765..d6f9cdbd0db 100644 --- a/src/app/settings.rs +++ b/src/app/settings.rs @@ -29,7 +29,7 @@ pub struct Settings { pub(crate) default_font: Font, /// Name of the icon theme to search by default. - #[setters(into)] + #[setters(skip)] pub(crate) default_icon_theme: Option, /// Default size of fonts. @@ -56,6 +56,15 @@ pub struct Settings { pub(crate) transparent: bool, } +impl Settings { + /// Sets the default icon theme, passing an empty string will unset the theme. + pub fn default_icon_theme(mut self, value: impl Into) -> Self { + let value: String = value.into(); + self.default_icon_theme = if value.is_empty() { None } else { Some(value) }; + self + } +} + impl Default for Settings { fn default() -> Self { Self {