[evolution] Print of message source doesn't print message source
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Print of message source doesn't print message source
- Date: Fri, 27 Jul 2018 09:35:19 +0000 (UTC)
commit a5f9884ee6aea7c3fe3b2654ef5f3c6528cd5b04
Author: Milan Crha <mcrha redhat com>
Date: Fri Jul 27 11:32:33 2018 +0200
Print of message source doesn't print message source
It had been printing parsed message instead, which is not what the user
had been looking at in the message source window.
src/mail/e-mail-printer.c | 28 ++++++++++++++++++++++++----
src/mail/e-mail-printer.h | 4 ++++
src/mail/e-mail-reader-utils.c | 3 +++
3 files changed, 31 insertions(+), 4 deletions(-)
---
diff --git a/src/mail/e-mail-printer.c b/src/mail/e-mail-printer.c
index f47f3294a8..73b676c833 100644
--- a/src/mail/e-mail-printer.c
+++ b/src/mail/e-mail-printer.c
@@ -44,6 +44,7 @@ struct _EMailPrinterPrivate {
EMailFormatter *formatter;
EMailPartList *part_list;
EMailRemoteContent *remote_content;
+ EMailFormatterMode mode;
gchar *export_filename;
};
@@ -329,14 +330,15 @@ mail_printer_load_changed_cb (WebKitWebView *web_view,
static WebKitWebView *
mail_printer_new_web_view (const gchar *charset,
- const gchar *default_charset)
+ const gchar *default_charset,
+ EMailFormatterMode mode)
{
WebKitWebView *web_view;
EMailFormatter *formatter;
web_view = g_object_new (
E_TYPE_MAIL_DISPLAY,
- "mode", E_MAIL_FORMATTER_MODE_PRINTING, NULL);
+ "mode", mode, NULL);
/* Do not load remote images, print what user sees in the preview panel */
e_mail_display_set_force_load_images (E_MAIL_DISPLAY (web_view), FALSE);
@@ -475,6 +477,7 @@ e_mail_printer_init (EMailPrinter *printer)
printer->priv = E_MAIL_PRINTER_GET_PRIVATE (printer);
printer->priv->formatter = e_mail_formatter_print_new ();
+ printer->priv->mode = E_MAIL_FORMATTER_MODE_PRINTING;
}
EMailPrinter *
@@ -508,6 +511,23 @@ e_mail_printer_ref_remote_content (EMailPrinter *printer)
return g_object_ref (printer->priv->remote_content);
}
+void
+e_mail_printer_set_mode (EMailPrinter *printer,
+ EMailFormatterMode mode)
+{
+ g_return_if_fail (E_IS_MAIL_PRINTER (printer));
+
+ printer->priv->mode = mode;
+}
+
+EMailFormatterMode
+e_mail_printer_get_mode (EMailPrinter *printer)
+{
+ g_return_val_if_fail (E_IS_MAIL_PRINTER (printer), E_MAIL_FORMATTER_MODE_PRINTING);
+
+ return printer->priv->mode;
+}
+
void
e_mail_printer_print (EMailPrinter *printer,
GtkPrintOperationAction action, /* unused */
@@ -552,7 +572,7 @@ e_mail_printer_print (EMailPrinter *printer,
task = g_task_new (printer, cancellable, callback, user_data);
- web_view = mail_printer_new_web_view (charset, default_charset);
+ web_view = mail_printer_new_web_view (charset, default_charset, e_mail_printer_get_mode (printer));
e_mail_display_set_part_list (E_MAIL_DISPLAY (web_view), part_list);
async_context->web_view = g_object_ref_sink (web_view);
@@ -568,7 +588,7 @@ e_mail_printer_print (EMailPrinter *printer,
mail_uri = e_mail_part_build_uri (
folder, message_uid,
"__evo-load-image", G_TYPE_BOOLEAN, TRUE,
- "mode", G_TYPE_INT, E_MAIL_FORMATTER_MODE_PRINTING,
+ "mode", G_TYPE_INT, e_mail_printer_get_mode (printer),
"formatter_default_charset", G_TYPE_STRING, default_charset,
"formatter_charset", G_TYPE_STRING, charset,
NULL);
diff --git a/src/mail/e-mail-printer.h b/src/mail/e-mail-printer.h
index 7926fa9541..4df762bd8e 100644
--- a/src/mail/e-mail-printer.h
+++ b/src/mail/e-mail-printer.h
@@ -64,6 +64,10 @@ EMailPartList * e_mail_printer_ref_part_list (EMailPrinter *printer);
EMailRemoteContent *
e_mail_printer_ref_remote_content
(EMailPrinter *printer);
+void e_mail_printer_set_mode (EMailPrinter *printer,
+ EMailFormatterMode mode);
+EMailFormatterMode
+ e_mail_printer_get_mode (EMailPrinter *printer);
void e_mail_printer_print (EMailPrinter *printer,
GtkPrintOperationAction action,
EMailFormatter *formatter,
diff --git a/src/mail/e-mail-reader-utils.c b/src/mail/e-mail-reader-utils.c
index 36c5cc95d0..adb329dd2f 100644
--- a/src/mail/e-mail-reader-utils.c
+++ b/src/mail/e-mail-reader-utils.c
@@ -1593,6 +1593,9 @@ mail_reader_print_parse_message_cb (GObject *source_object,
e_mail_printer_set_export_filename (printer, export_basename);
g_free (export_basename);
+ if (e_mail_display_get_mode (mail_display) == E_MAIL_FORMATTER_MODE_SOURCE)
+ e_mail_printer_set_mode (printer, E_MAIL_FORMATTER_MODE_SOURCE);
+
g_clear_object (&remote_content);
e_activity_set_text (activity, _("Printing"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]