[epiphany] Set a document basename when printing to a file



commit 6f5a2ad3c592e9c04664716ec63f4f311d34add8
Author: David King <amigadave amigadave com>
Date:   Tue Jan 22 19:49:58 2013 +0000

    Set a document basename when printing to a file
    
    Bump GTK+ dependency to 3.5.4, where the new print-to-file support was
    added to GtkPrintSettings.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692337

 configure.ac          |    2 +-
 embed/ephy-web-view.c |   15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 66c00fc..fed4e60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,7 +80,7 @@ if test "$enable_maintainer_mode" = "yes"; then
 fi
 
 GLIB_REQUIRED=2.35.0
-GTK_REQUIRED=3.5.2
+GTK_REQUIRED=3.5.4
 LIBXML_REQUIRED=2.6.12
 LIBXSLT_REQUIRED=1.1.7
 WEBKIT_GTK_REQUIRED=1.11.2
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index f30d20a..b1d84de 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -3599,6 +3599,7 @@ ephy_web_view_run_print_action (EphyWebView *view, GtkPrintOperationAction actio
 {
   WebKitWebFrame *main_frame;
   GtkPrintOperation *operation;
+  GtkPrintSettings *settings;
   GError *error;
   EphyEmbedShell *shell;
 
@@ -3610,6 +3611,12 @@ ephy_web_view_run_print_action (EphyWebView *view, GtkPrintOperationAction actio
   gtk_print_operation_set_embed_page_setup (operation, TRUE);
   gtk_print_operation_set_default_page_setup (operation, ephy_embed_shell_get_page_setup (shell));
 
+  settings = gtk_print_settings_new ();
+  gtk_print_settings_set (settings,
+                          GTK_PRINT_SETTINGS_OUTPUT_BASENAME,
+                          ephy_web_view_get_title (view));
+  gtk_print_operation_set_print_settings (operation, settings);
+
   webkit_web_frame_print_full (main_frame, operation, action, &error);
 
   if (error) {
@@ -3619,6 +3626,7 @@ ephy_web_view_run_print_action (EphyWebView *view, GtkPrintOperationAction actio
     ephy_embed_shell_set_page_setup (shell, gtk_print_operation_get_default_page_setup (operation));
 
   g_object_unref (operation);
+  g_object_unref (settings);
 }
 #endif
 
@@ -3655,6 +3663,7 @@ ephy_web_view_print (EphyWebView *view)
 #ifdef HAVE_WEBKIT2
   WebKitPrintOperation *operation;
   EphyEmbedShell *shell;
+  GtkPrintSettings *settings;
 
   shell = ephy_embed_shell_get_default ();
 
@@ -3666,8 +3675,14 @@ ephy_web_view_print (EphyWebView *view)
                     G_CALLBACK (print_operation_failed_cb),
                     view);
   webkit_print_operation_set_page_setup (operation, ephy_embed_shell_get_page_setup (shell));
+  settings = gtk_print_settings_new ();
+  gtk_print_settings_set (settings,
+                          GTK_PRINT_SETTINGS_OUTPUT_BASENAME,
+                          ephy_web_view_get_title (view));
+  webkit_print_operation_set_print_settings (operation, settings);
   webkit_print_operation_run_dialog (operation, NULL);
   g_object_unref (operation);
+  g_object_unref (settings);
 #else
   ephy_web_view_run_print_action (view, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]