chore: allow &str as input for the icon theme

This commit is contained in:
Eduardo Flores 2023-08-21 13:09:36 -07:00 committed by GitHub
parent 12da20d184
commit 78c1facd5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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<String>,
/// 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<String>) -> 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 {