fix: Fallback to using the hicolor theme if the selected theme doesn't exist

This commit is contained in:
Patrick Chieppe 2024-01-28 15:01:35 +11:00 • committed by Paul Delafosse
parent 5e8d39a7a7
commit c7914692a2

View file

@ -235,7 +235,10 @@ impl<'a> LookupBuilder<'a> {
} }
// Then lookup in the given theme // Then lookup in the given theme
THEMES.get(self.theme).and_then(|icon_themes| { THEMES
.get(self.theme)
.or_else(|| THEMES.get("hicolor"))
.and_then(|icon_themes| {
let icon = icon_themes let icon = icon_themes
.iter() .iter()
.find_map(|theme| { .find_map(|theme| {
@ -273,7 +276,9 @@ impl<'a> LookupBuilder<'a> {
} }
None None
}) })
.or_else(|| try_build_icon_path(self.name, "/usr/share/pixmaps", self.force_svg)) .or_else(|| {
try_build_icon_path(self.name, "/usr/share/pixmaps", self.force_svg)
})
.or_else(|| { .or_else(|| {
let p = PathBuf::from(&self.name); let p = PathBuf::from(&self.name);
if let (Some(name), Some(parent)) = (p.file_stem(), p.parent()) { if let (Some(name), Some(parent)) = (p.file_stem(), p.parent()) {