[balsa/temp] Cleanup



commit c9a31846de840e19b561ac921cba49d2c15d4357
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Thu Jan 16 11:02:44 2020 -0500

    Cleanup
    
    * libbalsa/mailbox_local.c (lbm_local_restore_tree): fix a thinko;
      (libbalsa_mailbox_local_set_threading): set messages-loaded as
      well as messages-threaded when the tree is successfully restored
      from the cache.
    * src/main-window.c (bw_real_open_mbnode_idle_cb),
      (balsa_window_real_open_mbnode): add the mailbox to the list of
      open mailboxes as soon as we know it's not already there.

 ChangeLog                | 13 +++++++++++++
 libbalsa/mailbox_local.c |  8 ++++++--
 src/main-window.c        |  3 +--
 3 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f681bc32e..d495f5244 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2020-01-16  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       Cleanup
+
+       * libbalsa/mailbox_local.c (lbm_local_restore_tree): fix a
+       thinko;
+       (libbalsa_mailbox_local_set_threading): set messages-loaded as
+       well as messages-threaded when the tree is successfully restored
+       from the cache.
+       * src/main-window.c (bw_real_open_mbnode_idle_cb),
+       (balsa_window_real_open_mbnode): add the mailbox to the list of
+       open mailboxes as soon as we know it's not already there.
+
 2020-01-13  Peter Bloomfield  <pbloomfield bellsouth net>
 
        balsa-index: Use a low priority idle handler instead of a
diff --git a/libbalsa/mailbox_local.c b/libbalsa/mailbox_local.c
index 22d0fe474..8fd3ef9fc 100644
--- a/libbalsa/mailbox_local.c
+++ b/libbalsa/mailbox_local.c
@@ -662,7 +662,7 @@ lbm_local_restore_tree(LibBalsaMailboxLocal * local, guint * total)
                 /* Check one level higher. */
                 sibling = parent;
                 parent = parent->parent;
-                if (parent != NULL) {
+                if (parent == NULL) {
                     /* We got to the root without finding the parent. */
                     libbalsa_information(LIBBALSA_INFORMATION_DEBUG,
                                          _("Cache file for mailbox %s "
@@ -1188,6 +1188,7 @@ libbalsa_mailbox_local_set_threading(LibBalsaMailbox * mailbox,
 
         libbalsa_mailbox_set_msg_tree(mailbox, g_node_new(NULL));
         if (lbm_local_restore_tree(local, &total)) {
+            libbalsa_mailbox_set_messages_loaded(mailbox, TRUE);
             libbalsa_mailbox_set_messages_threaded(mailbox, TRUE);
         } else {
             /* Bad or no cache file: start over. */
@@ -1219,7 +1220,10 @@ libbalsa_mailbox_local_set_threading(LibBalsaMailbox * mailbox,
         }
     }
 
-    { /* Scope */
+    if (libbalsa_mailbox_total_messages(mailbox) == 0) {
+        /* Nothing to thread, but we must set the flag. */
+        libbalsa_mailbox_set_messages_threaded(mailbox, TRUE);
+    } else {
         LbmlSetThreadingInfo *info;
 
         info = g_new(LbmlSetThreadingInfo, 1);
diff --git a/src/main-window.c b/src/main-window.c
index 0fbe2895e..bd4ebe84a 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -2924,8 +2924,6 @@ bw_real_open_mbnode_idle_cb(BalsaWindowRealOpenMbnodeInfo * info)
         gtk_notebook_set_current_page(GTK_NOTEBOOK(priv->notebook),
                                       page_num);
 
-    bw_register_open_mailbox(mailbox);
-
     libbalsa_mailbox_set_threading(mailbox);
 
     filter =
@@ -3014,6 +3012,7 @@ balsa_window_real_open_mbnode(BalsaWindow * window,
 
     if (bw_is_open_mailbox(mailbox = balsa_mailbox_node_get_mailbox(mbnode)))
         return;
+    bw_register_open_mailbox(mailbox);
 
     index = BALSA_INDEX(balsa_index_new());
     balsa_index_set_width_preference


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