[evolution-data-server] Bug #562912 - Unread vfolder marks unread messages as read
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug #562912 - Unread vfolder marks unread messages as read
- Date: Tue, 23 Aug 2011 11:19:59 +0000 (UTC)
commit a8df571c854082495231cc0c662df35c018c3e29
Author: Milan Crha <mcrha redhat com>
Date: Tue Aug 23 13:19:30 2011 +0200
Bug #562912 - Unread vfolder marks unread messages as read
camel/camel-vee-folder.c | 208 +++++++++++++++++++++------------------------
camel/camel-vee-folder.h | 8 +--
camel/camel-vee-summary.c | 114 ++++---------------------
camel/camel-vee-summary.h | 4 -
4 files changed, 118 insertions(+), 216 deletions(-)
---
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 1893b2e..3fdb807 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -49,11 +49,12 @@ struct _CamelVeeFolderPrivate {
gboolean destroyed;
GList *folders; /* lock using subfolder_lock before changing/accessing */
GList *folders_changed; /* for list of folders that have changed between updates */
+ GHashTable *ignore_changed; /* hash of subfolder pointers to ignore the next folder's 'changed' signal */
+ GHashTable *skipped_changes; /* CamelFolder -> CamelFolderChangeInfo accumulating ignored changes */
GMutex *summary_lock; /* for locking vfolder summary */
GMutex *subfolder_lock; /* for locking the subfolder list */
GMutex *changed_lock; /* for locking the folders-changed list */
- gint unread_vfolder;
};
struct _update_data {
@@ -781,29 +782,6 @@ folder_added_uid (gchar *uidin, gpointer value, struct _update_data *u)
camel_message_info_free ((CamelMessageInfo *) mi);
}
-static gint
-count_result (CamelFolderSummary *summary,
- const gchar *query,
- GError **error)
-{
- CamelFolder *folder = summary->folder;
- CamelVeeFolder *vf = (CamelVeeFolder *) folder;
- guint32 count=0;
- gchar *expr = g_strdup_printf ("(and %s %s)", vf->expression ? vf->expression : "", query);
- GList *node;
- CamelVeeFolderPrivate *p = vf->priv;
-
- node = p->folders;
- while (node) {
- CamelFolder *f = node->data;
- count += camel_folder_count_by_expression (f, expr, error);
- node = node->next;
- }
-
- g_free (expr);
- return count;
-}
-
static CamelFIRecord *
summary_header_to_db (CamelFolderSummary *s,
GError **error)
@@ -823,35 +801,11 @@ summary_header_to_db (CamelFolderSummary *s,
record->time = s->time;
record->saved_count = s->uids->len;
-
- if (1) { /* We always would do this. Just refactor the code again. */
- /*!(((CamelVeeSummary *) s)->force_counts) && !g_getenv ("FORCE_VFOLDER_COUNT")) {*/
- /* We should be in sync always. so use the count. Don't search.*/
- record->junk_count = s->junk_count;
- record->deleted_count = s->deleted_count;
- record->unread_count = s->unread_count;
-
- if (((CamelVeeSummary *) s)->fake_visible_count)
- record->visible_count = ((CamelVeeSummary *) s)->fake_visible_count;
- else
- record->visible_count = s->visible_count;
- ((CamelVeeSummary *) s)->fake_visible_count = 0;
-
- record->jnd_count = s->junk_not_deleted_count;
- } else {
- /* Either first time, or by force we search the count */
- s->junk_count = count_result (s, "(match-all (system-flag \"junk\"))", NULL);
- s->deleted_count = count_result (s, "(match-all (system-flag \"deleted\"))", NULL);
- s->unread_count = count_result (s, "(match-all (not (system-flag \"Seen\")))", NULL);
- s->visible_count = count_result (s, "(match-all (and (not (system-flag \"deleted\")) (not (system-flag \"junk\"))))", NULL);
- s->junk_not_deleted_count = count_result (s, "(match-all (and (not (system-flag \"deleted\")) (system-flag \"junk\")))", NULL);
-
- record->junk_count = s->junk_count;
- record->deleted_count = s->deleted_count;
- record->unread_count = s->unread_count;
- record->visible_count = s->visible_count;
- record->jnd_count = s->junk_not_deleted_count;
- }
+ record->junk_count = s->junk_count;
+ record->deleted_count = s->deleted_count;
+ record->unread_count = s->unread_count;
+ record->visible_count = s->visible_count;
+ record->jnd_count = s->junk_not_deleted_count;
return record;
}
@@ -863,6 +817,24 @@ folder_changed (CamelFolder *sub,
{
CamelVeeFolderClass *class;
+ g_return_if_fail (vee_folder != NULL);
+ g_return_if_fail (CAMEL_IS_VEE_FOLDER (vee_folder));
+
+ camel_vee_folder_lock (vee_folder, CAMEL_VEE_FOLDER_CHANGED_LOCK);
+ if (g_hash_table_lookup (vee_folder->priv->ignore_changed, sub)) {
+ CamelFolderChangeInfo *old_changes;
+ g_hash_table_remove (vee_folder->priv->ignore_changed, sub);
+
+ old_changes = g_hash_table_lookup (vee_folder->priv->skipped_changes, sub);
+ if (!old_changes)
+ old_changes = camel_folder_change_info_new ();
+ camel_folder_change_info_cat (old_changes, changes);
+ g_hash_table_insert (vee_folder->priv->skipped_changes, sub, old_changes);
+ camel_vee_folder_unlock (vee_folder, CAMEL_VEE_FOLDER_CHANGED_LOCK);
+ return;
+ }
+ camel_vee_folder_unlock (vee_folder, CAMEL_VEE_FOLDER_CHANGED_LOCK);
+
class = CAMEL_VEE_FOLDER_GET_CLASS (vee_folder);
class->folder_changed (vee_folder, sub, changes);
}
@@ -1013,6 +985,12 @@ vee_folder_dispose (GObject *object)
}
static void
+free_change_info_cb (gpointer folder, gpointer change_info, gpointer user_data)
+{
+ camel_folder_change_info_free (change_info);
+}
+
+static void
vee_folder_finalize (GObject *object)
{
CamelVeeFolder *vf;
@@ -1027,15 +1005,49 @@ vee_folder_finalize (GObject *object)
camel_folder_change_info_free (vf->changes);
g_object_unref (vf->search);
+ g_hash_table_foreach (vf->priv->skipped_changes, free_change_info_cb, NULL);
+
g_mutex_free (vf->priv->summary_lock);
g_mutex_free (vf->priv->subfolder_lock);
g_mutex_free (vf->priv->changed_lock);
g_hash_table_destroy (vf->hashes);
+ g_hash_table_destroy (vf->priv->ignore_changed);
+ g_hash_table_destroy (vf->priv->skipped_changes);
/* Chain up to parent's finalize () method. */
G_OBJECT_CLASS (camel_vee_folder_parent_class)->finalize (object);
}
+static void
+vee_folder_propagate_skipped_changes (CamelVeeFolder *vf)
+{
+ CamelVeeFolderClass *klass;
+ GHashTableIter iter;
+ gpointer psub, pchanges;
+
+ g_return_if_fail (vf != NULL);
+
+ klass = CAMEL_VEE_FOLDER_GET_CLASS (vf);
+
+ camel_vee_folder_lock (vf, CAMEL_VEE_FOLDER_CHANGED_LOCK);
+
+ g_hash_table_iter_init (&iter, vf->priv->skipped_changes);
+ while (g_hash_table_iter_next (&iter, &psub, &pchanges)) {
+ g_warn_if_fail (pchanges != NULL);
+ if (!pchanges)
+ continue;
+
+ if (g_list_find (vf->priv->folders, psub) != NULL)
+ klass->folder_changed (vf, psub, pchanges);
+
+ camel_folder_change_info_free (pchanges);
+ }
+
+ g_hash_table_remove_all (vf->priv->skipped_changes);
+
+ camel_vee_folder_unlock (vf, CAMEL_VEE_FOLDER_CHANGED_LOCK);
+}
+
static GPtrArray *
vee_folder_search_by_expression (CamelFolder *folder,
const gchar *expression,
@@ -1051,6 +1063,8 @@ vee_folder_search_by_expression (CamelFolder *folder,
gboolean is_folder_unmatched = vf == folder_unmatched && folder_unmatched;
GHashTable *folder_unmatched_hash = NULL;
+ vee_folder_propagate_skipped_changes (vf);
+
if (is_folder_unmatched) {
expr = g_strdup (expression);
folder_unmatched_hash = camel_folder_summary_get_hashtable (((CamelFolder *) folder_unmatched)->summary);
@@ -1110,6 +1124,8 @@ vee_folder_search_by_uids (CamelFolder *folder,
CamelVeeFolderPrivate *p = vf->priv;
GHashTable *searched = g_hash_table_new (NULL, NULL);
+ vee_folder_propagate_skipped_changes (vf);
+
camel_vee_folder_lock (vf, CAMEL_VEE_FOLDER_SUBFOLDER_LOCK);
expr = g_strdup_printf ("(and %s %s)", vf->expression ? vf->expression : "", expression);
@@ -1173,6 +1189,8 @@ vee_folder_count_by_expression (CamelFolder *folder,
GHashTable *searched = g_hash_table_new (NULL, NULL);
CamelVeeFolder *folder_unmatched = vf->parent_vee_store ? vf->parent_vee_store->folder_unmatched : NULL;
+ vee_folder_propagate_skipped_changes (vf);
+
if (vf != folder_unmatched)
expr = g_strdup_printf ("(and %s %s)", vf->expression ? vf->expression : "", expression);
else
@@ -1286,9 +1304,6 @@ vee_folder_expunge_sync (CamelFolder *folder,
GCancellable *cancellable,
GError **error)
{
- /* Force it to rebuild the counts, when some folders were expunged. */
- ((CamelVeeSummary *) folder->summary)->force_counts = TRUE;
-
return CAMEL_FOLDER_GET_CLASS (folder)->
synchronize_sync (folder, TRUE, cancellable, error);
}
@@ -1329,6 +1344,8 @@ vee_folder_refresh_info_sync (CamelFolder *folder,
GList *node, *list;
gboolean success = TRUE;
+ vee_folder_propagate_skipped_changes (vf);
+
camel_vee_folder_lock (vf, CAMEL_VEE_FOLDER_CHANGED_LOCK);
list = p->folders_changed;
p->folders_changed = NULL;
@@ -1361,9 +1378,7 @@ vee_folder_synchronize_sync (CamelFolder *folder,
CamelVeeFolderPrivate *p = vf->priv;
GList *node;
- if (((CamelVeeSummary *) folder->summary)->fake_visible_count)
- folder->summary->visible_count = ((CamelVeeSummary *) folder->summary)->fake_visible_count;
- ((CamelVeeSummary *) folder->summary)->fake_visible_count = 0;
+ vee_folder_propagate_skipped_changes (vf);
camel_vee_folder_lock (vf, CAMEL_VEE_FOLDER_SUBFOLDER_LOCK);
@@ -1393,7 +1408,7 @@ vee_folder_synchronize_sync (CamelFolder *folder,
node = node->next;
}
- if (vf->priv->unread_vfolder == 1) {
+ if (!CAMEL_IS_VTRASH_FOLDER (vf)) {
/* Cleanup Junk/Trash uids */
CamelStore *parent_store;
const gchar *full_name;
@@ -1931,7 +1946,7 @@ vee_folder_rebuild_folder (CamelVeeFolder *vee_folder,
parent_store->cdb_w,
full_name, shash, del_list, NULL);
}
- ((CamelVeeSummary *) folder->summary)->force_counts = TRUE;
+
g_slist_foreach (del_list, (GFunc) camel_pstring_free, NULL);
g_slist_free (del_list);
};
@@ -2075,7 +2090,8 @@ camel_vee_folder_init (CamelVeeFolder *vee_folder)
vee_folder->priv->summary_lock = g_mutex_new ();
vee_folder->priv->subfolder_lock = g_mutex_new ();
vee_folder->priv->changed_lock = g_mutex_new ();
- vee_folder->priv->unread_vfolder = -1;
+ vee_folder->priv->ignore_changed = g_hash_table_new (g_direct_hash, g_direct_equal);
+ vee_folder->priv->skipped_changes = g_hash_table_new (g_direct_hash, g_direct_equal);
}
void
@@ -2310,6 +2326,8 @@ camel_vee_folder_rebuild_folder (CamelVeeFolder *vf,
CamelFolder *sub,
GError **error)
{
+ vee_folder_propagate_skipped_changes (vf);
+
return CAMEL_VEE_FOLDER_GET_CLASS (vf)->rebuild_folder (vf, sub, error);
}
@@ -2446,27 +2464,29 @@ camel_vee_folder_get_location (CamelVeeFolder *vf, const CamelVeeMessageInfo *vi
}
/**
- * camel_vee_folder_mask_event_folder_changed:
+ * camel_vee_folder_ignore_next_changed_event:
+ * @vf: a #CamelVeeFolder
+ * @sub: a #CamelFolder folder
*
- * Since: 2.26
- **/
-void
-camel_vee_folder_mask_event_folder_changed (CamelVeeFolder *vf,
- CamelFolder *sub)
-{
- g_signal_handlers_block_by_func (sub, folder_changed, vf);
-}
-
-/**
- * camel_vee_folder_unmask_event_folder_changed:
+ * The next @sub folder's 'changed' event will be silently ignored. This
+ * is usually used in virtual folders when the change was done in them,
+ * but it is neither vTrash nor vJunk folder. Doing this avoids unnecessary
+ * removals of messages which don't satisfy search criteria anymore,
+ * which could be done on asynchronous delivery of folder's 'changed' signal.
+ * These ignored changes are accumulated and used on folder refresh.
*
- * Since: 2.26
+ * Since: 3.2
**/
void
-camel_vee_folder_unmask_event_folder_changed (CamelVeeFolder *vf,
- CamelFolder *sub)
+camel_vee_folder_ignore_next_changed_event (CamelVeeFolder *vf, CamelFolder *sub)
{
- g_signal_handlers_unblock_by_func (sub, folder_changed, vf);
+ g_return_if_fail (vf != NULL);
+ g_return_if_fail (CAMEL_IS_VEE_FOLDER (vf));
+ g_return_if_fail (sub != NULL);
+
+ camel_vee_folder_lock (vf, CAMEL_VEE_FOLDER_CHANGED_LOCK);
+ g_hash_table_insert (vf->priv->ignore_changed, sub, GINT_TO_POINTER (1));
+ camel_vee_folder_unlock (vf, CAMEL_VEE_FOLDER_CHANGED_LOCK);
}
/**
@@ -2493,38 +2513,6 @@ camel_vee_folder_sync_headers (CamelFolder *vf,
}
/**
- * camel_vee_folder_get_unread_vfolder:
- * @folder: a #CamelVeeFolder
- *
- * Since: 2.32
- **/
-gint
-camel_vee_folder_get_unread_vfolder (CamelVeeFolder *folder)
-{
- /* FIXME: This shouldn't be needed */
- g_return_val_if_fail (CAMEL_IS_VEE_FOLDER (folder), 0);
-
- return folder->priv->unread_vfolder;
-}
-
-/**
- * camel_vee_folder_set_unread_vfolder:
- * @folder: a #CamelVeeFolder
- * @unread_vfolder: %TRUE if %folder is for unread messages
- *
- * Since: 2.32
- **/
-void
-camel_vee_folder_set_unread_vfolder (CamelVeeFolder *folder,
- gint unread_vfolder)
-{
- /* FIXME: This shouldn't be needed */
- g_return_if_fail (CAMEL_IS_VEE_FOLDER (folder));
-
- folder->priv->unread_vfolder = unread_vfolder;
-}
-
-/**
* 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 6909074..8999c1a 100644
--- a/camel/camel-vee-folder.h
+++ b/camel/camel-vee-folder.h
@@ -124,18 +124,14 @@ void camel_vee_folder_add_folder (CamelVeeFolder *vf, CamelFolder
void camel_vee_folder_remove_folder (CamelVeeFolder *vf,
CamelFolder *sub);
void camel_vee_folder_set_folders (CamelVeeFolder *vf, GList *folders);
-gint camel_vee_folder_rebuild_folder (CamelVeeFolder *vf, CamelFolder *sub, GError **error);
+gint camel_vee_folder_rebuild_folder (CamelVeeFolder *vf, CamelFolder *sub, GError **error);
void camel_vee_folder_set_expression (CamelVeeFolder *vf, const gchar *expr);
-void camel_vee_folder_mask_event_folder_changed (CamelVeeFolder *vf, CamelFolder *sub);
-void camel_vee_folder_unmask_event_folder_changed (CamelVeeFolder *vf, CamelFolder *sub);
+void camel_vee_folder_ignore_next_changed_event (CamelVeeFolder *vf, CamelFolder *sub);
void camel_vee_folder_hash_folder (CamelFolder *folder, gchar buffer[8]);
void camel_vee_folder_sync_headers (CamelFolder *vf, GError **error);
-gint camel_vee_folder_get_unread_vfolder (CamelVeeFolder *folder);
-void camel_vee_folder_set_unread_vfolder (CamelVeeFolder *folder, gint unread_vfolder);
-
void camel_vee_folder_lock (CamelVeeFolder *folder, CamelVeeFolderLock lock);
void camel_vee_folder_unlock (CamelVeeFolder *folder, CamelVeeFolderLock lock);
diff --git a/camel/camel-vee-summary.c b/camel/camel-vee-summary.c
index 2b0bf69..060928a 100644
--- a/camel/camel-vee-summary.c
+++ b/camel/camel-vee-summary.c
@@ -36,12 +36,11 @@
#include "camel-vee-summary.h"
#include "camel-vee-folder.h"
#include "camel-vee-store.h"
+#include "camel-vtrash-folder.h"
#include "camel-string-utils.h"
#define d(x)
-static const gchar *unread_str = " (and\n \n (match-all (not (system-flag \"Seen\")))\n \n )\n; (or\n \n (match-all (not (system-flag \"Seen\")))\n \n )\n; (match-threads \"all\" (and\n \n (match-all (not (system-flag \"Seen\")))\n \n )\n)\n; (match-threads \"all\" (or\n \n (match-all (not (system-flag \"Seen\")))\n \n )\n)\n;";
-
G_DEFINE_TYPE (CamelVeeSummary, camel_vee_summary, CAMEL_TYPE_FOLDER_SUMMARY)
static void
@@ -142,7 +141,6 @@ static gboolean
vee_info_set_user_flag (CamelMessageInfo *mi, const gchar *name, gboolean value)
{
gint res = FALSE;
- gboolean hacked_unread_folder = FALSE;
CamelVeeFolder *vf = (CamelVeeFolder *) mi->summary->folder;
if (camel_debug("vfolderexp"))
@@ -151,24 +149,17 @@ vee_info_set_user_flag (CamelMessageInfo *mi, const gchar *name, gboolean value)
camel_folder_get_full_name (mi->summary->folder),
g_strescape (vf->expression, ""));
- if (camel_vee_folder_get_unread_vfolder (vf) == -1)
- camel_vee_summary_load_check_unread_vfolder (CAMEL_VEE_SUMMARY (mi->summary));
-
- if (camel_vee_folder_get_unread_vfolder (vf) == 1)
- hacked_unread_folder = TRUE;
-
if (mi->uid) {
CamelMessageInfo *rmi = camel_folder_summary_uid (((CamelVeeMessageInfo *) mi)->summary, mi->uid+8);
HANDLE_NULL_INFO (FALSE);
- if (hacked_unread_folder)
- camel_vee_folder_mask_event_folder_changed ((CamelVeeFolder *) mi->summary->folder, rmi->summary->folder);
+ /* ignore changes done in the folder itself,
+ unless it's a vTrash or vJunk folder */
+ if (!CAMEL_IS_VTRASH_FOLDER (vf))
+ camel_vee_folder_ignore_next_changed_event (vf, rmi->summary->folder);
res = camel_message_info_set_user_flag (rmi, name, value);
- if (hacked_unread_folder)
- camel_vee_folder_unmask_event_folder_changed ((CamelVeeFolder *) mi->summary->folder, rmi->summary->folder);
-
camel_message_info_free (rmi);
}
@@ -183,6 +174,12 @@ vee_info_set_user_tag (CamelMessageInfo *mi, const gchar *name, const gchar *val
if (mi->uid) {
CamelMessageInfo *rmi = camel_folder_summary_uid (((CamelVeeMessageInfo *) mi)->summary, mi->uid+8);
HANDLE_NULL_INFO (FALSE);
+
+ /* ignore changes done in the folder itself,
+ unless it's a vTrash or vJunk folder */
+ if (!CAMEL_IS_VTRASH_FOLDER (mi->summary->folder))
+ camel_vee_folder_ignore_next_changed_event ((CamelVeeFolder *) mi->summary->folder, rmi->summary->folder);
+
res = camel_message_info_set_user_tag (rmi, name, value);
camel_message_info_free (rmi);
}
@@ -190,43 +187,6 @@ vee_info_set_user_tag (CamelMessageInfo *mi, const gchar *name, const gchar *val
return res;
}
-/**
- * camel_vee_summary_load_check_unread_vfolder:
- *
- * Since: 2.26
- **/
-void
-camel_vee_summary_load_check_unread_vfolder (CamelVeeSummary *vs)
-{
- static gint only_once = FALSE;
- static gchar *exp = NULL;
- gboolean hacked_unread_folder = FALSE;
- CamelVeeFolder *vf;
-
- g_return_if_fail (vs != NULL);
-
- vf = (CamelVeeFolder *) ((CamelFolderSummary *) vs)->folder;
-
- /* HACK: Ugliest of all hacks. Its virtually not possible now
- * to maintain counts and the non matching uids of unread vfolder here.
- * So, I hardcode unread vfolder expression and hack it. */
- if (!only_once) {
- exp = g_getenv("CAMEL_VFOLDER_UNREAD_EXP") ? g_strcompress(g_getenv("CAMEL_VFOLDER_UNREAD_EXP")) : NULL;
- only_once = TRUE;
- }
-
- if (!exp || !*exp)
- exp = g_strcompress (unread_str);
-
- if (vf->expression && strstr (exp, vf->expression) && (vf->flags & CAMEL_STORE_VEE_FOLDER_SPECIAL) == 0)
- hacked_unread_folder = TRUE;
-
- if (hacked_unread_folder)
- camel_vee_folder_set_unread_vfolder (vf, 1);
- else
- camel_vee_folder_set_unread_vfolder (vf, 0);
-}
-
static gboolean
vee_info_set_flags (CamelMessageInfo *mi,
guint32 flags,
@@ -234,7 +194,6 @@ vee_info_set_flags (CamelMessageInfo *mi,
{
gint res = FALSE;
CamelVeeFolder *vf = (CamelVeeFolder *) mi->summary->folder;
- gboolean hacked_unread_folder = FALSE;
if (camel_debug("vfolderexp"))
printf (
@@ -242,71 +201,36 @@ vee_info_set_flags (CamelMessageInfo *mi,
camel_folder_get_full_name (mi->summary->folder),
g_strescape (vf->expression, ""));
- if (camel_vee_folder_get_unread_vfolder (vf) == -1)
- camel_vee_summary_load_check_unread_vfolder (CAMEL_VEE_SUMMARY (mi->summary));
-
- if (camel_vee_folder_get_unread_vfolder (vf) == 1)
- hacked_unread_folder = TRUE;
-
if (mi->uid) {
- guint32 old_visible, visible, old_unread;
CamelMessageInfo *rmi = camel_folder_summary_uid (((CamelVeeMessageInfo *) mi)->summary, mi->uid+8);
- CamelVeeSummary *vsummary = (CamelVeeSummary *) mi->summary;
HANDLE_NULL_INFO (FALSE);
- old_visible = rmi->summary->visible_count;
- old_unread = mi->summary->unread_count;
camel_folder_summary_update_counts_by_flags (mi->summary, camel_message_info_flags (rmi), TRUE);
- if (hacked_unread_folder)
- camel_vee_folder_mask_event_folder_changed ((CamelVeeFolder *) mi->summary->folder, rmi->summary->folder);
+ /* ignore changes done in the folder itself,
+ unless it's a vTrash or vJunk folder */
+ if (!CAMEL_IS_VTRASH_FOLDER (vf))
+ camel_vee_folder_ignore_next_changed_event (vf, rmi->summary->folder);
camel_folder_freeze (rmi->summary->folder);
res = camel_message_info_set_flags (rmi, flags, set);
((CamelVeeMessageInfo *) mi)->old_flags = camel_message_info_flags (rmi);
camel_folder_thaw (rmi->summary->folder);
- if (hacked_unread_folder)
- camel_vee_folder_unmask_event_folder_changed ((CamelVeeFolder *) mi->summary->folder, rmi->summary->folder);
-
- visible = rmi->summary->visible_count;
-
/* Keep the summary in sync */
camel_folder_summary_update_counts_by_flags (mi->summary, camel_message_info_flags (rmi), FALSE);
- if (hacked_unread_folder && !vsummary->fake_visible_count)
- vsummary->fake_visible_count = mi->summary->visible_count;
-
- if (vsummary->fake_visible_count || hacked_unread_folder)
- vsummary->fake_visible_count += visible - old_visible;
-
d(printf("VF %d %d %d %d %d\n", mi->summary->unread_count, mi->summary->deleted_count, mi->summary->junk_count, mi->summary->junk_not_deleted_count, mi->summary->visible_count));
- /* This is where the ugly-created-hack is used */
- if (hacked_unread_folder && mi->summary->unread_count - old_unread != 0) {
+ if (res && mi->summary && mi->summary->folder) {
CamelFolderChangeInfo *changes = camel_folder_change_info_new ();
- GPtrArray *match, *array;
-
- camel_folder_change_info_change_uid (changes, mi->uid);
-
- array = g_ptr_array_new ();
- g_ptr_array_add (array, (gpointer) rmi->uid);
-
- match = camel_folder_search_by_uids (rmi->summary->folder, vf->expression, array, NULL);
- if ((match && !match->len) || !match) {
- vsummary->fake_visible_count--;
- } else {
- vsummary->fake_visible_count++;
- }
-
- g_ptr_array_free (array, TRUE);
- if (match)
- camel_folder_search_free (rmi->summary->folder, match);
+ camel_folder_change_info_change_uid (changes, camel_message_info_uid (mi));
camel_folder_changed (mi->summary->folder, changes);
camel_folder_change_info_free (changes);
}
+
camel_message_info_free (rmi);
}
@@ -402,8 +326,6 @@ camel_vee_summary_new (CamelFolder *parent)
s = g_object_new (CAMEL_TYPE_VEE_SUMMARY, NULL);
s->summary.folder = parent;
- s->force_counts = FALSE;
- s->fake_visible_count = 0;
/* FIXME[disk-summary] fix exceptions and note return values */
/* FIXME[disk-summary] if Evo's junk/trash vfolders make it VJunk
diff --git a/camel/camel-vee-summary.h b/camel/camel-vee-summary.h
index 28ac2d3..688dcf9 100644
--- a/camel/camel-vee-summary.h
+++ b/camel/camel-vee-summary.h
@@ -66,8 +66,6 @@ struct _CamelVeeMessageInfo {
struct _CamelVeeSummary {
CamelFolderSummary summary;
- gboolean force_counts;
- guint32 fake_visible_count;
};
struct _CamelVeeSummaryClass {
@@ -84,8 +82,6 @@ CamelVeeMessageInfo *
const gchar hash[8]);
GPtrArray * camel_vee_summary_get_ids (CamelVeeSummary *summary,
gchar hash[8]);
-void camel_vee_summary_load_check_unread_vfolder
- (CamelVeeSummary *vs);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]