h-gtk/utils: Re-work format_err! calls and improve formatting
This commit is contained in:
parent
710a3f2552
commit
f2444f151c
@ -161,13 +161,11 @@ pub fn set_image_from_path(
|
|||||||
.read()
|
.read()
|
||||||
.map_err(|err| format_err!("Cover Registry: {}.", err))?;
|
.map_err(|err| format_err!("Cover Registry: {}.", err))?;
|
||||||
if reg_guard.contains(&pd.id()) {
|
if reg_guard.contains(&pd.id()) {
|
||||||
gtk::timeout_add(
|
let callback = clone!(image, pd => move || {
|
||||||
250,
|
|
||||||
clone!(image, pd => move || {
|
|
||||||
let _ = set_image_from_path(&image, pd.clone(), size);
|
let _ = set_image_from_path(&image, pd.clone(), size);
|
||||||
glib::Continue(false)
|
glib::Continue(false)
|
||||||
}),
|
});
|
||||||
);
|
gtk::timeout_add(250, callback);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,10 +173,10 @@ pub fn set_image_from_path(
|
|||||||
{
|
{
|
||||||
let hashmap = CACHED_PIXBUFS
|
let hashmap = CACHED_PIXBUFS
|
||||||
.read()
|
.read()
|
||||||
.map_err(|_| format_err!("Failed to get a lock on the pixbuf cache mutex."))?;
|
.map_err(|err| format_err!("Pixbuf HashMap: {}", err))?;
|
||||||
if let Some(px) = hashmap.get(&(pd.id(), size)) {
|
if let Some(px) = hashmap.get(&(pd.id(), size)) {
|
||||||
let m = px.lock()
|
let m = px.lock()
|
||||||
.map_err(|_| format_err!("Failed to lock pixbuf mutex."))?;
|
.map_err(|err| format_err!("SendCell Mutex: {}", err))?;
|
||||||
let px = m.try_get().ok_or_else(|| {
|
let px = m.try_get().ok_or_else(|| {
|
||||||
format_err!("Pixbuf was accessed from a different thread than created")
|
format_err!("Pixbuf was accessed from a different thread than created")
|
||||||
})?;
|
})?;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user