evolution-data-server r9206 - trunk/camel



Author: sragavan
Date: Mon Jul 28 09:33:57 2008
New Revision: 9206
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9206&view=rev

Log:
2008-07-28  Srinivasa Ragavan  <sragavan novell com>

	* camel/camel-folder.c: Add function to update summary.
	* camel/camel-vtrash-folder.c: Fix compiler warnings


Modified:
   trunk/camel/ChangeLog
   trunk/camel/camel-folder.c
   trunk/camel/camel-vtrash-folder.c

Modified: trunk/camel/camel-folder.c
==============================================================================
--- trunk/camel/camel-folder.c	(original)
+++ trunk/camel/camel-folder.c	Mon Jul 28 09:33:57 2008
@@ -387,8 +387,6 @@
 
 			#warning "Add a better base class function to get counts specific to normal/vee folder."
 			if (unread == -1) {
-				int j;
-				CamelMessageInfo *info;
 
 				if (!CAMEL_IS_VEE_FOLDER (folder)) {
 					/* TODO: Locking? */
@@ -701,6 +699,42 @@
 
 }
 
+static void
+update_summary (CamelMessageInfoBase *info)
+{
+	int unread=0, deleted=0, junk=0;
+	guint32 flags = info->flags;
+
+	d(printf("Updating summary of %s\n", info->summary->folder->full_name));
+	if (flags & CAMEL_MESSAGE_SEEN)
+		unread = 1;
+	
+	if (flags & CAMEL_MESSAGE_DELETED)
+		deleted = 1;
+
+	if (flags & CAMEL_MESSAGE_JUNK)
+		junk = 1;
+	
+	info->flags |= CAMEL_MESSAGE_FOLDER_FLAGGED;
+	info->dirty = TRUE;
+
+	if (info->summary) {
+		camel_folder_summary_touch(info->summary);
+
+		if (unread)
+			info->summary->unread_count += unread;
+		if (deleted)
+			info->summary->deleted_count += deleted;
+		if (junk)
+			info->summary->junk_count += junk;
+		if (junk && !deleted)
+			info->summary->junk_not_deleted_count += junk;
+		if (junk ||  deleted) 
+			info->summary->visible_count -= junk ? junk : deleted;
+		info->summary->saved_count++;
+
+	}
+}
 
 /**
  * camel_folder_append_message:
@@ -723,9 +757,7 @@
 	g_return_if_fail (CAMEL_IS_FOLDER (folder));
 
 	CAMEL_FOLDER_REC_LOCK(folder, lock);
-
 	CF_CLASS (folder)->append_message (folder, message, info, appended_uid, ex);
-
 	CAMEL_FOLDER_REC_UNLOCK(folder, lock);
 }
 

Modified: trunk/camel/camel-vtrash-folder.c
==============================================================================
--- trunk/camel/camel-vtrash-folder.c	(original)
+++ trunk/camel/camel-vtrash-folder.c	Mon Jul 28 09:33:57 2008
@@ -331,7 +331,7 @@
 				vuid = g_malloc(strlen(uid)+9);
 				memcpy(vuid, hash, 8);
 				strcpy(vuid+8, uid);
-				g_ptr_array_add(result, camel_pstring_strdup(vuid));
+				g_ptr_array_add(result, (gpointer) camel_pstring_strdup(vuid));
 				g_free (vuid);
 			}
 			camel_folder_search_free(f, matches);
@@ -343,7 +343,7 @@
 	camel_folder_free_summary (folder, infos);
 	CAMEL_VEE_FOLDER_UNLOCK(folder, subfolder_lock);
 
-	g_ptr_array_foreach (uids, camel_pstring_free, NULL);
+	g_ptr_array_foreach (uids, (GFunc) camel_pstring_free, NULL);
 	g_ptr_array_free(uids, TRUE);
 
 	return result;
@@ -394,7 +394,7 @@
 				vuid = g_malloc(strlen(uid)+9);
 				memcpy(vuid, hash, 8);
 				strcpy(vuid+8, uid);
-				g_ptr_array_add(result, camel_pstring_strdup(vuid));
+				g_ptr_array_add(result, (gpointer) camel_pstring_strdup(vuid));
 				g_free (vuid);
 			}
 			camel_folder_search_free(f, matches);
@@ -438,7 +438,7 @@
 	vinfo = (CamelVeeMessageInfo *)camel_folder_summary_uid(((CamelFolder *)vf)->summary, vuid);
 	if (vinfo == NULL) {
 		CamelMessageInfo *tinfo;
-		tinfo = camel_vee_summary_add((CamelVeeSummary *)((CamelFolder *)vf)->summary, ssummary, uid, hash);
+		tinfo = (CamelMessageInfo *) camel_vee_summary_add((CamelVeeSummary *)((CamelFolder *)vf)->summary, ssummary, uid, hash);
 		if (tinfo) {
 			camel_folder_change_info_add_uid(((CamelVeeFolder *)vf)->changes, vuid);
 			camel_message_info_free (tinfo);
@@ -532,12 +532,11 @@
 	}
 	
 	for (i=0;i<infos->len;i++) {
-		CamelMessageInfo *info;
 		char *uid = infos->pdata[i];
 		vtrash_uid_added((CamelVTrashFolder *)vf, uid, sub->summary, hash);
 	}
 	
-	g_ptr_array_foreach (infos, camel_pstring_free, NULL);
+	g_ptr_array_foreach (infos, (GFunc) camel_pstring_free, NULL);
 	g_ptr_array_free (infos, TRUE);
 
 	if (camel_folder_change_info_changed(vf->changes)) {



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