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:
parent
f2d4fa6e0d
commit
eb4e5c469a
3 changed files with 14 additions and 9 deletions
|
|
@ -169,7 +169,8 @@ impl LpApplication {
|
||||||
app_clone.quit();
|
app_clone.quit();
|
||||||
}
|
}
|
||||||
"save" => {
|
"save" => {
|
||||||
edit_window_clone.save_as();
|
edit_window_clone
|
||||||
|
.save_as_and_quit(app_clone.clone());
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ use glycin::Operations;
|
||||||
|
|
||||||
use super::LpImage;
|
use super::LpImage;
|
||||||
use super::edit::LpEditCrop;
|
use super::edit::LpEditCrop;
|
||||||
|
use crate::LpApplication;
|
||||||
use crate::deps::*;
|
use crate::deps::*;
|
||||||
use crate::util::ErrorType;
|
use crate::util::ErrorType;
|
||||||
use crate::util::gettext::*;
|
use crate::util::gettext::*;
|
||||||
|
|
@ -489,12 +490,15 @@ impl LpEditWindow {
|
||||||
self.imp().is_save_sensitive()
|
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!(
|
glib::spawn_future_local(glib::clone!(
|
||||||
#[weak(rename_to=win)]
|
#[weak(rename_to=win)]
|
||||||
self,
|
self,
|
||||||
|
#[strong]
|
||||||
|
app,
|
||||||
async move {
|
async move {
|
||||||
win.imp().save_overwrite().await;
|
win.imp().save_overwrite().await;
|
||||||
|
app.quit()
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -168,6 +168,13 @@ impl LpWindow {
|
||||||
self.set_fullscreened(fullscreen);
|
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) {
|
pub fn resize_default(&self) {
|
||||||
let imp = self.imp();
|
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 {
|
pub fn image_view(&self) -> LpImageView {
|
||||||
self.imp().image_window.image_view()
|
self.imp().image_window.image_view()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue