[balsa] main-window: Do not export balsa_window_fix_paned



commit 62a7327ed3d37d5095f31742169bb2843154da97
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Nov 1 16:12:16 2020 -0500

    main-window: Do not export balsa_window_fix_paned
    
    modified:   src/main-window.c
    modified:   src/main-window.h
    modified:   src/main.c

 ChangeLog         |  9 +++++++
 src/main-window.c | 79 +++++++++++++++++++++++++++++++++----------------------
 src/main-window.h |  1 -
 src/main.c        | 15 -----------
 4 files changed, 56 insertions(+), 48 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7de73686f..4d349156c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2020-11-01  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       main-window: Do not export balsa_window_fix_paned
+
+       * src/main-window.c (bw_fix_panes): it is now local;
+         (bw_set_panes): set the GSource for it;
+       * src/main-window.h: do not export it;
+       * src/main.c (balsa_activate_cb): do not use it.
+
 2020-11-01  Peter Bloomfield  <pbloomfield bellsouth net>
 
        main-window: Fix some geometry
diff --git a/src/main-window.c b/src/main-window.c
index 0b01b7590..1a156ac19 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -579,6 +579,38 @@ bw_create_index_widget(BalsaWindow *bw)
     return vbox;
 }
 
+/*
+ * bw_fix_panes
+ *
+ * Called as either an idle handler or a timeout handler, after the
+ * BalsaWindow has been created
+ */
+
+static gboolean
+bw_fix_panes(BalsaWindow *window)
+{
+    BalsaWindowPrivate *priv = balsa_window_get_instance_private(window);
+
+    if (balsa_app.show_mblist) {
+        gtk_paned_set_position(GTK_PANED(priv->mblist_parent),
+                               balsa_app.mblist_width);
+    }
+
+    g_signal_connect(priv->mblist_parent, "notify::position",
+                     G_CALLBACK(bw_mblist_parent_position_cb), NULL);
+
+    if (priv->notebook_parent != NULL) {
+        if (balsa_app.previewpane) {
+            gtk_paned_set_position(GTK_PANED(priv->notebook_parent),
+                                   balsa_app.notebook_height);
+        }
+        g_signal_connect(priv->notebook_parent, "notify::position",
+                         G_CALLBACK(bw_notebook_parent_position_cb), NULL);
+    }
+
+    return FALSE;
+}
+
 static void
 bw_set_panes(BalsaWindow * window)
 {
@@ -586,6 +618,7 @@ bw_set_panes(BalsaWindow * window)
     GtkWidget *index_widget;
     GtkWidget *bindex;
     BalsaIndexWidthPreference width_preference;
+    const geometry_t *main_size;
 
     if (priv->paned_parent != NULL)
         gtk_container_remove(GTK_CONTAINER(priv->vbox), priv->paned_parent);
@@ -658,6 +691,20 @@ bw_set_panes(BalsaWindow * window)
 
     if ((bindex = balsa_window_find_current_index(window)) != NULL)
         balsa_index_set_width_preference(BALSA_INDEX(bindex), width_preference);
+
+    main_size = geometry_manager_get("MainWindow");
+    g_assert(main_size != NULL);
+    if (main_size->maximized) {
+        /*
+         * When maximized at startup, the window changes from maximized
+         * to not maximized a couple of times, so we wait until it has
+         * stabilized (100 msec is not enough!).
+         */
+        g_timeout_add(800, (GSourceFunc) bw_fix_panes, window);
+    } else {
+        /* No need to wait. */
+        g_idle_add((GSourceFunc) bw_fix_panes, window);
+    }
 }
 
 /* Create the toolbar model for the main window's toolbar.
@@ -2393,38 +2440,6 @@ balsa_window_new(GtkApplication *application)
     return GTK_WIDGET(window);
 }
 
-/*
- * balsa_window_fix_paned
- *
- * Called as either an idle handler or a timeout handler, after the
- * BalsaWindow has been created
- */
-
-gboolean
-balsa_window_fix_paned(BalsaWindow *window)
-{
-    BalsaWindowPrivate *priv = balsa_window_get_instance_private(window);
-
-    if (balsa_app.show_mblist) {
-        gtk_paned_set_position(GTK_PANED(priv->mblist_parent),
-                               balsa_app.mblist_width);
-    }
-
-    g_signal_connect(priv->mblist_parent, "notify::position",
-                     G_CALLBACK(bw_mblist_parent_position_cb), NULL);
-
-    if (priv->notebook_parent != NULL) {
-        if (balsa_app.previewpane) {
-            gtk_paned_set_position(GTK_PANED(priv->notebook_parent),
-                                   balsa_app.notebook_height);
-        }
-        g_signal_connect(priv->notebook_parent, "notify::position",
-                         G_CALLBACK(bw_notebook_parent_position_cb), NULL);
-    }
-
-    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 2373e55f1..1760e129c 100644
--- a/src/main-window.h
+++ b/src/main-window.h
@@ -69,7 +69,6 @@ enum {
 };
 
 GtkWidget *balsa_window_new(GtkApplication *application);
-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 261ca9beb..3fc45220d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -48,7 +48,6 @@
 #include "imap-server.h"
 #include "libbalsa-conf.h"
 #include "autocrypt.h"
-#include "geometry-manager.h"
 
 #include "libinit_balsa/assistant_init.h"
 
@@ -595,7 +594,6 @@ balsa_activate_cb(GApplication *application,
             gpointer      user_data)
 {
     GtkWidget *window;
-    const geometry_t *main_size;
 
     if (balsa_app.main_window != NULL) {
         gtk_window_present_with_time(GTK_WINDOW(balsa_app.main_window),
@@ -611,19 +609,6 @@ balsa_activate_cb(GApplication *application,
     balsa_check_open_compose_window();
 
     g_idle_add((GSourceFunc) scan_mailboxes_idle_cb, NULL);
-    main_size = geometry_manager_get("MainWindow");
-    g_assert(main_size != NULL);
-    if (main_size->maximized) {
-        /*
-         * When maximized at startup, the window changes from maximized
-         * to not maximized a couple of times, so we wait until it has
-         * stabilized (100 msec is not enough!).
-         */
-        g_timeout_add(800, (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);
-    }
     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]