[evolution] Bug #680643 - First message Print preview without CSS
- From: Dan VrÃtil <dvratil src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug #680643 - First message Print preview without CSS
- Date: Tue, 31 Jul 2012 14:20:54 +0000 (UTC)
commit 91189dcb60d221de78398da066974e42aad7e09a
Author: Dan VrÃtil <dvratil redhat com>
Date: Tue Jul 31 16:20:31 2012 +0200
Bug #680643 - First message Print preview without CSS
mail/e-mail-printer.c | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/mail/e-mail-printer.c b/mail/e-mail-printer.c
index e6c9aa5..1c92f61 100644
--- a/mail/e-mail-printer.c
+++ b/mail/e-mail-printer.c
@@ -151,13 +151,26 @@ emp_printing_done (GtkPrintOperation *operation,
g_signal_emit (emp, signals[SIGNAL_DONE], 0, operation, result);
}
+static gboolean
+do_run_print_operation (EMailPrinter *emp)
+{
+ WebKitWebFrame *frame;
+
+ frame = webkit_web_view_get_main_frame (emp->priv->webview);
+
+ webkit_web_frame_print_full (
+ frame, emp->priv->operation, emp->priv->print_action, NULL);
+
+ return FALSE;
+}
+
+
static void
emp_start_printing (GObject *object,
GParamSpec *pspec,
gpointer user_data)
{
WebKitWebView *web_view;
- WebKitWebFrame *frame;
WebKitLoadStatus load_status;
EMailPrinter *emp = user_data;
@@ -173,15 +186,17 @@ emp_start_printing (GObject *object,
g_signal_handlers_disconnect_by_func (
object, emp_start_printing, user_data);
- frame = webkit_web_view_get_main_frame (web_view);
-
if (emp->priv->print_action == GTK_PRINT_OPERATION_ACTION_EXPORT) {
gtk_print_operation_set_export_filename (
emp->priv->operation, emp->priv->export_filename);
}
- webkit_web_frame_print_full
- (frame, emp->priv->operation, emp->priv->print_action, NULL);
+ /* Give WebKit some time to perform layouting and rendering before
+ * we start printing. 500ms should be enough in most cases... */
+ g_timeout_add_full (
+ G_PRIORITY_DEFAULT, 500,
+ (GSourceFunc) do_run_print_operation,
+ g_object_ref (emp), g_object_unref);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]