[balsa] mailbox: Do not sort if empty



commit 9dabff4a2e429e9676c8d842baa996c6cffd0b5e
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Tue Oct 13 19:32:06 2020 -0400

    mailbox: Do not sort if empty
    
    Also: mailbox-local: Make sure to set messages-threaded even for a natural mailbox view
    (i.e., unthreaded and sorted by message number).
    
    The mailbox change addresses https://gitlab.gnome.org/GNOME/balsa/-/issues/44,
    with luck, to fix it.

 libbalsa/mailbox.c       | 2 +-
 libbalsa/mailbox_local.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/libbalsa/mailbox.c b/libbalsa/mailbox.c
index 8380ad66c..27260f046 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -2384,7 +2384,7 @@ lbm_set_threading(LibBalsaMailbox * mailbox)
     LIBBALSA_MAILBOX_GET_CLASS(mailbox)->set_threading(mailbox,
                                                        priv->view->threading_type);
 
-    if (priv->sort_idle_id == 0)
+    if (libbalsa_mailbox_total_messages(mailbox) > 0 && priv->sort_idle_id == 0)
         priv->sort_idle_id = g_idle_add((GSourceFunc) lbm_sort_idle_cb, mailbox);
 
     return TRUE;
diff --git a/libbalsa/mailbox_local.c b/libbalsa/mailbox_local.c
index 6f9f90c67..f16959bf1 100644
--- a/libbalsa/mailbox_local.c
+++ b/libbalsa/mailbox_local.c
@@ -1242,7 +1242,8 @@ libbalsa_mailbox_local_set_threading(LibBalsaMailbox * mailbox,
 
         g_debug("after load messages: time=%lu", (unsigned long) time(NULL));
         if (natural) {
-            /* No need to thread. */
+            /* No need to thread, but we must set the flag. */
+            libbalsa_mailbox_set_messages_threaded(mailbox, TRUE);
             return;
         }
     }


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