[balsa] Revert a commit and increase a timeout to 600 msec



commit d6130c8e89897e36d1c8b90220a1a9af5070509a
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Thu May 25 10:43:57 2017 -0400

    Revert a commit and increase a timeout to 600 msec
    
        * src/main-window.c (bw_window_state_event_cb), (balsa_window_new),
        (balsa_window_fix_paned): revert 45b7ce83a56690beb40c37f911f7c61b553d8828.
        * src/main.c (real_main): increase the fix-panes timeout from 500 to 600 msec.

 ChangeLog         |    9 +++++++
 src/main-window.c |   65 ++++++++++++++++++++++++----------------------------
 src/main.c        |    2 +-
 3 files changed, 40 insertions(+), 36 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index def05be..f72e297 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-05-25  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       Revert 45b7ce83a56690beb40c37f911f7c61b553d8828, and just
+       increase the timeout from 500 to 600 msec.
+
+       * src/main-window.c (bw_window_state_event_cb), (balsa_window_new),
+       (balsa_window_fix_paned): revert 45b7ce83a56690beb40c37f911f7c61b553d8828.
+       * src/main.c (real_main): increase the fix-panes timeout from 500 to 600 msec.
+
 2017-05-23  Peter Bloomfield  <pbloomfield bellsouth net>
 
        Try to avoid geometry creep
diff --git a/src/main-window.c b/src/main-window.c
index 325f242..dfa1674 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -650,16 +650,20 @@ balsa_window_get_toolbar_model(void)
 }
 
 /*
- * "notify::is-maximized" signal handler
+ * "window-state-event" signal handler
  */
-static void
-bw_notify_is_maximized_cb(GtkWindow  * window,
-                          GParamSpec * pspec,
-                          gpointer     user_data)
+static gboolean
+bw_window_state_event_cb(BalsaWindow * window,
+                         GdkEventWindowState * event,
+                         GtkStatusbar * statusbar)
 {
     /* Note when we are either maximized or fullscreen, to avoid saving
      * nonsensical geometry. */
-    balsa_app.mw_maximized = gtk_window_is_maximized(window);
+    balsa_app.mw_maximized =
+        (event->new_window_state & (GDK_WINDOW_STATE_MAXIMIZED |
+                                    GDK_WINDOW_STATE_FULLSCREEN)) != 0;
+
+    return FALSE;
 }
 
 static void
@@ -2177,32 +2181,6 @@ bw_enable_next_unread(BalsaWindow * window, gboolean has_unread_mailbox)
     bw_action_set_enabled(window, "next-unread", has_unread_mailbox);
 }
 
-static gboolean
-bw_window_new_idle_cb(BalsaWindow * window)
-{
-    if (balsa_app.show_mblist) {
-        gtk_paned_set_position(GTK_PANED(window->paned_master),
-                               balsa_app.mblist_width);
-    } else {
-        gtk_paned_set_position(GTK_PANED(window->paned_master), 0);
-    }
-
-    if (balsa_app.previewpane) {
-        gtk_paned_set_position(GTK_PANED(window->paned_slave),
-                               balsa_app.notebook_height);
-    } else {
-        /* Set it to something really high */
-        gtk_paned_set_position(GTK_PANED(window->paned_slave), G_MAXINT);
-    }
-
-    g_signal_connect(window->paned_master, "notify::position",
-                     G_CALLBACK(bw_master_position_cb), NULL);
-    g_signal_connect(window->paned_slave, "notify::position",
-                     G_CALLBACK(bw_slave_position_cb), NULL);
-
-    return FALSE;
-}
-
 GtkWidget *
 balsa_window_new()
 {
@@ -2255,8 +2233,8 @@ balsa_window_new()
                        0);
 
     window->statusbar = gtk_statusbar_new();
-    g_signal_connect(window, "notify::is-maximized",
-                     G_CALLBACK(bw_notify_is_maximized_cb),
+    g_signal_connect(window, "window-state-event",
+                     G_CALLBACK(bw_window_state_event_cb),
                      window->statusbar);
     gtk_box_pack_start(GTK_BOX(hbox), window->statusbar, TRUE, TRUE, 0);
     gtk_widget_show_all(hbox);
@@ -2314,13 +2292,25 @@ balsa_window_new()
 
     bw_set_panes(window);
 
+    /*PKGW: do it this way, without the usizes. */
     bw_action_set_boolean(window, "show-mailbox-tree",
                           balsa_app.show_mblist);
 
     if (balsa_app.show_mblist) {
         gtk_widget_show(window->mblist);
+        gtk_paned_set_position(GTK_PANED(window->paned_master),
+                               balsa_app.mblist_width);
+    } else {
+        gtk_paned_set_position(GTK_PANED(window->paned_master), 0);
     }
-    g_timeout_add(1000, (GSourceFunc) bw_window_new_idle_cb, window);
+
+    /*PKGW: do it this way, without the usizes. */
+    if (balsa_app.previewpane)
+        gtk_paned_set_position(GTK_PANED(window->paned_slave),
+                               balsa_app.notebook_height);
+    else
+        /* Set it to something really high */
+        gtk_paned_set_position(GTK_PANED(window->paned_slave), G_MAXINT);
 
     gtk_widget_show(window->paned_slave);
     gtk_widget_show(window->paned_master);
@@ -2394,6 +2384,11 @@ balsa_window_fix_paned(BalsaWindow *window)
                                balsa_app.notebook_height);
     }
 
+    g_signal_connect(window->paned_master, "notify::position",
+                     G_CALLBACK(bw_master_position_cb), NULL);
+    g_signal_connect(window->paned_slave, "notify::position",
+                     G_CALLBACK(bw_slave_position_cb), NULL);
+
     return FALSE;
 }
 
diff --git a/src/main.c b/src/main.c
index 0e60381..d26a26c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -615,7 +615,7 @@ real_main(int argc, char *argv[])
          * to not maximized a couple of times, so we wait until it has
          * stabilized (100 msec is not enough!).
          */
-        g_timeout_add(500, (GSourceFunc) balsa_window_fix_paned, balsa_app.main_window);
+        g_timeout_add(600, (GSourceFunc) balsa_window_fix_paned, balsa_app.main_window);
     } else {
         /* No need to wait. */
         g_idle_add((GSourceFunc) balsa_window_fix_paned, balsa_app.main_window);


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