Hi all, I investigated the effect of the "shrinking message list" (see [1], item 1) in more depth. Running balsa in gdb, it seems that the events occur in gtk_main() which is difficult to catch.
Following a hint on the Internet, the only (and also simple) solution seems to be an idle callback which rolls back the tiny adjustments made to the GtkPaned position after all child widgets have finally been drawn in the main loop. The attached patch implements this, by simply rolling back these adjustments and shifting the connection to the signal handlers to the idle callback. I also noticed that the main window is shown twice, so I removed the respective call in main.c (alternative: remove the call in src/main-window.c, line 2366). Opinions? Cheers, Albrecht. [1] <https://mail.gnome.org/archives/balsa-list/2016-March/msg00013.html>
diff --git a/src/main-window.c b/src/main-window.c
index 2266f60..8faedf3 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(G_OBJECT(balsa_app.mblist), "size_allocate",
+ G_CALLBACK(bw_mblist_size_allocate_cb), window);
+ g_signal_connect(G_OBJECT(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)
pgph80Hl7CTY8.pgp
Description: PGP signature
_______________________________________________ balsa-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/balsa-list
