[geary/wip/draft-management: 1/7] Allow saving drafts when closing composer due to view change
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/draft-management: 1/7] Allow saving drafts when closing composer due to view change
- Date: Fri, 2 Aug 2019 01:52:58 +0000 (UTC)
commit 2db7fef5f538c668219d091f70452382d660596e
Author: Michael Gratton <mike vee net>
Date: Mon Jul 22 22:02:49 2019 +1000
Allow saving drafts when closing composer due to view change
Use the composer's built-in confirm dialog when deciding to close
inline composers due to a new folder/conversation being selected.
See #290
src/client/application/application-controller.vala | 24 +++++++---------------
1 file changed, 7 insertions(+), 17 deletions(-)
---
diff --git a/src/client/application/application-controller.vala
b/src/client/application/application-controller.vala
index 0bb01681..35f7f00a 100644
--- a/src/client/application/application-controller.vala
+++ b/src/client/application/application-controller.vala
@@ -2115,26 +2115,16 @@ public class Application.Controller : Geary.BaseObject {
// Find out what to do with the inline composers.
// TODO: Remove this in favor of automatically saving drafts
- Gee.List<ComposerWidget> composers_to_destroy = new Gee.ArrayList<ComposerWidget>();
this.main_window.present();
+ bool create_okay = true;
foreach (ComposerWidget cw in composer_widgets) {
- if (cw.state != ComposerWidget.ComposerState.DETACHED)
- composers_to_destroy.add(cw);
- }
- string message = ngettext(
- "Close the draft message?",
- "Close all draft messages?",
- composers_to_destroy.size
- );
- ConfirmationDialog dialog = new ConfirmationDialog(
- main_window, message, null, Stock._CLOSE, "destructive-action"
- );
- if (dialog.run() == Gtk.ResponseType.OK) {
- foreach(ComposerWidget cw in composers_to_destroy)
- ((ComposerContainer) cw.parent).close_container();
- return true;
+ if (cw.state != ComposerWidget.ComposerState.DETACHED &&
+ cw.should_close() == ComposerWidget.CloseStatus.CANCEL_CLOSE) {
+ create_okay = false;
+ break;
+ }
}
- return false;
+ return create_okay;
}
public bool can_switch_conversation_view() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]