aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-11 23:12:53 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:42:12 +0800
commit6693730cc102ae3af1e4a641df2048fa8bf3d39b (patch)
treefb03012e3e00cc0e26cce2b253d5701e6c071d4b
parentf73e52138b48b9fb9f9bfab442044abc61998a83 (diff)
downloadgsoc2013-evolution-6693730cc102ae3af1e4a641df2048fa8bf3d39b.tar.gz
gsoc2013-evolution-6693730cc102ae3af1e4a641df2048fa8bf3d39b.tar.zst
gsoc2013-evolution-6693730cc102ae3af1e4a641df2048fa8bf3d39b.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().
-rw-r--r--mail/em-composer-utils.c98
-rw-r--r--mail/em-composer-utils.h3
-rw-r--r--plugins/templates/templates.c2
3 files changed, 49 insertions, 54 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);
diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h
index 05b0b7cecc..785c89eaa1 100644
--- a/mail/em-composer-utils.h
+++ b/mail/em-composer-utils.h
@@ -40,7 +40,8 @@ EMsgComposer * em_utils_compose_new_message_with_mailto
CamelFolder *folder);
GtkWidget * em_utils_edit_message (EShell *shell,
CamelFolder *folder,
- CamelMimeMessage *message);
+ CamelMimeMessage *message,
+ const gchar *message_uid);
void em_utils_edit_messages (EShell *shell,
CamelFolder *folder,
GPtrArray *uids,
diff --git a/plugins/templates/templates.c b/plugins/templates/templates.c
index 6f287c3168..48a3b9e5a7 100644
--- a/plugins/templates/templates.c
+++ b/plugins/templates/templates.c
@@ -803,7 +803,7 @@ create_new_message (CamelFolder *folder, const gchar *uid, CamelMimeMessage *mes
camel_mime_message_get_recipients (template, CAMEL_RECIPIENT_TYPE_BCC));
/* Create the composer */
- em_utils_edit_message (shell, folder, new);
+ em_utils_edit_message (shell, folder, new, uid);
g_object_unref (template);
g_object_unref (new_multipart);