evolution-data-server r9995 - trunk/camel
- From: sragavan svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r9995 - trunk/camel
- Date: Fri, 30 Jan 2009 04:59:18 +0000 (UTC)
Author: sragavan
Date: Fri Jan 30 04:59:18 2009
New Revision: 9995
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9995&view=rev
Log:
2009-01-30 Srinivasa Ragavan <sragavan novell com>
* camel-private.h: Added a priv variable to vfolder.
* camel-vee-folder.c: (vf_getv), (camel_vee_folder_init):
* camel-vee-summary.c: Make unread vfolder counts better.
(camel_vee_summary_load_check_unread_vfolder),
(vee_info_set_flags):
Modified:
trunk/camel/ChangeLog
trunk/camel/camel-private.h
trunk/camel/camel-vee-folder.c
trunk/camel/camel-vee-summary.c
Modified: trunk/camel/camel-private.h
==============================================================================
--- trunk/camel/camel-private.h (original)
+++ trunk/camel/camel-private.h Fri Jan 30 04:59:18 2009
@@ -158,6 +158,7 @@
GMutex *summary_lock; /* for locking vfolder summary */
GMutex *subfolder_lock; /* for locking the subfolder list */
GMutex *changed_lock; /* for locking the folders-changed list */
+ int unread_vfolder;
};
#define CAMEL_VEE_FOLDER_LOCK(f, l) \
Modified: trunk/camel/camel-vee-folder.c
==============================================================================
--- trunk/camel/camel-vee-folder.c (original)
+++ trunk/camel/camel-vee-folder.c Fri Jan 30 04:59:18 2009
@@ -1958,10 +1958,12 @@
vf_getv(CamelObject *object, CamelException *ex, CamelArgGetV *args)
{
CamelFolder *folder = (CamelFolder *)object;
+ CamelVeeFolder *vf = (CamelVeeFolder *)folder;
int i;
guint32 tag;
int unread = -1, deleted = 0, junked = 0, visible = 0, count = -1, junked_not_deleted = -1;
+
for (i=0;i<args->argc;i++) {
CamelArgGet *arg = &args->argv[i];
@@ -1975,7 +1977,10 @@
case CAMEL_FOLDER_ARG_JUNKED:
case CAMEL_FOLDER_ARG_JUNKED_NOT_DELETED:
case CAMEL_FOLDER_ARG_VISIBLE:
-
+
+ if (vf->expression && vf->priv->unread_vfolder == -1)
+ camel_vee_summary_load_check_unread_vfolder (vf);
+
/* This is so we can get the values atomically, and also so we can calculate them only once */
if (unread == -1) {
int j;
@@ -2021,7 +2026,11 @@
count = junked_not_deleted == -1 ? 0 : junked_not_deleted;
break;
case CAMEL_FOLDER_ARG_VISIBLE:
- count = visible == -1 ? 0 : visible;
+ if (vf->priv->unread_vfolder == 1)
+ count = unread == -1 ? 0 : unread;
+ else
+ count = visible == -1 ? 0 : visible;
+
break;
}
folder->summary->unread_count = unread == -1 ? 0 : unread;
@@ -2103,6 +2112,7 @@
p->summary_lock = g_mutex_new();
p->subfolder_lock = g_mutex_new();
p->changed_lock = g_mutex_new();
+ p->unread_vfolder = -1;
}
void
Modified: trunk/camel/camel-vee-summary.c
==============================================================================
--- trunk/camel/camel-vee-summary.c (original)
+++ trunk/camel/camel-vee-summary.c Fri Jan 30 04:59:18 2009
@@ -171,15 +171,13 @@
return res;
}
-static gboolean
-vee_info_set_flags(CamelMessageInfo *mi, guint32 flags, guint32 set)
+void
+camel_vee_summary_load_check_unread_vfolder (CamelVeeFolder *vf)
{
- int res = FALSE;
- CamelVeeFolder *vf = (CamelVeeFolder *)mi->summary->folder;
- static char *exp = NULL;
static only_once = FALSE;
+ static char *exp = NULL;
+ char *meta;
gboolean hacked_unread_folder = FALSE;
- char *meta = NULL;
/* HACK: Ugliest of all hacks. Its virtually not possible now
* to maintain counts and the non matching uids of unread vfolder here.
@@ -192,17 +190,42 @@
if (!exp || !*exp)
exp = g_strcompress(unread_str);
- if (camel_debug("vfolderexp"))
- printf("Expression for vfolder '%s' is '%s'\n", mi->summary->folder->full_name, g_strescape(vf->expression, ""));
-
- if (strstr(exp, vf->expression) && (vf->flags & CAMEL_STORE_VEE_FOLDER_SPECIAL) == 0)
+ if (vf->expression && strstr(exp, vf->expression) && (vf->flags & CAMEL_STORE_VEE_FOLDER_SPECIAL) == 0)
hacked_unread_folder = TRUE;
- meta = camel_object_meta_get (mi->summary->folder, "vfolder:unread");
+ meta = camel_object_meta_get (vf, "vfolder:unread");
if (!hacked_unread_folder && meta && strcmp (meta, "true") == 0)
hacked_unread_folder = TRUE;
g_free(meta);
+ if (hacked_unread_folder)
+ vf->priv->unread_vfolder = 1;
+ else
+ vf->priv->unread_vfolder = 0;
+}
+
+static gboolean
+vee_info_set_flags(CamelMessageInfo *mi, guint32 flags, guint32 set)
+{
+ int res = FALSE;
+ CamelVeeFolder *vf = (CamelVeeFolder *)mi->summary->folder;
+ gboolean hacked_unread_folder = FALSE;
+
+ if (camel_debug("vfolderexp"))
+ printf("Expression for vfolder '%s' is '%s'\n", mi->summary->folder->full_name, g_strescape(vf->expression, ""));
+
+ if (vf->priv->unread_vfolder == -1)
+ camel_vee_summary_load_check_unread_vfolder (vf);
+
+ if (vf->priv->unread_vfolder == 1)
+ hacked_unread_folder = TRUE;
+ else {
+ char *meta = camel_object_meta_get (mi->summary->folder, "vfolder:unread");
+ if (meta && strcmp (meta, "true") == 0)
+ hacked_unread_folder = TRUE;
+ g_free(meta);
+ }
+
if (mi->uid) {
guint32 old_visible, old_unread, old_deleted, old_junked, old_junked_not_deleted;
guint32 visible, unread, deleted, junked, junked_not_deleted;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]