From 3c001a99cf142509e578bdd32c4647db6e791385 Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Sun, 11 Apr 2021 18:13:33 +1000 Subject: [PATCH 1/6] client: Fix not activating folder tree rows --- src/client/sidebar/sidebar-tree.vala | 35 +++++++--------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/src/client/sidebar/sidebar-tree.vala b/src/client/sidebar/sidebar-tree.vala index c90285d1..f90f1c25 100644 --- a/src/client/sidebar/sidebar-tree.vala +++ b/src/client/sidebar/sidebar-tree.vala @@ -853,39 +853,22 @@ public class Sidebar.Tree : Gtk.TreeView { return base.button_press_event(event); } - public bool is_keypress_interpreted(Gdk.EventKey event) { - switch (Gdk.keyval_name(event.keyval)) { - case "F2": - case "Delete": - case "Return": - case "KP_Enter": - return true; - - default: - return false; - } - } - public override bool key_press_event(Gdk.EventKey event) { + bool handled = false; switch (Gdk.keyval_name(event.keyval)) { - case "Return": - case "KP_Enter": - Gtk.TreePath? path = get_current_path(); - if (path != null) - toggle_branch_expansion(path); - - return true; - case "F2": - return rename_in_place(); + handled = rename_in_place(); + break; case "Delete": Gtk.TreePath? path = get_current_path(); - - return (path != null) ? destroy_path(path) : false; + handled = (path != null) ? destroy_path(path) : false; + break; } - - return base.key_press_event(event); + if (!handled) { + handled = base.key_press_event(event); + } + return handled; } public bool rename_entry_in_place(Sidebar.Entry entry) { From da611ccf280f461327276382b30949b08768ebb9 Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Sun, 11 Apr 2021 18:15:25 +1000 Subject: [PATCH 2/6] client: Fix main window load_more being triggered folded Don't need to load more when the conversation list is not being shown. --- src/client/application/application-main-window.vala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/application/application-main-window.vala b/src/client/application/application-main-window.vala index d37f8eff..21bc996c 100644 --- a/src/client/application/application-main-window.vala +++ b/src/client/application/application-main-window.vala @@ -1741,7 +1741,8 @@ public class Application.MainWindow : } private void load_more() { - if (this.conversations != null) { + if (this.is_conversation_list_shown && + this.conversations != null) { this.conversations.min_window_count += MIN_CONVERSATION_COUNT; } } From 45bab34f45b5e3c9bf2cca6c2cdf540ff8ec271a Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Wed, 14 Apr 2021 08:55:00 +1000 Subject: [PATCH 3/6] client: Only enable find-in-conversation action when the viewer is shown --- src/client/application/application-main-window.vala | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/client/application/application-main-window.vala b/src/client/application/application-main-window.vala index 21bc996c..fde9aa2d 100644 --- a/src/client/application/application-main-window.vala +++ b/src/client/application/application-main-window.vala @@ -1807,7 +1807,7 @@ public class Application.MainWindow : bool multiple = (count == MULTIPLE); get_window_action(ACTION_FIND_IN_CONVERSATION).set_enabled( - sensitive && !multiple + sensitive && !multiple && this.is_conversation_viewer_shown ); bool reply_sensitive = ( @@ -1846,11 +1846,6 @@ public class Application.MainWindow : sensitive && (selected_folder is Geary.FolderSupport.Remove) ); - this.update_context_dependent_actions.begin(sensitive); - update_conversation_list_actions_revealer(count); - } - - private void update_conversation_list_actions_revealer(ConversationCount count) { switch (count) { case NONE: this.conversation_list_actions_revealer.reveal_child = false; @@ -1864,6 +1859,8 @@ public class Application.MainWindow : this.conversation_list_actions_revealer.reveal_child = true; break; } + + this.update_context_dependent_actions.begin(sensitive); } private void update_trash_action() { @@ -2106,7 +2103,7 @@ public class Application.MainWindow : [GtkCallback] private void on_outer_leaflet_changed() { int selected = this.conversation_list_view.get_selected().size; - update_conversation_list_actions_revealer( + update_conversation_actions( ConversationCount.for_size(selected) ); if (this.has_composer && From 2222c6af87b3b9cd1482083e4bc084fd27e1008a Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Wed, 14 Apr 2021 09:16:49 +1000 Subject: [PATCH 4/6] client: Ensure search UI is actually shown when activating shortcut --- src/client/application/application-main-window.vala | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/client/application/application-main-window.vala b/src/client/application/application-main-window.vala index fde9aa2d..53a48cf0 100644 --- a/src/client/application/application-main-window.vala +++ b/src/client/application/application-main-window.vala @@ -957,6 +957,13 @@ public class Application.MainWindow : /** Displays and focuses the search bar for the window. */ public void show_search_bar(string? text = null) { + if (!this.is_conversation_list_shown) { + if (this.outer_leaflet.folded) { + this.outer_leaflet.set_visible_child_name(INNER_LEAFLET); + } + this.inner_leaflet.set_visible_child_name(CONVERSATION_LIST); + } + this.search_bar.grab_focus(); if (text != null) { this.search_bar.entry.text = text; From 1667a7b2da079d43b48f57b7cf1812ad9ea97cbe Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Wed, 14 Apr 2021 09:17:30 +1000 Subject: [PATCH 5/6] client: Ensure keyboard focus is not lost when main window leaflets fold See GNOME/libhandy#179 --- .../application/application-main-window.vala | 31 ++++++++++++++++--- ui/application-main-window.ui | 2 ++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/client/application/application-main-window.vala b/src/client/application/application-main-window.vala index 53a48cf0..ff87acd5 100644 --- a/src/client/application/application-main-window.vala +++ b/src/client/application/application-main-window.vala @@ -2113,10 +2113,33 @@ public class Application.MainWindow : update_conversation_actions( ConversationCount.for_size(selected) ); - if (this.has_composer && - this.outer_leaflet.folded && - (this.is_folder_list_shown || this.is_conversation_list_shown)) { - close_composer(false, false); + if (this.outer_leaflet.folded) { + // Ensure something useful gets the keyboard focus, given + // GNOME/libhandy#179 + if (this.is_conversation_list_shown) { + this.conversation_list_view.grab_focus(); + } else if (this.is_folder_list_shown) { + this.folder_list.grab_focus(); + } + + // Close any open composer that is no longer visible + if (this.has_composer && + (this.is_folder_list_shown || this.is_conversation_list_shown)) { + close_composer(false, false); + } + } + } + + [GtkCallback] + private void on_inner_leaflet_changed() { + if (this.inner_leaflet.folded) { + // Ensure something useful gets the keyboard focus, given + // GNOME/libhandy#179 + if (this.is_conversation_list_shown) { + this.conversation_list_view.grab_focus(); + } else if (this.is_folder_list_shown) { + this.folder_list.grab_focus(); + } } } diff --git a/ui/application-main-window.ui b/ui/application-main-window.ui index 289c6013..374c14c2 100644 --- a/ui/application-main-window.ui +++ b/ui/application-main-window.ui @@ -30,6 +30,8 @@ True True over + + True From 791b747fbd1d08a4dddce1d6d21287f4532d6415 Mon Sep 17 00:00:00 2001 From: Michael Gratton Date: Wed, 14 Apr 2021 19:05:36 +1000 Subject: [PATCH 6/6] client: Consistently use Gtk.Widget.error_bell, not Gdk.Window.beep The former takes into account GTK settings, the latter doesn't. --- src/client/application/application-main-window.vala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/client/application/application-main-window.vala b/src/client/application/application-main-window.vala index ff87acd5..46f0d929 100644 --- a/src/client/application/application-main-window.vala +++ b/src/client/application/application-main-window.vala @@ -555,7 +555,7 @@ public class Application.MainWindow : activate_action(get_window_action(ACTION_CONVERSATION_DOWN)); break; default: - this.get_window().beep(); + error_bell(); break; } } @@ -1983,7 +1983,7 @@ public class Application.MainWindow : if (focus != null) { focus.focus(TAB_FORWARD); } else { - get_window().beep(); + error_bell(); } } @@ -2023,7 +2023,7 @@ public class Application.MainWindow : if (focus != null) { focus.focus(TAB_FORWARD); } else { - get_window().beep(); + error_bell(); } } @@ -2040,7 +2040,7 @@ public class Application.MainWindow : if (action != null && action.get_enabled()) { action.activate(null); } else { - get_window().beep(); + error_bell(); } } @@ -2423,7 +2423,7 @@ public class Application.MainWindow : } else if (this.is_conversation_viewer_shown) { this.main_toolbar.shown_actions.show_copy_menu(); } else { - this.error_bell(); + error_bell(); } } @@ -2434,7 +2434,7 @@ public class Application.MainWindow : } else if (this.is_conversation_viewer_shown) { this.main_toolbar.shown_actions.show_move_menu(); } else { - this.error_bell(); + error_bell(); } }