fileDialog: Pre-select current image's folder

Part-of: <https://gitlab.gnome.org/GNOME/loupe/-/merge_requests/287>
This commit is contained in:
Sophie Herold 2023-08-27 22:20:13 +02:00 • committed by Marge Bot
parent 229c63719e
commit 4e28ea1cf6

View file

@ -502,6 +502,14 @@ impl LpWindow {
.modal(true) .modal(true)
.build(); .build();
chooser.set_initial_folder(
self.image_view()
.current_image()
.and_then(|x| x.file())
.and_then(|x| x.parent())
.as_ref(),
);
if let Ok(selected) = chooser.open_multiple_future(Some(self)).await { if let Ok(selected) = chooser.open_multiple_future(Some(self)).await {
let images: Vec<_> = selected let images: Vec<_> = selected
.into_iter() .into_iter()