Rescan in background and describe empty folders

This commit is contained in:
Jeremy Soller 2024-01-05 08:55:18 -07:00
parent dcf871e538
commit 7efe6efa30
No known key found for this signature in database
GPG key ID: DCFCA852D3906975
5 changed files with 211 additions and 122 deletions

View file

@ -43,7 +43,7 @@ lazy_static::lazy_static! {
static ref MIME_ICON_CACHE: Mutex<MimeIconCache> = Mutex::new(MimeIconCache::new());
}
pub fn mime_icon<P: AsRef<Path>>(path: P, size: u16) -> icon::Icon {
pub fn mime_icon<P: AsRef<Path>>(path: P, size: u16) -> icon::Handle {
//TODO: smarter path handling
let path = path
.as_ref()
@ -52,7 +52,7 @@ pub fn mime_icon<P: AsRef<Path>>(path: P, size: u16) -> icon::Icon {
.to_owned();
let mut mime_icon_cache = MIME_ICON_CACHE.lock().unwrap();
match mime_icon_cache.get(MimeIconKey { path, size }) {
Some(handle) => icon::icon(handle).size(size),
None => icon::from_name(FALLBACK_MIME_ICON).size(size).icon(),
Some(handle) => handle,
None => icon::from_name(FALLBACK_MIME_ICON).size(size).handle(),
}
}