decoder: Use GFile instead of PathBuf

This allows to show images from locations that don't
have a representation with path.

This also works around not being able to read files in trash:///

Closes #56

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/174>
This commit is contained in:
Sophie Herold 2023-04-12 04:13:30 +02:00 • committed by Marge Bot
parent 032707a210
commit fad8bb7939
15 changed files with 119 additions and 107 deletions

View file

@ -7,17 +7,16 @@ use gtk::glib;
use once_cell::sync::Lazy;
use std::cell::RefCell;
use std::path::Path;
glib::wrapper! {
pub struct LpImageMetadata(ObjectSubclass<imp::LpImageMetadata>);
}
impl LpImageMetadata {
pub fn load(path: &Path) -> Self {
pub fn load(file: &gio::File) -> Self {
let obj = glib::Object::new::<Self>();
let metadata = ImageMetadata::load(path);
let metadata = ImageMetadata::load(file);
obj.imp().metadata.replace(metadata);
obj