[devhelp/webkit2-for-3.4: 8/9] Port printing to WebKit2
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp/webkit2-for-3.4: 8/9] Port printing to WebKit2
- Date: Fri, 2 Mar 2012 14:07:58 +0000 (UTC)
commit 41b859894aaf12f4332b2b323117041abd08ec20
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Fri Mar 2 14:30:36 2012 +0100
Port printing to WebKit2
Use printing API instead of javascript: print();
src/dh-window.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/dh-window.c b/src/dh-window.c
index 39bec65..9bc3c1d 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -195,13 +195,15 @@ static void
window_activate_print (GtkAction *action,
DhWindow *window)
{
+ WebKitWebView *web_view = window_get_active_web_view (window);
#ifdef HAVE_WEBKIT2
-/* TODO: Printing API */
-#else
- WebKitWebView *web_view;
+ WebKitPrintOperation *print_operation;
- web_view = window_get_active_web_view (window);
- webkit_web_view_execute_script (web_view, "print();");
+ print_operation = webkit_print_operation_new (web_view);
+ webkit_print_operation_run_dialog (print_operation, GTK_WIDGET (window));
+ g_object_unref (print_operation);
+#else
+ webkit_web_view_execute_script (web_view, "print();");
#endif
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]