h-gtk/utils: Re-work format_err! calls and improve formatting
This commit is contained in:
parent
710a3f2552
commit
f2444f151c
@ -231,9 +231,9 @@ mod tests {
|
|||||||
love, a crashed UFO, an alien body, and an impossible heist unlike any \
|
love, a crashed UFO, an alien body, and an impossible heist unlike any \
|
||||||
ever attempted - scripted by Mac Rogers, the award-winning playwright \
|
ever attempted - scripted by Mac Rogers, the award-winning playwright \
|
||||||
and writer of the multi-million download The Message and LifeAfter.</p>";
|
and writer of the multi-million download The Message and LifeAfter.</p>";
|
||||||
let img = "https://dfkfj8j276wwv.cloudfront.net/images/2c/5f/a0/1a/2c5fa01a-ae78-4a8c-\
|
let img = "https://dfkfj8j276wwv.cloudfront.net/images/2c/5f/a0/1a/2c5fa01a-ae78-4a8c-\
|
||||||
b183-7311d2e436c3/b3a4aa57a576bb662191f2a6bc2a436c8c4ae256ecffaff5c4c54fd42e\
|
b183-7311d2e436c3/b3a4aa57a576bb662191f2a6bc2a436c8c4ae256ecffaff5c4c54fd42e\
|
||||||
923914941c264d01efb1833234b52c9530e67d28a8cebbe3d11a4bc0fbbdf13ecdf1c3.jpeg";
|
923914941c264d01efb1833234b52c9530e67d28a8cebbe3d11a4bc0fbbdf13ecdf1c3.jpeg";
|
||||||
|
|
||||||
NewPodcastBuilder::default()
|
NewPodcastBuilder::default()
|
||||||
.title("Steal the Stars")
|
.title("Steal the Stars")
|
||||||
|
|||||||
@ -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,
|
let _ = set_image_from_path(&image, pd.clone(), size);
|
||||||
clone!(image, pd => move || {
|
glib::Continue(false)
|
||||||
let _ = set_image_from_path(&image, pd.clone(), size);
|
});
|
||||||
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