[balsa/gtk3] Clean up view filter logic



commit 1919c39acdff9096398950f62feea10336511324
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Thu Mar 21 10:13:01 2013 -0400

    Clean up view filter logic
    
        * libbalsa/mailbox.c (libbalsa_mailbox_set_view_filter): clean
        up logic.

 ChangeLog          |    5 +++++
 libbalsa/mailbox.c |   18 +++++++-----------
 2 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bb8cf1e..4813512 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2013-03-21  Peter Bloomfield
 
+       * libbalsa/mailbox.c (libbalsa_mailbox_set_view_filter): clean
+       up logic.
+
+2013-03-21  Peter Bloomfield
+
        * src/main-window.c: set mailbox view filter on opening, not on
        notebook page change.
 
diff --git a/libbalsa/mailbox.c b/libbalsa/mailbox.c
index bfed9cb..92ddac8 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -2225,24 +2225,20 @@ libbalsa_mailbox_set_view_filter(LibBalsaMailbox *mailbox,
                                  gboolean update_immediately)
 {
     gboolean retval = FALSE;
-    gboolean view_is_stale;
 
     libbalsa_lock_mailbox(mailbox);
 
-    view_is_stale = mailbox->view_filter_pending
-        || !libbalsa_condition_compare(mailbox->view_filter, cond);
+    if (!libbalsa_condition_compare(mailbox->view_filter, cond))
+        mailbox->view_filter_pending = TRUE;
 
     libbalsa_condition_unref(mailbox->view_filter);
     mailbox->view_filter = libbalsa_condition_ref(cond);
 
-    if (view_is_stale) {
-        if (update_immediately) {
-            LIBBALSA_MAILBOX_GET_CLASS(mailbox)->update_view_filter(mailbox,
-                                                                    cond);
-            retval = lbm_set_threading(mailbox, mailbox->view->threading_type);
-            mailbox->view_filter_pending = FALSE;
-        } else
-            mailbox->view_filter_pending = TRUE;
+    if (update_immediately && mailbox->view_filter_pending) {
+        LIBBALSA_MAILBOX_GET_CLASS(mailbox)->update_view_filter(mailbox,
+                                                                cond);
+        retval = lbm_set_threading(mailbox, mailbox->view->threading_type);
+        mailbox->view_filter_pending = FALSE;
     }
 
     libbalsa_unlock_mailbox(mailbox);


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