From 8066211f76c3791a3a9b934496455e62bf034e91 Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Tue, 26 Feb 2019 16:54:10 +1100 Subject: [PATCH] Fix main window being closed when Escape pushed and no composer present Fixes #276 --- src/client/composer/composer-widget.vala | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala index 24365816d..8d77d8d67 100644 --- a/src/client/composer/composer-widget.vala +++ b/src/client/composer/composer-widget.vala @@ -47,6 +47,13 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface { } } + // XXX need separate composer close action in addition to the + // default window close action so we can bind Esc to it without + // also binding the default window close action to Esc as + // well. This could probably be fixed by pulling both the main + // window's and composer's actions out of the 'win' action + // namespace, leaving only common window actions there. + private const string ACTION_CLOSE = "composer-close"; private const string ACTION_CUT = "cut"; private const string ACTION_COPY_LINK = "copy-link"; private const string ACTION_PASTE = "paste"; @@ -115,7 +122,8 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface { }; private const ActionEntry[] composer_action_entries = { - {GearyApplication.ACTION_CLOSE, on_close }, + {GearyApplication.ACTION_CLOSE, on_close }, + {ACTION_CLOSE, on_close }, {ACTION_ADD_ATTACHMENT, on_add_attachment }, {ACTION_ADD_ORIGINAL_ATTACHMENTS, on_pending_attachments }, {ACTION_CLOSE_AND_DISCARD, on_close_and_discard }, @@ -130,7 +138,7 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface { public static Gee.MultiMap action_accelerators = new Gee.HashMultiMap(); public static void add_window_accelerators(GearyApplication application) { - application.add_window_accelerators(GearyApplication.ACTION_CLOSE, { "Escape" } ); + application.add_window_accelerators(ACTION_CLOSE, { "Escape" } ); application.add_window_accelerators(ACTION_CUT, { "x" } ); application.add_window_accelerators(ACTION_PASTE, { "v" } ); application.add_window_accelerators(ACTION_PASTE_WITHOUT_FORMATTING, { "v" } ); -- GitLab