[evolution-data-server/gnome-3-10] Bug #720943 - vFolder does not refresh automatically



commit 5132a40347e0afddb4164610f6013b1d56496969
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jan 23 13:42:39 2014 +0100

    Bug #720943 - vFolder does not refresh automatically

 camel/camel-vee-folder.c  |   24 ++++++++++++++++++++++++
 camel/camel-vee-folder.h  |    3 +++
 camel/camel-vee-summary.c |   31 ++++++++++++++++++++++---------
 3 files changed, 49 insertions(+), 9 deletions(-)
---
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 1e870d5..eb56b4a 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -1708,6 +1708,30 @@ camel_vee_folder_ignore_next_changed_event (CamelVeeFolder *vfolder,
 }
 
 /**
+ * camel_vee_folder_remove_from_ignore_changed_event:
+ * @vfolder: a #CamelVeeFolder
+ * @subfolder: a #CamelFolder folder
+ *
+ * Make sure the next @subfolder-'s 'changed' event will not be silently ignored.
+ * This is a counter-part function of camel_vee_folder_ignore_next_changed_event(),
+ * when there was expected a change, which did not happen, to take back the previous
+ * ignore event request.
+ *
+ * Since: 3.10.4
+ **/
+void
+camel_vee_folder_remove_from_ignore_changed_event (CamelVeeFolder *vfolder,
+                                                  CamelFolder *subfolder)
+{
+       g_return_if_fail (CAMEL_IS_VEE_FOLDER (vfolder));
+       g_return_if_fail (subfolder != NULL);
+
+       g_rec_mutex_lock (&vfolder->priv->changed_lock);
+       g_hash_table_remove (vfolder->priv->ignore_changed, subfolder);
+       g_rec_mutex_unlock (&vfolder->priv->changed_lock);
+}
+
+/**
  * camel_vee_folder_lock:
  * @folder: a #CamelVeeFolder
  * @lock: lock type to lock
diff --git a/camel/camel-vee-folder.h b/camel/camel-vee-folder.h
index ea452ef..ffcee0d 100644
--- a/camel/camel-vee-folder.h
+++ b/camel/camel-vee-folder.h
@@ -141,6 +141,9 @@ const gchar *       camel_vee_folder_get_expression         (CamelVeeFolder *vfolder);
 void           camel_vee_folder_ignore_next_changed_event
                                                        (CamelVeeFolder *vfolder,
                                                         CamelFolder *subfolder);
+void           camel_vee_folder_remove_from_ignore_changed_event
+                                                       (CamelVeeFolder *vfolder,
+                                                        CamelFolder *subfolder);
 
 void           camel_vee_folder_lock                   (CamelVeeFolder *folder,
                                                         CamelVeeFolderLock lock);
diff --git a/camel/camel-vee-summary.c b/camel/camel-vee-summary.c
index f379999..56e32d3 100644
--- a/camel/camel-vee-summary.c
+++ b/camel/camel-vee-summary.c
@@ -191,10 +191,14 @@ vee_info_set_user_flag (CamelMessageInfo *mi,
 
                res = camel_message_info_set_user_flag (rmi, name, value);
 
-               camel_message_info_free (rmi);
+               if (ignore_changes) {
+                       if (res)
+                               vee_summary_notify_mi_changed (vf, mi);
+                       else
+                               camel_vee_folder_remove_from_ignore_changed_event (vf, 
camel_folder_summary_get_folder (rmi->summary));
+               }
 
-               if (ignore_changes)
-                       vee_summary_notify_mi_changed (vf, mi);
+               camel_message_info_free (rmi);
        }
 
        return res;
@@ -220,10 +224,15 @@ vee_info_set_user_tag (CamelMessageInfo *mi,
                        camel_vee_folder_ignore_next_changed_event (vf, camel_folder_summary_get_folder 
(rmi->summary));
 
                res = camel_message_info_set_user_tag (rmi, name, value);
-               camel_message_info_free (rmi);
 
-               if (ignore_changes)
-                       vee_summary_notify_mi_changed (vf, mi);
+               if (ignore_changes) {
+                       if (res)
+                               vee_summary_notify_mi_changed (vf, mi);
+                       else
+                               camel_vee_folder_remove_from_ignore_changed_event (vf, 
camel_folder_summary_get_folder (rmi->summary));
+               }
+
+               camel_message_info_free (rmi);
        }
 
        return res;
@@ -259,10 +268,14 @@ vee_info_set_flags (CamelMessageInfo *mi,
                        camel_folder_summary_replace_flags (mi->summary, mi);
                }
 
-               camel_message_info_free (rmi);
+               if (ignore_changes) {
+                       if (res)
+                               vee_summary_notify_mi_changed (vf, mi);
+                       else
+                               camel_vee_folder_remove_from_ignore_changed_event (vf, 
camel_folder_summary_get_folder (rmi->summary));
+               }
 
-               if (ignore_changes)
-                       vee_summary_notify_mi_changed (vf, mi);
+               camel_message_info_free (rmi);
        }
 
        /* Do not call parent class' info_set_flags, to not do flood


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