[yelp/wip/amigadave/webkit2-port: 26/53] yelp-view: Implement view_print_action using WebKit2 API
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp/wip/amigadave/webkit2-port: 26/53] yelp-view: Implement view_print_action using WebKit2 API
- Date: Mon, 22 Jun 2015 13:59:28 +0000 (UTC)
commit e36d442420eb746b85d75b2ed2691a0daf737699
Author: Marcos ChavarrÃa Teijeiro <chavarria1991 gmail com>
Date: Thu Sep 11 14:05:42 2014 +0200
yelp-view: Implement view_print_action using WebKit2 API
libyelp/yelp-view.c | 25 +++++++++----------------
1 files changed, 9 insertions(+), 16 deletions(-)
---
diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c
index 4067275..6088715 100644
--- a/libyelp/yelp-view.c
+++ b/libyelp/yelp-view.c
@@ -1592,31 +1592,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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]