Skip to content

Commit

Permalink
Manual implementation
Browse files Browse the repository at this point in the history
- Added manual implementation to allow the property to be set to None.
  • Loading branch information
edfloreshz committed Aug 10, 2023
1 parent 09dab77 commit 2aba821
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/app/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct Settings {
pub(crate) default_font: Font,

/// Name of the icon theme to search by default.
#[setters(into, strip_option)]
#[setters(skip)]
pub(crate) default_icon_theme: Option<String>,

/// Default size of fonts.
Expand All @@ -53,6 +53,19 @@ 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.to_string())
};
self
}
}

impl Default for Settings {
fn default() -> Self {
Self {
Expand Down

0 comments on commit 2aba821

Please sign in to comment.