diff options
author | portix <none@none> | 2013-01-09 23:58:34 +0100 |
---|---|---|
committer | portix <none@none> | 2013-01-09 23:58:34 +0100 |
commit | 7066c99ee903da1fa39a3506a1f562fb346cd6d0 (patch) | |
tree | 79502b58e990a346f10701a1fd86e72d7ecaf83f /src/commands.c | |
parent | 1d3c857fb1b1c1215065166d9fdb0c6841c9d49f (diff) | |
download | dwb-7066c99ee903da1fa39a3506a1f562fb346cd6d0.zip |
New command 'print_preview'; new option print-previewer
Diffstat (limited to 'src/commands.c')
-rw-r--r-- | src/commands.c | 24 |
1 files changed, 24 insertions, 0 deletions
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) |