From d300de403de5b9b2d3c2c2f9d371f59859eeaf8c Mon Sep 17 00:00:00 2001 From: pepp Date: Thu, 15 Dec 2011 12:23:52 +0530 Subject: Bug 566793 - Support Drop And Drag Into Nautilus As PDF File --- mail/em-format-html-print.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'mail/em-format-html-print.c') diff --git a/mail/em-format-html-print.c b/mail/em-format-html-print.c index fd47275e30..d1e7dfb752 100644 --- a/mail/em-format-html-print.c +++ b/mail/em-format-html-print.c @@ -45,6 +45,8 @@ efhp_finalize (GObject *object) { EMFormatHTMLPrint *efhp = (EMFormatHTMLPrint *) object; + g_free (efhp->export_filename); + efhp->export_filename = NULL; gtk_widget_destroy (efhp->window); if (efhp->source != NULL) g_object_unref (efhp->source); @@ -90,6 +92,9 @@ em_format_html_print_init (EMFormatHTMLPrint *efhp) gtk_widget_realize (GTK_WIDGET (web_view)); efhp->parent.show_icon = FALSE; ((EMFormat *) efhp)->print = TRUE; + + efhp->export_filename = NULL; + efhp->async = TRUE; } EMFormatHTMLPrint * @@ -184,6 +189,9 @@ emfhp_complete (EMFormatHTMLPrint *efhp) operation = e_print_operation_new (); + if (efhp->action == GTK_PRINT_OPERATION_ACTION_EXPORT) + gtk_print_operation_set_export_filename (operation, efhp->export_filename); + gtk_html_print_operation_run ( GTK_HTML (web_view), operation, efhp->action, NULL, @@ -213,12 +221,18 @@ em_format_html_print_message (EMFormatHTMLPrint *efhp, em_format_html_load_images (EM_FORMAT_HTML (efhp)); - g_signal_connect ( - efhp, "complete", G_CALLBACK (emfhp_complete), efhp); - /* FIXME Not passing a GCancellable here. */ - em_format_format_clone ( - EM_FORMAT (efhp), - folder, message_uid, message, - EM_FORMAT (efhp->source), NULL); + if (efhp->async) { + g_signal_connect ( + efhp, "complete", G_CALLBACK (emfhp_complete), efhp); + + /* FIXME Not passing a GCancellable here. */ + em_format_format_clone ( + (EMFormat *) efhp, + folder, message_uid, message, + (EMFormat *) efhp->source, NULL); + } else { + em_format_html_clone_sync (folder, message_uid, message, (EMFormatHTML *)efhp, (EMFormat *)efhp->source); + emfhp_complete (efhp); + } } -- cgit v1.2.3