mirror of
https://github.com/danbulant/icon
synced 2026-05-24 12:22:13 +00:00
Fix issue where hicolor may not end up last in chain
This commit is contained in:
parent
cfc932cd8e
commit
0bc75d5ef5
2 changed files with 21 additions and 18 deletions
|
|
@ -260,10 +260,15 @@ impl IconLocations {
|
||||||
pub fn icons(self) -> Icons {
|
pub fn icons(self) -> Icons {
|
||||||
let themes = self.resolve();
|
let themes = self.resolve();
|
||||||
|
|
||||||
let standalone_icons = self.standalone_icons
|
let standalone_icons = self
|
||||||
|
.standalone_icons
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|file| {
|
.map(|file| {
|
||||||
let key = file.path.file_stem().map(|s| s.to_string_lossy().to_string()).unwrap_or(String::new());
|
let key = file
|
||||||
|
.path
|
||||||
|
.file_stem()
|
||||||
|
.map(|s| s.to_string_lossy().to_string())
|
||||||
|
.unwrap_or(String::new());
|
||||||
(key, file)
|
(key, file)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
@ -388,19 +393,18 @@ impl IconLocations {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
if !chain.contains(&parent_idx) {
|
// add this parent, removing any previous occurrences
|
||||||
|
chain.retain(|idx| *idx != parent_idx);
|
||||||
chain.push(parent_idx);
|
chain.push(parent_idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// From the spec: "If no theme is specified, implementations are required to add the
|
// From the spec: "If no theme is specified, implementations are required to add the
|
||||||
// "hicolor" theme to the inheritance tree."
|
// "hicolor" theme to the inheritance tree."
|
||||||
if let Some(hicolor_idx) = hicolor_idx {
|
if let Some(hicolor_idx) = hicolor_idx {
|
||||||
if !chain.contains(&hicolor_idx) {
|
chain.retain(|idx| *idx != hicolor_idx);
|
||||||
chain.push(hicolor_idx);
|
chain.push(hicolor_idx);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
theme_chains.push(chain);
|
theme_chains.push(chain);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,8 +82,7 @@ impl Icons {
|
||||||
///
|
///
|
||||||
/// These icons do not have any size or scalability information attached to them.
|
/// These icons do not have any size or scalability information attached to them.
|
||||||
pub fn find_standalone_icon(&self, icon_name: &str) -> Option<IconFile> {
|
pub fn find_standalone_icon(&self, icon_name: &str) -> Option<IconFile> {
|
||||||
self.standalone_icons.get(icon_name)
|
self.standalone_icons.get(icon_name).cloned()
|
||||||
.cloned()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue