Merge branch 'fix-#114' into 'master'
utils: use generic image when a show has no cover See merge request World/podcasts!103
This commit is contained in:
commit
89c3733ce8
@ -17,7 +17,6 @@
|
|||||||
//
|
//
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
|
||||||
#![cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
#![cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
|
||||||
|
|
||||||
use gdk::FrameClockExt;
|
use gdk::FrameClockExt;
|
||||||
@ -43,6 +42,7 @@ use podcasts_data::pipeline;
|
|||||||
use podcasts_data::utils::checkup;
|
use podcasts_data::utils::checkup;
|
||||||
use podcasts_data::Source;
|
use podcasts_data::Source;
|
||||||
use podcasts_downloader::downloader;
|
use podcasts_downloader::downloader;
|
||||||
|
use podcasts_downloader::errors::DownloadError;
|
||||||
|
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use std::sync::{Arc, Mutex, RwLock};
|
use std::sync::{Arc, Mutex, RwLock};
|
||||||
@ -337,13 +337,23 @@ pub(crate) fn set_image_from_path(
|
|||||||
Err(TryRecvError::Empty) => glib::Continue(true),
|
Err(TryRecvError::Empty) => glib::Continue(true),
|
||||||
Err(TryRecvError::Disconnected) => glib::Continue(false),
|
Err(TryRecvError::Disconnected) => glib::Continue(false),
|
||||||
Ok(path) => {
|
Ok(path) => {
|
||||||
if let Ok(path) = path {
|
match path {
|
||||||
if let Ok(px) = Pixbuf::new_from_file_at_scale(&path, s, s, true) {
|
Ok(path) => {
|
||||||
if let Ok(mut hashmap) = CACHED_PIXBUFS.write() {
|
if let Ok(px) = Pixbuf::new_from_file_at_scale(&path, s, s, true) {
|
||||||
hashmap.insert((show_id, size), Mutex::new(Fragile::new(px.clone())));
|
if let Ok(mut hashmap) = CACHED_PIXBUFS.write() {
|
||||||
image.set_from_pixbuf(&px);
|
hashmap
|
||||||
|
.insert((show_id, size), Mutex::new(Fragile::new(px.clone())));
|
||||||
|
image.set_from_pixbuf(&px);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Err(DownloadError::NoImageLocation) => {
|
||||||
|
image.set_from_icon_name(
|
||||||
|
"image-x-generic-symbolic",
|
||||||
|
gtk::IconSize::__Unknown(s),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
glib::Continue(false)
|
glib::Continue(false)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user