Skip to content

Commit

Permalink
chore: allow &str as input for the icon theme
Browse files Browse the repository at this point in the history
  • Loading branch information
edfloreshz authored Aug 21, 2023
1 parent 12da20d commit 78c1fac
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/app/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 {
Expand Down

0 comments on commit 78c1fac

Please sign in to comment.