aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-callbacks.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-05-15 01:18:03 +0800
committerDan Winship <danw@src.gnome.org>2001-05-15 01:18:03 +0800
commitb9401bbdf43b51b3596498d12ba2d73e2cca1805 (patch)
tree82d72a137b851efbfde70064f9d7fb3e6b81f6e7 /mail/mail-callbacks.c
parentf02973aaf4ee15e818981301e62b10ea1d225a53 (diff)
downloadgsoc2013-evolution-b9401bbdf43b51b3596498d12ba2d73e2cca1805.tar.gz
gsoc2013-evolution-b9401bbdf43b51b3596498d12ba2d73e2cca1805.tar.zst
gsoc2013-evolution-b9401bbdf43b51b3596498d12ba2d73e2cca1805.zip
Split "Other" page into three pages, Display, Composer, and PGP. Add HTML
* mail-config.glade: Split "Other" page into three pages, Display, Composer, and PGP. Add HTML image stuff on the Display page and default forward style on the Composer page. * mail-config.c (mail_config_get_default_forward_style, mail_config_set_default_forward_style): User-specified default style for forwarding messages. (config_read, mail_config_write_on_exit): Deal with forward style. * mail-accounts.c: Handle HTML image display options and default forward style. * mail-callbacks.c (forward): New. Forward in the user-selected default style. (forward_inline, forward_quoted): Simplify these some. Remove the fallback to forward attached when forwarding multiple messages: it should just forward the multiple messages inline or quoted in those cases. (Which it doesn't yet, but that's a bug.) * folder-browser.c (context_menu): Remove "Forward inline" and make "Forward" call forward() rather than forward_attached(). * folder-browser-factory.c: Update command/menu/toolbar/pixmap gunk for the "MessageForwardAttached" vs "MessageForward" split. * mail-session.c (mail_session_get_type): * mail-format.c (format_mime_part): * mail-account-gui.c (setup_service): Fix warnings. svn path=/trunk/; revision=9792
Diffstat (limited to 'mail/mail-callbacks.c')
-rw-r--r--mail/mail-callbacks.c130
1 files changed, 48 insertions, 82 deletions
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index c3223ea15e..ca0ba70d53 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -740,114 +740,69 @@ forward_get_composer (const char *subject)
}
static void
-do_forward_inline (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
+do_forward_non_attached (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
{
char *subject;
char *text;
- if (message) {
- subject = mail_tool_generate_forward_subject (message);
- text = mail_tool_forward_message (message);
-
- if (text) {
- EMsgComposer *composer = forward_get_composer (subject);
- if (composer) {
- e_msg_composer_set_body_text (composer, text);
- gtk_widget_show (GTK_WIDGET (composer));
- e_msg_composer_unset_changed (composer);
- }
- g_free (text);
- }
-
- g_free (subject);
- }
-}
+ if (!message)
+ return;
-static void
-do_forward_quoted (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
-{
- char *subject;
- char *text;
-
- if (message) {
- subject = mail_tool_generate_forward_subject (message);
+ subject = mail_tool_generate_forward_subject (message);
+ if (GPOINTER_TO_INT (data) == MAIL_CONFIG_FORWARD_INLINE)
+ text = mail_tool_forward_message (message);
+ else
text = mail_tool_quote_message (message, _("Forwarded message:\n"));
-
- if (text) {
- EMsgComposer *composer = forward_get_composer (subject);
- if (composer) {
- e_msg_composer_set_body_text (composer, text);
- gtk_widget_show (GTK_WIDGET (composer));
- e_msg_composer_unset_changed (composer);
- }
- g_free (text);
- }
-
- g_free (subject);
- }
-}
-static void
-do_forward_attach (CamelFolder *folder, GPtrArray *messages, CamelMimePart *part, char *subject, void *data)
-{
- if (part) {
+ if (text) {
EMsgComposer *composer = forward_get_composer (subject);
if (composer) {
- e_msg_composer_attach (composer, part);
+ e_msg_composer_set_body_text (composer, text);
gtk_widget_show (GTK_WIDGET (composer));
e_msg_composer_unset_changed (composer);
}
+ g_free (text);
}
-}
-void
-forward_messages (CamelFolder *folder, GPtrArray *uids, int flags)
-{
- if (flags == FORWARD_INLINE && uids->len == 1) {
- mail_get_message (folder, uids->pdata[0], do_forward_inline, NULL, mail_thread_new);
- } else if (flags == FORWARD_QUOTED && uids->len == 1) {
- mail_get_message (folder, uids->pdata[0], do_forward_quoted, NULL, mail_thread_new);
- } else {
- mail_build_attachment (folder, uids, do_forward_attach, NULL);
- }
+ g_free (subject);
}
-void
-forward_inlined (GtkWidget *widget, gpointer user_data)
+static void
+forward_message (FolderBrowser *fb, MailConfigForwardStyle style)
{
- FolderBrowser *fb = FOLDER_BROWSER (user_data);
- GPtrArray *uids;
-
if (!fb->message_list->cursor_uid)
return;
-
if (!check_send_configuration (fb))
return;
-
- uids = g_ptr_array_new ();
- g_ptr_array_add (uids, g_strdup (fb->message_list->cursor_uid));
- forward_messages (fb->message_list->folder, uids, FORWARD_INLINE);
- g_free (uids->pdata[0]);
- g_ptr_array_free (uids, TRUE);
+
+ mail_get_message (fb->folder, fb->message_list->cursor_uid,
+ do_forward_non_attached, GINT_TO_POINTER (style),
+ mail_thread_new);
+}
+
+void
+forward_inline (GtkWidget *widget, gpointer user_data)
+{
+ forward_message (user_data, MAIL_CONFIG_FORWARD_INLINE);
}
void
forward_quoted (GtkWidget *widget, gpointer user_data)
{
- FolderBrowser *fb = FOLDER_BROWSER (user_data);
- GPtrArray *uids;
-
- if (!fb->message_list->cursor_uid)
- return;
-
- if (!check_send_configuration (fb))
- return;
-
- uids = g_ptr_array_new ();
- g_ptr_array_add (uids, g_strdup (fb->message_list->cursor_uid));
- forward_messages (fb->message_list->folder, uids, FORWARD_QUOTED);
- g_free (uids->pdata[0]);
- g_ptr_array_free (uids, TRUE);
+ forward_message (user_data, MAIL_CONFIG_FORWARD_QUOTED);
+}
+
+static void
+do_forward_attach (CamelFolder *folder, GPtrArray *messages, CamelMimePart *part, char *subject, void *data)
+{
+ if (part) {
+ EMsgComposer *composer = forward_get_composer (subject);
+ if (composer) {
+ e_msg_composer_attach (composer, part);
+ gtk_widget_show (GTK_WIDGET (composer));
+ e_msg_composer_unset_changed (composer);
+ }
+ }
}
void
@@ -864,6 +819,17 @@ forward_attached (GtkWidget *widget, gpointer user_data)
mail_build_attachment (fb->message_list->folder, uids, do_forward_attach, NULL);
}
+void
+forward (GtkWidget *widget, gpointer user_data)
+{
+ MailConfigForwardStyle style = mail_config_get_default_forward_style ();
+
+ if (style == MAIL_CONFIG_FORWARD_ATTACHED)
+ forward_attached (widget, user_data);
+ else
+ forward_message (user_data, style);
+}
+
static void
transfer_msg (GtkWidget *widget, gpointer user_data, gboolean delete_from_source)
{