[evolution] Drop 'folder_uri' param from em_utils_folder_is_sent().



commit b9f932b1b84349e80e8383d925a00a75a3b7fe29
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue May 3 09:16:49 2011 -0400

    Drop 'folder_uri' param from em_utils_folder_is_sent().

 mail/e-mail-paned-view.c                 |    2 +-
 mail/e-mail-reader-utils.c               |    2 +-
 mail/e-mail-reader.c                     |    2 +-
 mail/em-utils.c                          |   18 ++++++++++--------
 mail/em-utils.h                          |    2 +-
 mail/mail-folder-cache.c                 |    3 +--
 modules/mail/e-mail-shell-view-private.c |    4 ++--
 modules/mail/e-mail-shell-view.c         |    4 ++--
 plugins/itip-formatter/itip-formatter.c  |    4 ++--
 9 files changed, 21 insertions(+), 20 deletions(-)
---
diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c
index 06da0a0..dc51615 100644
--- a/mail/e-mail-paned-view.c
+++ b/mail/e-mail-paned-view.c
@@ -784,7 +784,7 @@ mail_paned_view_update_view_instance (EMailView *view)
 	outgoing_folder =
 		em_utils_folder_is_drafts (folder) ||
 		em_utils_folder_is_outbox (folder, folder_uri) ||
-		em_utils_folder_is_sent (folder, folder_uri);
+		em_utils_folder_is_sent (folder);
 
 	if (e_shell_settings_get_boolean (shell_settings, "mail-global-view-setting"))
 		view_instance = e_shell_view_new_view_instance (shell_view, outgoing_folder ? "global_view_sent_setting" : "global_view_setting");
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 70bd53d..af8b228 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -552,7 +552,7 @@ e_mail_reader_create_filter_from_selected (EMailReader *reader,
 	folder = e_mail_reader_get_folder (reader);
 	folder_uri = e_mail_reader_get_folder_uri (reader);
 
-	if (em_utils_folder_is_sent (folder, folder_uri))
+	if (em_utils_folder_is_sent (folder))
 		filter_source = E_FILTER_SOURCE_OUTGOING;
 	else if (em_utils_folder_is_outbox (folder, folder_uri))
 		filter_source = E_FILTER_SOURCE_OUTGOING;
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index c3ad316..4e84b6c 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -2932,7 +2932,7 @@ mail_reader_set_folder (EMailReader *reader,
 	outgoing = folder != NULL && folder_uri != NULL && (
 		em_utils_folder_is_drafts (folder) ||
 		em_utils_folder_is_outbox (folder, folder_uri) ||
-		em_utils_folder_is_sent (folder, folder_uri));
+		em_utils_folder_is_sent (folder));
 
 	/* FIXME Need to pass a GCancellable. */
 	em_format_format (EM_FORMAT (formatter), NULL, NULL, NULL, NULL);
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 86b6b81..5c8082d 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1113,22 +1113,24 @@ em_utils_folder_is_drafts (CamelFolder *folder)
 
 /**
  * em_utils_folder_is_sent:
- * @folder: folder
- * @uri: uri for this folder, if known
+ * @folder: a #CamelFolder
  *
- * Decides if @folder is a Sent folder
+ * Decides if @folder is a Sent folder.
  *
  * Returns %TRUE if this is a Sent folder or %FALSE otherwise.
  **/
 gboolean
-em_utils_folder_is_sent (CamelFolder *folder, const gchar *uri)
+em_utils_folder_is_sent (CamelFolder *folder)
 {
 	CamelFolder *local_sent_folder;
 	CamelSession *session;
 	CamelStore *store;
 	EAccountList *account_list;
 	EIterator *iterator;
-	gint is_sent = FALSE;
+	gchar *folder_uri;
+	gboolean is_sent = FALSE;
+
+	g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
 
 	local_sent_folder =
 		e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_SENT);
@@ -1136,8 +1138,7 @@ em_utils_folder_is_sent (CamelFolder *folder, const gchar *uri)
 	if (folder == local_sent_folder)
 		return TRUE;
 
-	if (folder == NULL || uri == NULL)
-		return FALSE;
+	folder_uri = e_mail_folder_uri_from_folder (folder);
 
 	store = camel_folder_get_parent_store (folder);
 	session = camel_service_get_session (CAMEL_SERVICE (store));
@@ -1157,7 +1158,7 @@ em_utils_folder_is_sent (CamelFolder *folder, const gchar *uri)
 			sent_uri = em_uri_to_camel (
 				account->sent_folder_uri);
 			is_sent = e_mail_folder_uri_equal (
-				session, sent_uri, uri);
+				session, sent_uri, folder_uri);
 			g_free (sent_uri);
 		}
 
@@ -1165,6 +1166,7 @@ em_utils_folder_is_sent (CamelFolder *folder, const gchar *uri)
 	}
 
 	g_object_unref (iterator);
+	g_free (folder_uri);
 
 	return is_sent;
 }
diff --git a/mail/em-utils.h b/mail/em-utils.h
index 069acb9..5ede207 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -64,7 +64,7 @@ void em_utils_selection_get_urilist (GtkSelectionData *data, CamelFolder *folder
 
 gboolean em_utils_folder_is_drafts (CamelFolder *folder);
 gboolean em_utils_folder_is_templates (CamelFolder *folder);
-gboolean em_utils_folder_is_sent (CamelFolder *folder, const gchar *uri);
+gboolean em_utils_folder_is_sent (CamelFolder *folder);
 gboolean em_utils_folder_is_outbox (CamelFolder *folder, const gchar *uri);
 
 gchar *em_utils_get_proxy_uri (const gchar *uri);
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index c23030b..5dde558 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -267,8 +267,7 @@ update_1folder (MailFolderCache *self,
 		    || (is_drafts = em_utils_folder_is_drafts (folder))
 		    || (is_outbox = em_utils_folder_is_outbox (
 			folder, info ? info->uri : NULL))
-		    || (self->priv->count_sent && em_utils_folder_is_sent (
-			folder, info ? info->uri : NULL))) {
+		    || (self->priv->count_sent && em_utils_folder_is_sent (folder))) {
 			d(printf(" total count\n"));
 			unread = camel_folder_get_message_count (folder);
 			if (is_drafts || is_outbox) {
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index b56a562..ed4da52 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -977,7 +977,7 @@ e_mail_shell_view_create_filter_from_selected (EMailShellView *mail_shell_view,
 	folder_uri = e_mail_reader_get_folder_uri (reader);
 	uids = e_mail_reader_get_selected_uids (reader);
 
-	if (em_utils_folder_is_sent (folder, folder_uri))
+	if (em_utils_folder_is_sent (folder))
 		filter_source = E_FILTER_SOURCE_OUTGOING;
 	else if (em_utils_folder_is_outbox (folder, folder_uri))
 		filter_source = E_FILTER_SOURCE_OUTGOING;
@@ -1181,7 +1181,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
 			num_visible), num_visible);
 
 	/* "Sent" folder */
-	} else if (em_utils_folder_is_sent (folder, folder_uri)) {
+	} else if (em_utils_folder_is_sent (folder)) {
 		g_string_append_printf (
 			buffer, ngettext ("%d sent", "%d sent",
 			num_visible), num_visible);
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index 0b0f13e..1c1a867 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -390,7 +390,7 @@ filter:
 			break;
 
 		case MAIL_FILTER_RECENT_MESSAGES:
-			if (em_utils_folder_is_sent (folder, folder_uri))
+			if (em_utils_folder_is_sent (folder))
 				temp = g_strdup_printf (
 					"(and %s (match-all "
 					"(> (get-sent-date) "
@@ -407,7 +407,7 @@ filter:
 			break;
 
 		case MAIL_FILTER_LAST_5_DAYS_MESSAGES:
-			if (em_utils_folder_is_sent (folder, folder_uri))
+			if (em_utils_folder_is_sent (folder))
 				temp = g_strdup_printf (
 					"(and %s (match-all "
 					"(> (get-sent-date) "
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index f63f962..a90ff38 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -2284,7 +2284,7 @@ in_proper_folder (CamelFolder *folder)
 			  /* or any other virtual folder */
 			  CAMEL_IS_VEE_FOLDER (folder) ||
 			  /* or anything else except of sent, outbox or drafts folder */
-			  (!em_utils_folder_is_sent (folder, folder_uri) &&
+			  (!em_utils_folder_is_sent (folder) &&
 			   !em_utils_folder_is_outbox (folder, folder_uri) &&
 			   !em_utils_folder_is_drafts (folder))
 			));
@@ -2292,7 +2292,7 @@ in_proper_folder (CamelFolder *folder)
 		/* cannot check for Inbox folder here */
 		res = (folder->folder_flags & (CAMEL_FOLDER_IS_TRASH | CAMEL_FOLDER_IS_JUNK)) == 0 && (
 		      (CAMEL_IS_VEE_FOLDER (folder)) || (
-		      !em_utils_folder_is_sent (folder, folder_uri) &&
+		      !em_utils_folder_is_sent (folder) &&
 		      !em_utils_folder_is_outbox (folder, folder_uri) &&
 		      !em_utils_folder_is_drafts (folder)));
 	}



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