diff options
author | Dan Vrátil <dvratil@redhat.com> | 2012-07-31 22:20:31 +0800 |
---|---|---|
committer | Dan Vrátil <dvratil@redhat.com> | 2012-07-31 22:20:31 +0800 |
commit | 91189dcb60d221de78398da066974e42aad7e09a (patch) | |
tree | 474acf5366643a60588b876656e999552b16c248 /mail | |
parent | af3e9bd9948c12ac6e52043883c38668975705cf (diff) | |
download | gsoc2013-evolution-91189dcb60d221de78398da066974e42aad7e09a.tar gsoc2013-evolution-91189dcb60d221de78398da066974e42aad7e09a.tar.gz gsoc2013-evolution-91189dcb60d221de78398da066974e42aad7e09a.tar.bz2 gsoc2013-evolution-91189dcb60d221de78398da066974e42aad7e09a.tar.lz gsoc2013-evolution-91189dcb60d221de78398da066974e42aad7e09a.tar.xz gsoc2013-evolution-91189dcb60d221de78398da066974e42aad7e09a.tar.zst gsoc2013-evolution-91189dcb60d221de78398da066974e42aad7e09a.zip |
Bug #680643 - First message Print preview without CSS
Diffstat (limited to 'mail')
-rw-r--r-- | 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 e6c9aa5510..1c92f61944 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 |