From 478ab2d7008574e742b0ecc38bffcf27ffe74bf3 Mon Sep 17 00:00:00 2001 From: Michael James Gratton Date: Thu, 20 Oct 2016 16:58:48 +1100 Subject: [PATCH] Use click-to-focus prop on toolbar buttons rather than other workarounds. * src/client/application/geary-controller.vala (GearyController::archive_or_delete_selection_async): Don't modify the focus after archiving/trashing/deleting. * src/client/components/pill-toolbar.vala, ui/composer-headerbar.ui, ui/composer-widget.ui: Ensure all toolbar buttons are focusable but have focus-on-click disabled. --- src/client/application/geary-controller.vala | 14 ++++------ src/client/components/pill-toolbar.vala | 1 + ui/composer-headerbar.ui | 9 ++++++ ui/composer-widget.ui | 29 ++++++++++++++------ 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala index a7a64684..a4c3a1af 100644 --- a/src/client/application/geary-controller.vala +++ b/src/client/application/geary-controller.vala @@ -248,9 +248,9 @@ public class GearyController : Geary.BaseObject { // This is fired after the accounts are ready. Geary.Engine.instance.opened.connect(on_engine_opened); - - main_window.conversation_list_view.grab_focus(); - + + this.main_window.conversation_list_view.grab_focus(); + // instantiate here to ensure that Config is initialized and ready autostart_manager = new AutostartManager(); @@ -2578,10 +2578,6 @@ public class GearyController : Geary.BaseObject { last_deleted_conversation = selected_conversations.size > 0 ? Geary.traverse(selected_conversations).first() : null; - - // Return focus to the conversation list from the clicked - // toolbar button. - this.main_window.conversation_list_view.grab_focus(); this.main_window.conversation_list_view.set_changing_selection(true); @@ -2732,9 +2728,9 @@ public class GearyController : Geary.BaseObject { } private void on_conversation_list() { - main_window.conversation_list_view.grab_focus(); + this.main_window.conversation_list_view.grab_focus(); } - + private void on_sent(Geary.RFC822.Message rfc822) { Libnotify.play_sound("message-sent-email"); } diff --git a/src/client/components/pill-toolbar.vala b/src/client/components/pill-toolbar.vala index 849a94fa..98c9adbe 100644 --- a/src/client/components/pill-toolbar.vala +++ b/src/client/components/pill-toolbar.vala @@ -36,6 +36,7 @@ public interface PillBar : Gtk.Container { public virtual void setup_button(Gtk.Button b, string? icon_name, string action_name, bool show_label = false) { Gtk.Action related_action = action_group.get_action(action_name); + b.focus_on_click = false; b.tooltip_text = related_action.tooltip; related_action.notify["tooltip"].connect(() => { b.tooltip_text = related_action.tooltip; }); b.related_action = related_action; diff --git a/ui/composer-headerbar.ui b/ui/composer-headerbar.ui index cbbdf073..888f2949 100644 --- a/ui/composer-headerbar.ui +++ b/ui/composer-headerbar.ui @@ -13,6 +13,7 @@ True True + False 6 GTK_RELIEF_NONE cmh.detach @@ -39,6 +40,7 @@ True True + False cmh.add-attachment True Attach File (Ctrl+T) @@ -61,6 +63,7 @@ True True + False cmh.add-attachment True Attach File (Ctrl+T) @@ -76,6 +79,7 @@ True True + False cmh.add-original-attachments True Include Original Attachments @@ -94,6 +98,7 @@ True True GTK_RELIEF_NONE + False True @@ -117,6 +122,7 @@ True True + False 6 GTK_RELIEF_NONE cmh.detach @@ -139,6 +145,7 @@ True True + False cmh.send True True @@ -163,6 +170,7 @@ True True + False cmh.close-and-discard True Discard and Close @@ -178,6 +186,7 @@ True True + False cmh.close-and-save True Save and Close diff --git a/ui/composer-widget.ui b/ui/composer-widget.ui index d20c392d..9461beaa 100644 --- a/ui/composer-widget.ui +++ b/ui/composer-widget.ui @@ -369,9 +369,10 @@ - False True cmp.bold + True + False Bold (Ctrl+B) @@ -384,7 +385,8 @@ - False + True + False cmp.italic True Italic (Ctrl+I) @@ -399,7 +401,8 @@ - False + True + False cmp.underline True Underline (Ctrl+U) @@ -414,7 +417,8 @@ - False + True + False cmp.strikethrough True Strikethrough (Ctrl+K) @@ -438,7 +442,8 @@ True - False + True + False cmp.indent True Quote text (Ctrl+]) @@ -453,7 +458,8 @@ True - False + True + False cmp.outdent True Unquote text (Ctrl+[) @@ -477,7 +483,8 @@ - False + True + False cmp.insert-link True Link (Ctrl+L) @@ -498,6 +505,7 @@ True + False False Image (Ctrl+G) cmp.insert-image @@ -521,9 +529,10 @@ True - False True cmp.remove-format + True + False Remove formatting (Ctrl+Space) @@ -536,7 +545,8 @@ True - False + True + False cmp.select-dictionary True Select spell checking language @@ -552,6 +562,7 @@ True False + False end