image_view: Add directory navigation

This commit adds directory navigation to Image Viewer.
Currently it only sorts images by name, instead of following
directory sorting like the mockups.
This commit is contained in:
Christopher Davis 2021-09-05 05:51:34 -07:00
parent 1841789525
commit 84208d2887
7 changed files with 191 additions and 28 deletions

View file

@ -112,6 +112,16 @@ mod imp {
obj.resize_from_dimensions(width, height);
}),
);
// Property bindings didn't seem to work here
self.image_view.connect_notify_local(
Some("filename"),
clone!(@weak obj => move |iv, _| {
if let Some(filename) = iv.filename() {
obj.set_title(Some(&filename));
}
}),
);
}
}
@ -244,12 +254,7 @@ impl IvWindow {
imp.image_view.set_image_from_file(file);
imp.stack.set_visible_child(&*imp.image_view);
if let Some(name) = file.basename() {
self.set_title(Some(
name.file_name().expect("Missing name").to_str().unwrap(),
));
}
imp.image_view.grab_focus();
self.set_actions_enabled(true);
}