[balsa/gtk3] Fix shrinking message list



commit 8f8db846cb9e4e16c679b6ae3f00738d7ef9df3d
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Wed Jun 22 18:18:30 2016 -0400

    Fix shrinking message list
    
        * src/main-window.c (balsa_window_new),
          (balsa_window_fix_paned): set the size of the elements of the
          main window in an idle callback instead of the window creator;
        * src/main-window.h: export the idle callback;
        * src/main.c (real_main): add the idle call.

 ChangeLog         |   10 ++++++++++
 src/main-window.c |   24 ++++++++++++++++++++----
 src/main-window.h |    1 +
 src/main.c        |    3 +--
 4 files changed, 32 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 43fa5f6..8b96580 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2016-06-22  Albrecht Dreß
+
+       Fix shrinking message list
+
+       * src/main-window.c (balsa_window_new),
+       (balsa_window_fix_paned): set the size of the elements of the
+       main window in an idle callback instead of the window creator;
+       * src/main-window.h: export the idle callback;
+       * src/main.c (real_main): add the idle call.
+
 2016-06-19  Peter Bloomfield  <pbloomfield bellsouth net>
 
        * src/ab-main.c (libbalsa_dialog_flags): set check_done to a
diff --git a/src/main-window.c b/src/main-window.c
index 2266f60..c42d280 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -2248,8 +2248,6 @@ balsa_window_new()
                                balsa_app.show_notebook_tabs);
     gtk_notebook_set_show_border (GTK_NOTEBOOK(window->notebook), FALSE);
     gtk_notebook_set_scrollable (GTK_NOTEBOOK (window->notebook), TRUE);
-    g_signal_connect(G_OBJECT(window->notebook), "size_allocate",
-                     G_CALLBACK(bw_notebook_size_allocate_cb), window);
     g_signal_connect(G_OBJECT(window->notebook), "switch_page",
                      G_CALLBACK(bw_notebook_switch_page_cb), window);
     gtk_drag_dest_set (GTK_WIDGET (window->notebook), GTK_DEST_DEFAULT_ALL,
@@ -2281,8 +2279,6 @@ balsa_window_new()
                       GTK_WIDGET(balsa_app.mblist));
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(window->mblist),
                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-    g_signal_connect(G_OBJECT(balsa_app.mblist), "size_allocate",
-                    G_CALLBACK(bw_mblist_size_allocate_cb), window);
     g_signal_connect_swapped(balsa_app.mblist, "has-unread-mailbox",
                             G_CALLBACK(bw_enable_next_unread), window);
     balsa_mblist_default_signal_bindings(balsa_app.mblist);
@@ -2371,6 +2367,26 @@ balsa_window_new()
     return GTK_WIDGET(window);
 }
 
+gboolean
+balsa_window_fix_paned(BalsaWindow *window)
+{
+    if (balsa_app.show_mblist) {
+        gtk_paned_set_position(GTK_PANED(window->paned_master),
+                               balsa_app.mblist_width);
+    }
+    if (balsa_app.previewpane) {
+        gtk_paned_set_position(GTK_PANED(window->paned_slave),
+                               balsa_app.notebook_height);
+    }
+
+    g_signal_connect(balsa_app.mblist, "size_allocate",
+                     G_CALLBACK(bw_mblist_size_allocate_cb), window);
+    g_signal_connect(window->notebook, "size_allocate",
+                     G_CALLBACK(bw_notebook_size_allocate_cb), window);
+
+    return FALSE;
+}
+
 /*
  * Enable or disable menu items/toolbar buttons which depend
  * on whether there is a mailbox open.
diff --git a/src/main-window.h b/src/main-window.h
index f5117bf..60b2fc1 100644
--- a/src/main-window.h
+++ b/src/main-window.h
@@ -119,6 +119,7 @@ enum {
 
 GType balsa_window_get_type(void);
 GtkWidget *balsa_window_new(void);
+gboolean balsa_window_fix_paned(BalsaWindow *window);
 GtkWidget *balsa_window_find_current_index(BalsaWindow * window);
 void balsa_window_update_book_menus(BalsaWindow *window);
 void balsa_window_refresh(BalsaWindow * window);
diff --git a/src/main.c b/src/main.c
index f775bb4..0b697dc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -693,9 +693,8 @@ real_main(int argc, char *argv[])
 
     balsa_check_open_compose_window();
 
-    gtk_widget_show(window);
-
     g_idle_add((GSourceFunc) scan_mailboxes_idle_cb, NULL);
+    g_idle_add((GSourceFunc) balsa_window_fix_paned, balsa_app.main_window);
     g_timeout_add_seconds(1801, (GSourceFunc) periodic_expunge_cb, NULL);
 
     if (cmd_check_mail_on_startup || balsa_app.check_mail_upon_startup)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]