Changed the logic of app.quit accelerator, introduced a dialog in it.

Also made functions such is_save_senstive() and save_overwrite()
publicly accessible for logic building.

Part-of: <https://gitlab.gnome.org/GNOME/loupe/-/merge_requests/576>
This commit is contained in:
Abhinandan Thakur 2026-02-19 12:16:05 +05:30 • committed by Marge Bot
parent f2d4fa6e0d
commit eb4e5c469a
3 changed files with 14 additions and 9 deletions

View file

@ -169,7 +169,8 @@ impl LpApplication {
app_clone.quit();
}
"save" => {
edit_window_clone.save_as();
edit_window_clone
.save_as_and_quit(app_clone.clone());
}
_ => {}
}

View file

@ -25,6 +25,7 @@ use glycin::Operations;
use super::LpImage;
use super::edit::LpEditCrop;
use crate::LpApplication;
use crate::deps::*;
use crate::util::ErrorType;
use crate::util::gettext::*;
@ -489,12 +490,15 @@ impl LpEditWindow {
self.imp().is_save_sensitive()
}
pub fn save_as(&self) {
pub fn save_as_and_quit(&self, app: LpApplication) {
glib::spawn_future_local(glib::clone!(
#[weak(rename_to=win)]
self,
#[strong]
app,
async move {
win.imp().save_overwrite().await;
app.quit()
}
));
}

View file

@ -168,6 +168,13 @@ impl LpWindow {
self.set_fullscreened(fullscreen);
}
pub fn edit_window(&self) -> Option<LpEditWindow> {
self.imp()
.edit_window_child
.child()
.and_then(|w| w.downcast::<LpEditWindow>().ok())
}
pub fn resize_default(&self) {
let imp = self.imp();
@ -268,13 +275,6 @@ impl LpWindow {
}
}
pub fn edit_window(&self) -> Option<LpEditWindow> {
self.imp()
.edit_window_child
.child()
.and_then(|w| w.downcast::<LpEditWindow>().ok())
}
pub fn image_view(&self) -> LpImageView {
self.imp().image_window.image_view()
}