[evolution/webkit] Drop 'folder_uri' param from em_utils_folder_is_templates().



commit f4f1ffbc513cca1a8d27ee356acf5875d39ecc1d
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue May 3 09:07:26 2011 -0400

    Drop 'folder_uri' param from em_utils_folder_is_templates().

 mail/e-mail-folder-pane.c  |    2 +-
 mail/e-mail-reader-utils.c |    2 +-
 mail/em-composer-utils.c   |    2 +-
 mail/em-utils.c            |   18 ++++++++++--------
 mail/em-utils.h            |    2 +-
 5 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/mail/e-mail-folder-pane.c b/mail/e-mail-folder-pane.c
index 4035e48..ec64f81 100644
--- a/mail/e-mail-folder-pane.c
+++ b/mail/e-mail-folder-pane.c
@@ -92,7 +92,7 @@ mail_paned_view_open_selected_mail (EMailPanedView *view)
 	folder_uri = e_mail_reader_get_folder_uri (reader);
 	if (em_utils_folder_is_drafts (folder) ||
 		em_utils_folder_is_outbox (folder, folder_uri) ||
-		em_utils_folder_is_templates (folder, folder_uri)) {
+		em_utils_folder_is_templates (folder)) {
 		em_utils_edit_messages (shell, folder, uids, TRUE);
 		return 0;
 	}
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 9be062d..70bd53d 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -243,7 +243,7 @@ e_mail_reader_open_selected (EMailReader *reader)
 
 	if (em_utils_folder_is_drafts (folder) ||
 		em_utils_folder_is_outbox (folder, folder_uri) ||
-		em_utils_folder_is_templates (folder, folder_uri)) {
+		em_utils_folder_is_templates (folder)) {
 		em_utils_edit_messages (shell, folder, uids, TRUE);
 		return uids->len;
 	}
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 68d5c00..2d3e7de 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1117,7 +1117,7 @@ edit_message (EShell *shell,
 	EMsgComposer *composer;
 
 	/* Template specific code follows. */
-	if (em_utils_folder_is_templates (folder, NULL)) {
+	if (em_utils_folder_is_templates (folder)) {
 		GConfClient *gconf;
 		GSList *clue_list = NULL;
 
diff --git a/mail/em-utils.c b/mail/em-utils.c
index ba496dc..86b6b81 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -992,23 +992,25 @@ em_utils_selection_get_urilist (GtkSelectionData *selection_data,
 
 /**
  * em_utils_folder_is_templates:
- * @folder: folder
- * @uri: uri for this folder, if known
+ * @folder: a #CamelFolder
  *
  * Decides if @folder is a Templates folder.
  *
- * Returns %TRUE if this is a Drafts folder or %FALSE otherwise.
+ * Returns %TRUE if this is a Templates folder or %FALSE otherwise.
  **/
 
 gboolean
-em_utils_folder_is_templates (CamelFolder *folder, const gchar *uri)
+em_utils_folder_is_templates (CamelFolder *folder)
 {
 	CamelFolder *local_templates_folder;
 	CamelSession *session;
 	CamelStore *store;
 	EAccountList *account_list;
 	EIterator *iterator;
-	gint is_templates = FALSE;
+	gchar *folder_uri;
+	gboolean is_templates = FALSE;
+
+	g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
 
 	local_templates_folder =
 		e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_TEMPLATES);
@@ -1016,8 +1018,7 @@ em_utils_folder_is_templates (CamelFolder *folder, const gchar *uri)
 	if (folder == local_templates_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));
@@ -1037,7 +1038,7 @@ em_utils_folder_is_templates (CamelFolder *folder, const gchar *uri)
 			templates_uri = em_uri_to_camel (
 				account->templates_folder_uri);
 			is_templates = e_mail_folder_uri_equal (
-				session, templates_uri, uri);
+				session, templates_uri, folder_uri);
 			g_free (templates_uri);
 		}
 
@@ -1045,6 +1046,7 @@ em_utils_folder_is_templates (CamelFolder *folder, const gchar *uri)
 	}
 
 	g_object_unref (iterator);
+	g_free (folder_uri);
 
 	return is_templates;
 }
diff --git a/mail/em-utils.h b/mail/em-utils.h
index 744bfe6..069acb9 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -63,7 +63,7 @@ void em_utils_selection_set_urilist (GtkSelectionData *data, CamelFolder *folder
 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, const gchar *uri);
+gboolean em_utils_folder_is_templates (CamelFolder *folder);
 gboolean em_utils_folder_is_sent (CamelFolder *folder, const gchar *uri);
 gboolean em_utils_folder_is_outbox (CamelFolder *folder, const gchar *uri);
 



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