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.
This commit is contained in:
Michael James Gratton 2018-02-07 14:49:59 +11:00
parent 1aa91639b1
commit 2228fe73e7
5 changed files with 16 additions and 5 deletions

View file

@ -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;

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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) {

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.20.2 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkImage" id="archive_image">
@ -24,6 +24,7 @@
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="compose_new_message_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">text-editor-symbolic</property>
</object>
@ -51,6 +52,7 @@
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="search_conversations_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">preferences-system-search-symbolic</property>
</object>
@ -71,6 +73,7 @@
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="empty_menu_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">edit-clear-all-symbolic</property>
</object>
@ -111,6 +114,7 @@
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="reply_sender_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">mail-reply-sender-symbolic</property>
</object>
@ -133,6 +137,7 @@
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="reply_all_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">mail-reply-all-symbolic</property>
</object>
@ -155,6 +160,7 @@
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="forward_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">mail-forward-symbolic</property>
</object>
@ -186,6 +192,7 @@
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="mark_message_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">marker-symbolic</property>
</object>
@ -206,6 +213,7 @@
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="copy_message_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">tag-symbolic</property>
</object>
@ -226,6 +234,7 @@
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="move_message_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">folder-symbolic</property>
</object>
@ -256,6 +265,7 @@
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="find_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">preferences-system-search-symbolic</property>
</object>
@ -276,6 +286,7 @@
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="undo_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">edit-undo-symbolic</property>
</object>
@ -318,6 +329,7 @@
<property name="always_show_image">True</property>
<child>
<object class="GtkImage" id="trash_delete_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">user-trash-symbolic</property>
</object>