[balsa] mailbox: Do not sort until messages are threaded



commit 450b7c700eb67103ba34584753b715862d083588
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sat Feb 1 13:14:15 2020 -0500

    mailbox: Do not sort until messages are threaded
    
    * libbalsa/mailbox.c (lbm_set_threading_idle_cb): if threading
      is not complete, reschedule the handler; also drop
      lbm_check_and_sort()--it did not check, and sorting can be done in line.

 ChangeLog          |  9 +++++++++
 libbalsa/mailbox.c | 22 ++++++++++------------
 2 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 66312c02a..b499415d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2020-02-01  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       mailbox: Do not sort until messages are threaded.
+
+       * libbalsa/mailbox.c (lbm_set_threading_idle_cb): if threading
+       is not complete, reschedule the handler; also drop
+       lbm_check_and_sort()--it did not check, and sorting can be done
+       in line.
+
 2020-01-31  Peter Bloomfield  <pbloomfield bellsouth net>
 
        Message threading cleanup
diff --git a/libbalsa/mailbox.c b/libbalsa/mailbox.c
index fa5cb8a73..5eff0a69f 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -2313,24 +2313,22 @@ libbalsa_mailbox_can_do(LibBalsaMailbox *mailbox,
 
 static void lbm_sort(LibBalsaMailbox * mailbox, GNode * parent);
 
-static void
-lbm_check_and_sort(LibBalsaMailbox * mailbox)
-{
-    LibBalsaMailboxPrivate *priv = libbalsa_mailbox_get_instance_private(mailbox);
-
-    if (priv->msg_tree)
-        lbm_sort(mailbox, priv->msg_tree);
-
-    libbalsa_mailbox_changed(mailbox);
-}
-
 static gboolean
 lbm_set_threading_idle_cb(LibBalsaMailbox * mailbox)
 {
     LibBalsaMailboxPrivate *priv = libbalsa_mailbox_get_instance_private(mailbox);
 
     libbalsa_lock_mailbox(mailbox);
-    lbm_check_and_sort(mailbox);
+
+    if (!priv->messages_threaded) {
+        libbalsa_unlock_mailbox(mailbox);
+        return G_SOURCE_CONTINUE;
+    }
+
+    if (priv->msg_tree != NULL)
+        lbm_sort(mailbox, priv->msg_tree);
+
+    libbalsa_mailbox_changed(mailbox);
 
     priv->set_threading_idle_id = 0;
     libbalsa_unlock_mailbox(mailbox);


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