[evolution] Adapt to CamelFolderSummary API changes



commit d79ca40b62e72b1ec516631bbffabd6e2cad15e6
Author: Milan Crha <mcrha redhat com>
Date:   Thu Oct 6 16:59:04 2011 +0200

    Adapt to CamelFolderSummary API changes

 mail/e-mail-backend.c                    |    2 +-
 mail/em-folder-properties.c              |    6 ++--
 mail/em-format-html-display.c            |    2 +-
 mail/mail-folder-cache.c                 |    2 +-
 modules/mail/e-mail-shell-view-private.c |   10 +++---
 plugins/itip-formatter/itip-formatter.c  |   47 ++++++++++++-----------------
 6 files changed, 31 insertions(+), 38 deletions(-)
---
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index 7cc33c1..cb91339 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -349,7 +349,7 @@ mail_backend_quit_requested_cb (EShell *shell,
 	if (folder == NULL)
 		return;
 
-	if (folder->summary->visible_count == 0)
+	if (camel_folder_summary_get_visible_count (folder->summary) == 0)
 		return;
 
 	response = e_alert_run_dialog_for_args (
diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c
index a89abcd..6e8e04c 100644
--- a/mail/em-folder-properties.c
+++ b/mail/em-folder-properties.c
@@ -268,9 +268,9 @@ emfp_dialog_run (AsyncContext *context)
 	 * messages.  VISIBLE+DELETED gives the correct count that matches
 	 * the label below the Send & Receive button. */
 	name = camel_folder_get_display_name (context->folder);
-	context->total = context->folder->summary->visible_count;
-	context->unread = context->folder->summary->unread_count;
-	deleted = context->folder->summary->deleted_count;
+	context->total = camel_folder_summary_get_visible_count (context->folder->summary);
+	context->unread = camel_folder_summary_get_unread_count (context->folder->summary);
+	deleted = camel_folder_summary_get_deleted_count (context->folder->summary);
 
 	client = gconf_client_get_default ();
 	key = "/apps/evolution/mail/display/show_deleted";
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index de16507..a2a49de 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -1137,7 +1137,7 @@ efhd_attachment_button (EMFormatHTML *efh,
 	if (emf->folder && emf->folder->summary && emf->uid) {
 		CamelMessageInfo *mi;
 
-		mi = camel_folder_summary_uid (emf->folder->summary, emf->uid);
+		mi = camel_folder_summary_get (emf->folder->summary, emf->uid);
 		if (mi) {
 			const CamelMessageContentInfo *ci;
 
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index 30bbce6..5dd215a 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -287,7 +287,7 @@ update_1folder (MailFolderCache *self,
 				if ((deleted = camel_folder_get_deleted_message_count (folder)) > 0)
 					unread -= deleted;
 
-				junked = folder->summary->junk_count;
+				junked = camel_folder_summary_get_junk_count (folder->summary);
 				if (junked > 0)
 					unread -= junked;
 			}
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index 30a6756..50525c7 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -983,11 +983,11 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
 	folder_name = camel_folder_get_display_name (folder);
 	parent_store = camel_folder_get_parent_store (folder);
 
-	num_deleted = folder->summary->deleted_count;
-	num_junked = folder->summary->junk_count;
-	num_junked_not_deleted = folder->summary->junk_not_deleted_count;
-	num_unread = folder->summary->unread_count;
-	num_visible = folder->summary->visible_count;
+	num_deleted = camel_folder_summary_get_deleted_count (folder->summary);
+	num_junked = camel_folder_summary_get_junk_count (folder->summary);
+	num_junked_not_deleted = camel_folder_summary_get_junk_not_deleted_count (folder->summary);
+	num_unread = camel_folder_summary_get_unread_count (folder->summary);
+	num_visible = camel_folder_summary_get_visible_count (folder->summary);
 
 	buffer = g_string_sized_new (256);
 	uids = e_mail_reader_get_selected_uids (reader);
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 9ab5895..5c733b7 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -2315,51 +2315,44 @@ view_response_cb (GtkWidget *widget,
 		CamelFolderChangeInfo *changes = NULL;
 		const gchar *tag = NULL;
 		CamelMessageInfo *mi;
-		mi = camel_folder_summary_uid (pitip->folder->summary, pitip->uid);
+		mi = camel_folder_summary_get (pitip->folder->summary, pitip->uid);
 		if (mi) {
 			changes = camel_folder_change_info_new ();
 
 			if (itip_view_get_recur_check_state (ITIP_VIEW (pitip->view))) {
 				/* Recurring appointment and "apply-to-all" is selected */
-				camel_message_info_ref (mi);
 				tag = camel_message_info_user_tag (mi, "recurrence-key");
-				camel_message_info_free (mi);
 				if (tag) {
-					CamelStore *parent_store;
-					GList *list = NULL;
-					const gchar *full_name;
-					gint i = 0, count;
-
-					count = camel_folder_summary_count (pitip->folder->summary);
-					for (i = 0; i < count; i++) {
-						mi = camel_folder_summary_index (pitip->folder->summary, i);
-						if (!mi)
+					gint i;
+					GPtrArray *known_uids;
+
+					known_uids = camel_folder_summary_get_array (pitip->folder->summary);
+					for (i = 0; known_uids && i < known_uids->len; i++) {
+						const gchar *uid = g_ptr_array_index (known_uids, i);
+						CamelMessageInfo *mi2;
+
+						mi2 = camel_folder_summary_get (pitip->folder->summary, uid);
+						if (!mi2)
 							continue;
-						camel_message_info_ref (mi);
-						if ( camel_message_info_user_tag (mi, "recurrence-key") && g_str_equal (camel_message_info_user_tag (mi, "recurrence-key"), tag)) {
-							camel_folder_summary_remove_uid_fast (pitip->folder->summary, (gchar *)(mi->uid));
-							camel_folder_change_info_remove_uid (changes, (gchar *) mi->uid);
-							list = g_list_prepend (list, (gpointer) mi->uid);
-
-							/* step back once to have the right index */
-							count--;
-							i--;
+
+						if (camel_message_info_user_tag (mi2, "recurrence-key") &&
+						    g_str_equal (camel_message_info_user_tag (mi2, "recurrence-key"), tag)) {
+							camel_folder_summary_remove_uid (pitip->folder->summary, mi2->uid);
+							camel_folder_change_info_remove_uid (changes, mi2->uid);
 						}
-						camel_message_info_free (mi);
-					}
 
-					full_name = camel_folder_get_full_name (pitip->folder);
-					parent_store = camel_folder_get_parent_store (pitip->folder);
-					camel_db_delete_uids (parent_store->cdb_w, full_name, list, NULL);
-					g_list_free (list);
+						camel_message_info_free (mi2);
+					}
 				}
 			} else {
 				/* Either not a recurring appointment or "apply-to-all" is not selected. So just delete this instance alone */
 				camel_folder_summary_remove_uid (pitip->folder->summary, pitip->uid);
 				camel_folder_change_info_remove_uid (changes, pitip->uid);
 			}
+
 			camel_folder_changed (pitip->folder, changes);
 			camel_folder_change_info_free (changes);
+			camel_message_info_free (mi);
 		}
 	}
 



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