balsa r7857 - in trunk: . libbalsa



Author: PeterB
Date: Mon Feb 18 01:47:25 2008
New Revision: 7857
URL: http://svn.gnome.org/viewvc/balsa?rev=7857&view=rev

Log:
avoid unnecessary filter updates

Modified:
   trunk/ChangeLog
   trunk/libbalsa/filter-funcs.c
   trunk/libbalsa/mailbox.c

Modified: trunk/libbalsa/filter-funcs.c
==============================================================================
--- trunk/libbalsa/filter-funcs.c	(original)
+++ trunk/libbalsa/filter-funcs.c	Mon Feb 18 01:47:25 2008
@@ -481,12 +481,17 @@
 /* Helper to compare conditions, a bit obscure at first glance
    but we have to compare complex structure, so we must check
    all fields.
+   NULL conditions are OK, and compare equal only if both are NULL.
 */
 
 gboolean
 libbalsa_condition_compare(LibBalsaCondition *c1,LibBalsaCondition *c2)
 {
     gboolean res = FALSE;
+
+    if (c1 == NULL || c2 == NULL)
+        return c1 == c2;
+
     switch (c1->type) {
     case CONDITION_STRING:
         res = (c2->type == CONDITION_STRING ||

Modified: trunk/libbalsa/mailbox.c
==============================================================================
--- trunk/libbalsa/mailbox.c	(original)
+++ trunk/libbalsa/mailbox.c	Mon Feb 18 01:47:25 2008
@@ -35,6 +35,7 @@
 #include "mailbox-filter.h"
 #include "message.h"
 #include "misc.h"
+#include "filter-funcs.h"
 #include "libbalsa_private.h"
 #include <glib/gi18n.h>
 
@@ -2001,10 +2002,13 @@
                                  LibBalsaCondition *cond,
                                  gboolean update_immediately)
 {
-    gboolean retval = update_immediately;
+    gboolean retval = FALSE;
 
     libbalsa_lock_mailbox(mailbox);
 
+    if (libbalsa_condition_compare(mailbox->view_filter, cond))
+        update_immediately = FALSE;
+
     libbalsa_condition_unref(mailbox->view_filter);
     mailbox->view_filter = libbalsa_condition_ref(cond);
 



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