[evolution-patches] Patch to fix bug #61610, display a message count on draft folders.



Here is the patch. Is the first patch I submit, so if I made something
wrong please tell so.

-- 
Félix Ortega Hortigüela <felix ortega hispafuentes com>
Hispafuentes, S.L.
--- evolution-2.0.2.orig/mail/em-folder-tree-model.c
+++ evolution-2.0.2/mail/em-folder-tree-model.c
@@ -450,6 +450,7 @@
 	g_hash_table_insert (si->full_hash, g_strdup (fi->full_name), path_row);
 	
 	/* HACK: if we have the folder, and its the outbox folder, we need the total count, not unread */
+	/* HACK2: We do the same to the draft folder */
 	/* This is duplicated in mail-folder-cache too, should perhaps be functionised */
 	unread = fi->unread == -1 ? 0 : fi->unread;
 	if (mail_note_get_folder_from_uri(fi->uri, &folder) && folder) {
@@ -464,8 +465,21 @@
 			}
 			
 			unread = total > 0 ? total : 0;
+		} 
+		if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_DRAFTS)) {
+			int total;
+			
+			if ((total = camel_folder_get_message_count (folder)) > 0) {
+				int deleted = camel_folder_get_deleted_message_count (folder);
+				
+				if (deleted != -1)
+					total -= deleted;
+			}
+			
+			unread = total > 0 ? total : 0;
 		}
 		camel_object_unref(folder);
+
 	}
 
 	if (emft_is_special_local_folder(si->store, fi->full_name))
--- evolution-2.0.2.orig/mail/mail-folder-cache.c
+++ evolution-2.0.2/mail/mail-folder-cache.c
@@ -330,10 +330,12 @@
 		d(printf("update 1 folder '%s'\n", folder->full_name));
 		if ((count_trash && (CAMEL_IS_VTRASH_FOLDER (folder)))
 		    || folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX)
+		    || folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_DRAFTS)
 		    || (count_sent && folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT))) {
 			d(printf(" total count\n"));
 			unread = camel_folder_get_message_count (folder);
-			if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX)) {
+			if (folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX) 
+					|| folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_DRAFTS)) {
 				if ((deleted = camel_folder_get_deleted_message_count (folder)) > 0)
 					unread -= deleted;
 			}


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