[balsa/threading: 8/16] Limit use of LibBalsaMailboxThreadingType in src/



commit 3b505e1edfe359153b0bcddaa1c234c3278a7337
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Mon Aug 20 21:26:47 2018 -0400

    Limit use of LibBalsaMailboxThreadingType in src/
    
    Limit use of LibBalsaMailboxThreadingType in src/ to balsa-index.c
    
    * src/main-window.c (threading_change_state): pass
      gboolean thread_messages to balsa-index, instead of
      LibBalsaMailboxThreadingType threading_type;
    * src/balsa-index.c (balsa_index_set_thread_messages): ditto;
    * src/balsa-index.h: change API.

 ChangeLog         | 10 ++++++++++
 src/balsa-index.c | 13 ++++++++-----
 src/balsa-index.h |  4 ++--
 src/main-window.c |  5 +----
 4 files changed, 21 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 95dddb459..1e2d93719 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -37,6 +37,16 @@
          make BalsaWindow::progress_bar a weak pointer and test whether
          it is NULL before dereferencing.
 
+2018-08-20  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       Limit use of LibBalsaMailboxThreadingType in src/ to balsa-index.c
+
+       * src/main-window.c (threading_change_state): pass
+       gboolean thread_messages to balsa-index, instead of
+       LibBalsaMailboxThreadingType threading_type;
+       * src/balsa-index.c (balsa_index_set_thread_messages): ditto;
+       * src/balsa-index.h: change API.
+
 2018-08-19  Peter Bloomfield  <pbloomfield bellsouth net>
 
        Simplify threading
diff --git a/src/balsa-index.c b/src/balsa-index.c
index d885520d7..b260b2526 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -2056,11 +2056,12 @@ balsa_index_update_tree(BalsaIndex * index, gboolean expand)
     bndx_changed_find_row(index);
 }
 
-/* balsa_index_set_threading_type: public method. */
+/* balsa_index_set_thread_messages: public method. */
 void
-balsa_index_set_threading_type(BalsaIndex * index,
-                               LibBalsaMailboxThreadingType threading_type)
+balsa_index_set_thread_messages(BalsaIndex * index,
+                                gboolean thread_messages)
 {
+    LibBalsaMailboxThreadingType threading_type;
     LibBalsaMailbox *mailbox;
 
     g_return_if_fail(index != NULL);
@@ -2068,11 +2069,13 @@ balsa_index_set_threading_type(BalsaIndex * index,
     mailbox = index->mailbox_node->mailbox;
     g_return_if_fail(mailbox != NULL);
 
+    threading_type =
+        thread_messages ? LB_MAILBOX_THREADING_SIMPLE : LB_MAILBOX_THREADING_FLAT;
+
     if (threading_type == libbalsa_mailbox_get_threading_type(mailbox))
         return;
 
-    if (threading_type != LB_MAILBOX_THREADING_FLAT
-        && !libbalsa_mailbox_prepare_threading(mailbox, 0))
+    if (thread_messages && !libbalsa_mailbox_prepare_threading(mailbox, 0))
         return;
 
     libbalsa_mailbox_set_threading_type(mailbox, threading_type);
diff --git a/src/balsa-index.h b/src/balsa-index.h
index 0f584f119..fee4ccc5f 100644
--- a/src/balsa-index.h
+++ b/src/balsa-index.h
@@ -107,8 +107,8 @@ G_BEGIN_DECLS
                                           BalsaIndexWidthPreference pref);
     void balsa_index_scroll_on_open(BalsaIndex *index);
     void balsa_index_update_tree(BalsaIndex *bindex, gboolean expand);
-    void balsa_index_set_threading_type(BalsaIndex * bindex,
-                                        LibBalsaMailboxThreadingType threading_type);
+    void balsa_index_set_thread_messages(BalsaIndex * bindex,
+                                         gboolean thread_messages);
     void balsa_index_set_view_filter(BalsaIndex *bindex,
                                      int filter_no,
                                      const gchar *filter_string,
diff --git a/src/main-window.c b/src/main-window.c
index 6e77fcac3..fbe39b55e 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -1863,16 +1863,13 @@ threading_change_state(GSimpleAction * action,
     BalsaWindow *window = BALSA_WINDOW(user_data);
     GtkWidget *index;
     gboolean thread_messages;
-    LibBalsaMailboxThreadingType threading_type;
     BalsaMailboxNode *mbnode;
     LibBalsaMailbox *mailbox;
 
     thread_messages = g_variant_get_boolean(state);
-    threading_type =
-        thread_messages ? LB_MAILBOX_THREADING_SIMPLE : LB_MAILBOX_THREADING_FLAT;
 
     index = balsa_window_find_current_index(window);
-    balsa_index_set_threading_type(BALSA_INDEX(index), threading_type);
+    balsa_index_set_thread_messages(BALSA_INDEX(index), thread_messages);
 
     /* bw->current_index may have been destroyed and cleared during
      * set-threading: */


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