fix: prefer SVG file icons
This commit is contained in:
parent
750c92c841
commit
6946e95c88
2 changed files with 10 additions and 3 deletions
|
|
@ -45,7 +45,7 @@ impl MimeIconCache {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let icon_name = icon_names.remove(0);
|
let icon_name = icon_names.remove(0);
|
||||||
let mut named = icon::from_name(icon_name).size(key.size);
|
let mut named = icon::from_name(icon_name).prefer_svg(true).size(key.size);
|
||||||
if !icon_names.is_empty() {
|
if !icon_names.is_empty() {
|
||||||
let fallback_names =
|
let fallback_names =
|
||||||
icon_names.into_iter().map(std::borrow::Cow::from).collect();
|
icon_names.into_iter().map(std::borrow::Cow::from).collect();
|
||||||
|
|
@ -112,7 +112,10 @@ pub fn mime_icon(mime: Mime, size: u16) -> icon::Handle {
|
||||||
let mut mime_icon_cache = MIME_ICON_CACHE.lock().unwrap();
|
let mut mime_icon_cache = MIME_ICON_CACHE.lock().unwrap();
|
||||||
match mime_icon_cache.get(MimeIconKey { mime, size }) {
|
match mime_icon_cache.get(MimeIconKey { mime, size }) {
|
||||||
Some(handle) => handle,
|
Some(handle) => handle,
|
||||||
None => icon::from_name(FALLBACK_MIME_ICON).size(size).handle(),
|
None => icon::from_name(FALLBACK_MIME_ICON)
|
||||||
|
.prefer_svg(true)
|
||||||
|
.size(size)
|
||||||
|
.handle(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -269,6 +269,7 @@ fn button_style(
|
||||||
|
|
||||||
pub fn folder_icon(path: &PathBuf, icon_size: u16) -> widget::icon::Handle {
|
pub fn folder_icon(path: &PathBuf, icon_size: u16) -> widget::icon::Handle {
|
||||||
widget::icon::from_name(SPECIAL_DIRS.get(path).map_or("folder", |x| *x))
|
widget::icon::from_name(SPECIAL_DIRS.get(path).map_or("folder", |x| *x))
|
||||||
|
.prefer_svg(true)
|
||||||
.size(icon_size)
|
.size(icon_size)
|
||||||
.handle()
|
.handle()
|
||||||
}
|
}
|
||||||
|
|
@ -581,7 +582,10 @@ fn desktop_icon_handle(icon: &str, size: u16) -> widget::icon::Handle {
|
||||||
if icon_path.is_absolute() && icon_path.exists() {
|
if icon_path.is_absolute() && icon_path.exists() {
|
||||||
widget::icon::from_path(icon_path.to_path_buf())
|
widget::icon::from_path(icon_path.to_path_buf())
|
||||||
} else {
|
} else {
|
||||||
widget::icon::from_name(icon).size(size).handle()
|
widget::icon::from_name(icon)
|
||||||
|
.prefer_svg(true)
|
||||||
|
.size(size)
|
||||||
|
.handle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue