From 2228fe73e787e2e5f3ee6e0be0784b1dc7cfbbe6 Mon Sep 17 00:00:00 2001 From: Michael James Gratton Date: Wed, 7 Feb 2018 14:49:59 +1100 Subject: [PATCH] Stop using Gtk.Widget.show_all() on the main window. Using show_all is a pita, since it causes a bunch of bugs whenever we need to conditionally show/hide widgets. This removes all uses on the main window in favour of either just show() or present(), and ensures that its widgets that are shown by default, are shown by default. --- src/client/application/geary-application.vala | 1 - src/client/application/geary-controller.vala | 3 +-- src/client/application/secret-mediator.vala | 1 - src/client/components/main-window.vala | 2 ++ ui/main-toolbar.ui | 14 +++++++++++++- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala index cb83a49d..48f0ea6b 100644 --- a/src/client/application/geary-application.vala +++ b/src/client/application/geary-application.vala @@ -224,7 +224,6 @@ public class GearyApplication : Gtk.Application { // When the app is started hidden, show_all() never gets // called, do so here to prevent an empty window appearing. - controller.main_window.show_all(); controller.main_window.present(); return true; diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala index 524ce1a5..c9d34065 100644 --- a/src/client/application/geary-controller.vala +++ b/src/client/application/geary-controller.vala @@ -1198,7 +1198,7 @@ public class GearyController : Geary.BaseObject { !upgrade_dialog.visible && !cancellable_open_account.is_cancelled() && !Args.hidden_startup) - main_window.show_all(); + main_window.show(); } /** @@ -1441,7 +1441,6 @@ public class GearyController : Geary.BaseObject { private void on_indicator_activated_application(uint32 timestamp) { // When the app is started hidden, show_all() never gets // called, do so here to prevent an empty window appearing. - main_window.show_all(); main_window.present_with_time(timestamp); } diff --git a/src/client/application/secret-mediator.vala b/src/client/application/secret-mediator.vala index 61731a25..5ed538cf 100644 --- a/src/client/application/secret-mediator.vala +++ b/src/client/application/secret-mediator.vala @@ -118,7 +118,6 @@ public class SecretMediator : Geary.CredentialsMediator, Object { // If the main window is hidden, make it visible now and present to user as transient parent Gtk.Window? main_window = this.instance.get_active_window(); if (main_window != null && !main_window.visible) { - main_window.show_all(); main_window.present_with_time(Gdk.CURRENT_TIME); } diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala index 61dbaa9d..e5cd7db6 100644 --- a/src/client/components/main-window.vala +++ b/src/client/components/main-window.vala @@ -76,6 +76,8 @@ public class MainWindow : Gtk.ApplicationWindow { set_styling(); setup_layout(application.config); on_change_orientation(); + + this.main_layout.show_all(); } public void show_infobar(MainWindowInfoBar info_bar) { diff --git a/ui/main-toolbar.ui b/ui/main-toolbar.ui index 030f59cc..d5c60e38 100644 --- a/ui/main-toolbar.ui +++ b/ui/main-toolbar.ui @@ -1,5 +1,5 @@ - + @@ -24,6 +24,7 @@ True + True False text-editor-symbolic @@ -51,6 +52,7 @@ True + True False preferences-system-search-symbolic @@ -71,6 +73,7 @@ True + True False edit-clear-all-symbolic @@ -111,6 +114,7 @@ True + True False mail-reply-sender-symbolic @@ -133,6 +137,7 @@ True + True False mail-reply-all-symbolic @@ -155,6 +160,7 @@ True + True False mail-forward-symbolic @@ -186,6 +192,7 @@ True + True False marker-symbolic @@ -206,6 +213,7 @@ True + True False tag-symbolic @@ -226,6 +234,7 @@ True + True False folder-symbolic @@ -256,6 +265,7 @@ True + True False preferences-system-search-symbolic @@ -276,6 +286,7 @@ True + True False edit-undo-symbolic @@ -318,6 +329,7 @@ True + True False user-trash-symbolic