aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorDavid King <amigadave@amigadave.com>2013-01-23 03:49:58 +0800
committerDavid King <amigadave@amigadave.com>2013-01-23 06:53:20 +0800
commit6f5a2ad3c592e9c04664716ec63f4f311d34add8 (patch)
treeb43feba37c6cece7d759b8010096cf64904de9c1 /embed
parentd6ebacf7c2f5a5955e31b91dc09999d3e8dbbcca (diff)
downloadgsoc2013-epiphany-6f5a2ad3c592e9c04664716ec63f4f311d34add8.tar
gsoc2013-epiphany-6f5a2ad3c592e9c04664716ec63f4f311d34add8.tar.gz
gsoc2013-epiphany-6f5a2ad3c592e9c04664716ec63f4f311d34add8.tar.bz2
gsoc2013-epiphany-6f5a2ad3c592e9c04664716ec63f4f311d34add8.tar.lz
gsoc2013-epiphany-6f5a2ad3c592e9c04664716ec63f4f311d34add8.tar.xz
gsoc2013-epiphany-6f5a2ad3c592e9c04664716ec63f4f311d34add8.tar.zst
gsoc2013-epiphany-6f5a2ad3c592e9c04664716ec63f4f311d34add8.zip
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
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-web-view.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index f30d20a3c..b1d84de1a 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