aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-vee-store.c
diff options
context:
space:
mode:
author1 <NotZed@Ximian.com>2001-09-21 13:58:53 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-09-21 13:58:53 +0800
commit0f0f01c1e0b40b513d82ef05082edfc3acf76d9e (patch)
treef69400d5e0c448d594b5f1dedbe638ad800eb94a /camel/camel-vee-store.c
parentb2e7adf9b88f9dda003f4e077c5db0dc8cb50d8b (diff)
downloadgsoc2013-evolution-0f0f01c1e0b40b513d82ef05082edfc3acf76d9e.tar.gz
gsoc2013-evolution-0f0f01c1e0b40b513d82ef05082edfc3acf76d9e.tar.zst
gsoc2013-evolution-0f0f01c1e0b40b513d82ef05082edfc3acf76d9e.zip
Force a refresh of vfolders before storing their count. This essentially
2001-09-21 <NotZed@Ximian.com> * camel-vee-store.c (vee_get_folder_info): Force a refresh of vfolders before storing their count. This essentially makes 'get_folderinfo' refresh all vfolders, so that get-mail works as expected. * camel-vee-folder.c (camel_vee_folder_finalise): Clear lists. (folder_changed): If we're not autoupdating the folder, then add this folder to the list of 'changed' folders for this vfolder. (camel_vee_folder_set_expression): Reset the folders_changed list. (camel_vee_folder_remove_folder): Remove the folder from the folders_changed list. (camel_vee_folder_set_folders): If we have a folder already, but its changed, use this opportunity to update it. (vee_sync): Remove any synced folders from the folders_changed list. (vee_refresh_info): Refresh folder, re-run queries on any changed folders. svn path=/trunk/; revision=13045
Diffstat (limited to 'camel/camel-vee-store.c')
-rw-r--r--camel/camel-vee-store.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/camel/camel-vee-store.c b/camel/camel-vee-store.c
index dc3febc85d..b8974e5d44 100644
--- a/camel/camel-vee-store.c
+++ b/camel/camel-vee-store.c
@@ -160,6 +160,7 @@ struct _build_info {
const char *top;
guint32 flags;
GPtrArray *infos;
+ GPtrArray *folders;
};
static void
@@ -188,8 +189,10 @@ build_info(char *name, CamelVeeFolder *folder, struct _build_info *data)
((CamelFolder *)folder)->full_name);
info->full_name = g_strdup(((CamelFolder *)folder)->full_name);
info->name = g_strdup(((CamelFolder *)folder)->name);
- info->unread_message_count = camel_folder_get_unread_message_count((CamelFolder *)folder);
+ info->unread_message_count = -1;
g_ptr_array_add(data->infos, info);
+ camel_object_ref((CamelObject *)folder);
+ g_ptr_array_add(data->folders, folder);
}
static CamelFolderInfo *
@@ -197,15 +200,28 @@ vee_get_folder_info(CamelStore *store, const char *top, guint32 flags, CamelExce
{
struct _build_info data;
CamelFolderInfo *info;
+ int i;
/* first, build the info list */
data.top = top;
data.flags = flags;
data.infos = g_ptr_array_new();
+ data.folders = g_ptr_array_new();
CAMEL_STORE_LOCK(store, cache_lock);
g_hash_table_foreach(store->folders, (GHFunc)build_info, &data);
CAMEL_STORE_UNLOCK(store, cache_lock);
+ /* then make sure the unread counts are accurate */
+ for (i=0;i<data.infos->len;i++) {
+ CamelFolderInfo *info = data.infos->pdata[i];
+ CamelFolder *folder = data.folders->pdata[i];
+
+ camel_folder_refresh_info(folder, NULL);
+ info->unread_message_count = camel_folder_get_unread_message_count(folder);
+ camel_object_unref((CamelObject *)folder);
+ }
+ g_ptr_array_free(data.folders, TRUE);
+
/* and always add UNMATCHED, if scanning from top/etc */
if (top == NULL || top[0] == 0 || strncmp(top, CAMEL_UNMATCHED_NAME, strlen(CAMEL_UNMATCHED_NAME)) == 0) {
info = g_malloc0(sizeof(*info));