[yelp/wip/patches: 35/35] yelp-view: Give a default filename for printing
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp/wip/patches: 35/35] yelp-view: Give a default filename for printing
- Date: Wed, 28 Jan 2015 10:52:03 +0000 (UTC)
commit e56e297b77a068faa2eb973e932d3d51fbcbbfb8
Author: David King <amigadave amigadave com>
Date: Tue Sep 23 19:18:48 2014 +0100
yelp-view: Give a default filename for printing
https://bugzilla.gnome.org/show_bug.cgi?id=737206
libyelp/yelp-view.c | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c
index cff086d..33036c2 100644
--- a/libyelp/yelp-view.c
+++ b/libyelp/yelp-view.c
@@ -1548,7 +1548,32 @@ view_document_loaded (WebKitWebView *view,
static void
view_print_action (GAction *action, GVariant *parameter, YelpView *view)
{
- webkit_web_frame_print (webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view)));
+ WebKitWebFrame *main_frame;
+ GtkPrintOperation *operation;
+ GtkPrintSettings *settings;
+ GError *error = NULL;
+ YelpViewPrivate *priv = GET_PRIV (view);
+
+ main_frame = webkit_web_view_get_main_frame (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);
+ }
+
+ g_object_unref (operation);
+ g_object_unref (settings);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]