aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-composer-utils.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-11 23:12:53 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-05-12 00:58:58 +0800
commit1217a54192b63166bcd6c5cbe09c8825df37cbe0 (patch)
treee7e359da8946126e582f35ebda8dec94cda7eca3 /mail/em-composer-utils.c
parente5760e065ff1f4c5b9842b182224a1ccdd2e322f (diff)
downloadgsoc2013-evolution-1217a54192b63166bcd6c5cbe09c8825df37cbe0.tar.gz
gsoc2013-evolution-1217a54192b63166bcd6c5cbe09c8825df37cbe0.tar.zst
gsoc2013-evolution-1217a54192b63166bcd6c5cbe09c8825df37cbe0.zip
Add a 'message_uid' param to em_utils_edit_message().
So we can remove the internal edit_message() function and do the work directly in em_utils_edit_message().
Diffstat (limited to 'mail/em-composer-utils.c')
-rw-r--r--mail/em-composer-utils.c98
1 files changed, 46 insertions, 52 deletions
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 994fbda4bb..a54a5231a5 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1136,54 +1136,6 @@ traverse_parts (GSList *clues, CamelMimeMessage *message, CamelDataWrapper *cont
/* Editing messages... */
-static GtkWidget *
-edit_message (EShell *shell,
- CamelFolder *folder,
- CamelMimeMessage *message,
- const gchar *message_uid)
-{
- EMsgComposer *composer;
-
- /* Template specific code follows. */
- if (em_utils_folder_is_templates (folder)) {
- GConfClient *gconf;
- GSList *clue_list = NULL;
-
- gconf = gconf_client_get_default ();
- /* Get the list from gconf */
- clue_list = gconf_client_get_list (
- gconf, GCONF_KEY_TEMPLATE_PLACEHOLDERS,
- GCONF_VALUE_STRING, NULL );
- g_object_unref (gconf);
-
- traverse_parts (
- clue_list, message,
- camel_medium_get_content (CAMEL_MEDIUM (message)));
-
- g_slist_foreach (clue_list, (GFunc) g_free, NULL);
- g_slist_free (clue_list);
- }
-
- composer = e_msg_composer_new_with_message (shell, message, NULL);
-
- if (message_uid != NULL && em_utils_folder_is_drafts (folder)) {
- gchar *folder_uri;
-
- folder_uri = e_mail_folder_uri_from_folder (folder);
-
- e_msg_composer_set_draft_headers (
- composer, folder_uri, message_uid);
-
- g_free (folder_uri);
- }
-
- composer_set_no_change (composer);
-
- gtk_widget_show (GTK_WIDGET (composer));
-
- return (GtkWidget *) composer;
-}
-
typedef enum {
QUOTING_ATTRIBUTION,
QUOTING_FORWARD,
@@ -1237,6 +1189,7 @@ quoting_text (QuotingTextEnum type)
* @shell: an #EShell
* @folder: a #CamelFolder
* @message: a #CamelMimeMessage
+ * @message_uid: UID of @message, or %NULL
*
* Opens a composer filled in with the headers/mime-parts/etc of
* @message.
@@ -1244,13 +1197,53 @@ quoting_text (QuotingTextEnum type)
GtkWidget *
em_utils_edit_message (EShell *shell,
CamelFolder *folder,
- CamelMimeMessage *message)
+ CamelMimeMessage *message,
+ const gchar *message_uid)
{
+ EMsgComposer *composer;
+
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL);
- return edit_message (shell, folder, message, NULL);
+ /* Template specific code follows. */
+ if (em_utils_folder_is_templates (folder)) {
+ CamelDataWrapper *content;
+ GConfClient *gconf;
+ GSList *clue_list = NULL;
+
+ gconf = gconf_client_get_default ();
+ /* Get the list from gconf */
+ clue_list = gconf_client_get_list (
+ gconf, GCONF_KEY_TEMPLATE_PLACEHOLDERS,
+ GCONF_VALUE_STRING, NULL );
+ g_object_unref (gconf);
+
+ content = camel_medium_get_content (CAMEL_MEDIUM (message));
+ traverse_parts (clue_list, message, content);
+
+ g_slist_foreach (clue_list, (GFunc) g_free, NULL);
+ g_slist_free (clue_list);
+ }
+
+ composer = e_msg_composer_new_with_message (shell, message, NULL);
+
+ if (message_uid != NULL && em_utils_folder_is_drafts (folder)) {
+ gchar *folder_uri;
+
+ folder_uri = e_mail_folder_uri_from_folder (folder);
+
+ e_msg_composer_set_draft_headers (
+ composer, folder_uri, message_uid);
+
+ g_free (folder_uri);
+ }
+
+ composer_set_no_change (composer);
+
+ gtk_widget_show (GTK_WIDGET (composer));
+
+ return GTK_WIDGET (composer);
}
static void
@@ -1268,7 +1261,8 @@ edit_messages_replace (CamelFolder *folder,
for (ii = 0; ii < msgs->len; ii++) {
camel_medium_remove_header (
CAMEL_MEDIUM (msgs->pdata[ii]), "X-Mailer");
- edit_message (shell, folder, msgs->pdata[ii], uids->pdata[ii]);
+ em_utils_edit_message (
+ shell, folder, msgs->pdata[ii], uids->pdata[ii]);
}
g_object_unref (shell);
@@ -1289,7 +1283,7 @@ edit_messages_no_replace (CamelFolder *folder,
for (ii = 0; ii < msgs->len; ii++) {
camel_medium_remove_header (
CAMEL_MEDIUM (msgs->pdata[ii]), "X-Mailer");
- edit_message (shell, NULL, msgs->pdata[ii], NULL);
+ em_utils_edit_message (shell, folder, msgs->pdata[ii], NULL);
}
g_object_unref (shell);