From 7066c99ee903da1fa39a3506a1f562fb346cd6d0 Mon Sep 17 00:00:00 2001 From: portix Date: Wed, 9 Jan 2013 23:58:34 +0100 Subject: New command 'print_preview'; new option print-previewer --- src/commands.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/commands.c') diff --git a/src/commands.c b/src/commands.c index 5efeca5f..b8de8ffb 100644 --- a/src/commands.c +++ b/src/commands.c @@ -661,12 +661,36 @@ commands_print(KeyMap *km, Arg *arg) WebKitWebFrame *frame = webkit_web_view_get_focused_frame(wv); if (frame) { + char *print_command = GET_CHAR("print-previewer"); + if (print_command) + g_object_set(gtk_settings_get_default(), "gtk-print-preview-command", print_command, NULL); + webkit_web_frame_print(frame); return STATUS_OK; } return STATUS_ERROR; }/*}}}*/ +DwbStatus +commands_print_preview(KeyMap *km, Arg *arg) +{ + WebKitWebView *wv = commands_get_webview_with_nummod(); + WebKitWebFrame *frame = webkit_web_view_get_focused_frame(wv); + if (frame) + { + char *print_command = GET_CHAR("print-previewer"); + if (print_command) + g_object_set(gtk_settings_get_default(), "gtk-print-preview-command", print_command, NULL); + + GtkPrintOperation *operation = gtk_print_operation_new(); + webkit_web_frame_print_full(frame, operation, GTK_PRINT_OPERATION_ACTION_PREVIEW, NULL); + g_object_unref(operation); + return STATUS_OK; + } + return STATUS_ERROR; +}/*}}}*/ + + /* commands_web_inspector {{{*/ DwbStatus commands_web_inspector(KeyMap *km, Arg *arg) -- cgit v1.2.3