[balsa/gtk3] Check that msg_tree has changed in idle handler



commit 5d3fbfc570ead51572c427c1dbaaaec84eeccafc
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Tue Feb 26 18:12:11 2013 -0500

    Check that msg_tree has changed in idle handler
    
        * libbalsa/mailbox_local.c (lbm_local_save_tree_real),
        (lbm_local_queue_save_tree): check that the message tree has
        changed in the idle handler, instead of in the scheduler.

 ChangeLog                |    6 ++++++
 libbalsa/mailbox_local.c |   16 ++++++++--------
 2 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e9caa2d..7ca5287 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2013-02-26  Peter Bloomfield
 
+       * libbalsa/mailbox_local.c (lbm_local_save_tree_real),
+       (lbm_local_queue_save_tree): check that the message tree has
+       changed in the idle handler, instead of in the scheduler.
+
+2013-02-26  Peter Bloomfield
+
        * src/balsa-app.c (append_url_if_open): in_sync is gboolean.
 
 2013-02-26  Peter Bloomfield
diff --git a/libbalsa/mailbox_local.c b/libbalsa/mailbox_local.c
index 62b3652..0066974 100644
--- a/libbalsa/mailbox_local.c
+++ b/libbalsa/mailbox_local.c
@@ -672,14 +672,16 @@ lbm_local_restore_tree(LibBalsaMailboxLocal * local, guint * total)
 static void
 lbm_local_save_tree_real(LibBalsaMailboxLocal * local)
 {
-    libbalsa_lock_mailbox(LIBBALSA_MAILBOX(local));
+    LibBalsaMailbox *mailbox = LIBBALSA_MAILBOX(local);
+
+    libbalsa_lock_mailbox(mailbox);
 
-    if (MAILBOX_OPEN(LIBBALSA_MAILBOX(local)))
+    if (MAILBOX_OPEN(mailbox) && mailbox->msg_tree_changed)
         lbm_local_save_tree(local);
     local->save_tree_id = 0;
     g_object_unref(local);
 
-    libbalsa_unlock_mailbox(LIBBALSA_MAILBOX(local));
+    libbalsa_unlock_mailbox(mailbox);
 }
 
 static gboolean
@@ -701,12 +703,10 @@ lbm_local_save_tree_idle(LibBalsaMailboxLocal * local)
 static void
 lbm_local_queue_save_tree(LibBalsaMailboxLocal * local)
 {
-    if (LIBBALSA_MAILBOX(local)->msg_tree_changed
-        && !local->save_tree_id) {
-        g_object_ref(local);
+    if (!local->save_tree_id)
         local->save_tree_id =
-            g_idle_add((GSourceFunc) lbm_local_save_tree_idle, local);
-    }
+            g_idle_add((GSourceFunc) lbm_local_save_tree_idle,
+                       g_object_ref(local));
 }
 
 /* 


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