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:
parent
7b7435f50a
commit
469e721d2b
1 changed files with 3 additions and 6 deletions
|
|
@ -584,12 +584,9 @@ impl LpImage {
|
||||||
self.notify("metadata");
|
self.notify("metadata");
|
||||||
|
|
||||||
log::debug!("Loading image size");
|
log::debug!("Loading image size");
|
||||||
let (_, x, y) = util::spawn(
|
let (_, x, y) = gdk_pixbuf::Pixbuf::file_info_future(path.clone())
|
||||||
"image-load-size",
|
.await?
|
||||||
glib::clone!(@strong path => move || gdk_pixbuf::Pixbuf::file_info(&path)),
|
.context(i18n("Failed to load image size"))?;
|
||||||
)
|
|
||||||
.await?
|
|
||||||
.context(i18n("Failed to load image size"))?;
|
|
||||||
imp.image_original_size.set((x, y));
|
imp.image_original_size.set((x, y));
|
||||||
self.notify("image-size");
|
self.notify("image-size");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue