summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcos Chavarría Teijeiro <chavarria1991@gmail.com>2014-09-11 14:05:42 +0200
committerDavid King <amigadave@amigadave.com>2015-02-16 20:00:56 +0000
commit4fcd1d62a3591cae5de743e0b900ba69c927a5bc (patch)
tree0190a75b2a7a20fdc936d20eb6a77f302af77f8c
parente7bb1c550bef01592cbf6539db220f20a2881e88 (diff)
downloadyelp-4fcd1d62a3591cae5de743e0b900ba69c927a5bc.tar.gz
yelp-view: Implement view_print_action using WebKit2 API
-rw-r--r--libyelp/yelp-view.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c
index e4156871..f0f0f746 100644
--- a/libyelp/yelp-view.c
+++ b/libyelp/yelp-view.c
@@ -1551,31 +1551,24 @@ view_document_loaded (WebKitWebView *view,
static void
view_print_action (GAction *action, GVariant *parameter, YelpView *view)
{
- WebKitWebFrame *main_frame;
- GtkPrintOperation *operation;
+ GtkWidget *window;
+ WebKitPrintOperation *print_operation;
GtkPrintSettings *settings;
- GError *error = NULL;
YelpViewPrivate *priv = GET_PRIV (view);
- main_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view));
+ window = gtk_widget_get_toplevel (GTK_WIDGET (view));
+
+ print_operation = webkit_print_operation_new (WEBKIT_WEB_VIEW (view));
- operation = gtk_print_operation_new ();
settings = gtk_print_settings_new ();
gtk_print_settings_set (settings,
GTK_PRINT_SETTINGS_OUTPUT_BASENAME,
priv->page_title);
- gtk_print_operation_set_print_settings (operation, settings);
-
- webkit_web_frame_print_full (main_frame, operation,
- GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
- &error);
-
- if (error) {
- g_warning ("Error showing print dialog: %s", error->message);
- g_error_free (error);
- }
+ gtk_print_operation_set_print_settings (GTK_PRINT_OPERATION (print_operation),
+ settings);
- g_object_unref (operation);
+ webkit_print_operation_run_dialog (print_operation, GTK_WINDOW (window));
+ g_object_unref (print_operation);
g_object_unref (settings);
}