edit_window: Return to image view after saving

This commit is contained in:
Sophie Herold 2025-01-17 12:35:43 +01:00
parent f12e6021b4
commit e4bb97140a
2 changed files with 14 additions and 1 deletions

View file

@ -127,7 +127,9 @@ mod imp {
log::error!("{}", err);
}
Ok(new_file) => {
self.save(current_file, new_file).await;
if self.save(current_file, new_file.clone()).await {
obj.window().show_specific_image(new_file);
}
}
}
}
@ -177,6 +179,8 @@ mod imp {
),
ErrorType::General,
);
} else {
obj.window().show_specific_image(current_file);
}
}
}
@ -184,6 +188,10 @@ mod imp {
}
}
#[must_use]
/// Saves image with operations applies
///
/// Returns `true` if editing and saving was successful
async fn save(&self, current_file: gio::File, new_file: gio::File) -> bool {
let obj = self.obj();
let editor = glycin::Editor::new(current_file);

View file

@ -247,6 +247,11 @@ impl LpWindow {
.set_visible_child(&*self.imp().image_window);
}
pub fn show_specific_image(&self, file: gio::File) {
self.image_view().set_images_from_files(vec![file]);
self.show_image();
}
pub fn show_edit(&self) {
if let Some(image) = self.image_view().current_image() {
let edit_child = &*self.imp().edit_window_child;