image: Use async function to load file info

GdkPixbuf provides `file_info_future ()` to load the file
info asynchronously, using the gio thread pool. That
means we don't need to spawn a thread ourselves for it.
This commit is contained in:
Christopher Davis 2023-01-22 13:31:15 -05:00 • committed by Sophie Herold
parent 7b7435f50a
commit 469e721d2b

View file

@ -584,12 +584,9 @@ impl LpImage {
self.notify("metadata");
log::debug!("Loading image size");
let (_, x, y) = util::spawn(
"image-load-size",
glib::clone!(@strong path => move || gdk_pixbuf::Pixbuf::file_info(&path)),
)
.await?
.context(i18n("Failed to load image size"))?;
let (_, x, y) = gdk_pixbuf::Pixbuf::file_info_future(path.clone())
.await?
.context(i18n("Failed to load image size"))?;
imp.image_original_size.set((x, y));
self.notify("image-size");