[devhelp] Port printing to WebKit2
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp] Port printing to WebKit2
- Date: Mon, 5 Mar 2012 16:00:43 +0000 (UTC)
commit 2782d9b69b55875440adaba4d2e25302044be212
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 eb5de50..dce0464 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -196,13 +196,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]