aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Millan Soto <jmillan@igalia.com>2010-02-20 01:35:51 +0800
committerXan Lopez <xan@gnome.org>2010-04-07 16:40:43 +0800
commit21250dde74250883831a107821bb23fc0232e160 (patch)
treeb0cb8e704334fde3395825e3f80d12900a30b492
parent29a826d202b0557c652b237b0b91a59ad4b2e371 (diff)
downloadgsoc2013-epiphany-21250dde74250883831a107821bb23fc0232e160.tar
gsoc2013-epiphany-21250dde74250883831a107821bb23fc0232e160.tar.gz
gsoc2013-epiphany-21250dde74250883831a107821bb23fc0232e160.tar.bz2
gsoc2013-epiphany-21250dde74250883831a107821bb23fc0232e160.tar.lz
gsoc2013-epiphany-21250dde74250883831a107821bb23fc0232e160.tar.xz
gsoc2013-epiphany-21250dde74250883831a107821bb23fc0232e160.tar.zst
gsoc2013-epiphany-21250dde74250883831a107821bb23fc0232e160.zip
Improve page print implementation
Use the already existing functions we have for print preview also for printing; fixes a bunch of usability issues. Bug #609756 Signed-off-by: Xan Lopez <xan@gnome.org>
-rw-r--r--embed/ephy-web-view.c44
-rw-r--r--embed/ephy-web-view.h1
-rw-r--r--src/window-commands.c4
3 files changed, 35 insertions, 14 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index cbb70c930..e7f47b448 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -3026,17 +3026,8 @@ ephy_web_view_show_page_certificate (EphyWebView *view)
{
}
-/**
- * ephy_web_view_show_print_preview
- * @view: an #EphyWebView
- *
- * Generates a print preview of the specified view.
- * An external viewer is used to display the preview.
- *
- * Since: 2.30
- **/
-void
-ephy_web_view_show_print_preview (EphyWebView *view)
+static void
+ephy_web_view_run_print_action (EphyWebView *view, GtkPrintOperationAction action)
{
WebKitWebFrame *main_frame;
GtkPrintOperation *operation;
@@ -3050,7 +3041,7 @@ ephy_web_view_show_print_preview (EphyWebView *view)
operation = gtk_print_operation_new ();
gtk_print_operation_set_default_page_setup (operation, ephy_embed_shell_get_page_setup (shell));
- webkit_web_frame_print_full (main_frame, operation, GTK_PRINT_OPERATION_ACTION_PREVIEW, &error);
+ webkit_web_frame_print_full (main_frame, operation, action, &error);
g_object_unref (operation);
if (error) {
@@ -3072,8 +3063,35 @@ ephy_web_view_show_print_preview (EphyWebView *view)
ephy_embed_add_top_widget (embed, info_bar, FALSE);
gtk_widget_show_all (info_bar);
}
+}
- return;
+/**
+ * ephy_web_view_show_print_preview
+ * @view: an #EphyWebView
+ *
+ * Generates a print preview of the specified view.
+ * An external viewer is used to display the preview.
+ *
+ * Since: 2.30
+ **/
+void
+ephy_web_view_show_print_preview (EphyWebView *view)
+{
+ ephy_web_view_run_print_action (view, GTK_PRINT_OPERATION_ACTION_PREVIEW);
+}
+
+/**
+ * ephy_web_view_print
+ * @view: an #EphyWebView
+ *
+ * Opens a dialog to print the specified view.
+ *
+ * Since: 2.30
+ **/
+void
+ephy_web_view_print (EphyWebView *view)
+{
+ ephy_web_view_run_print_action (view, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
}
/**
diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h
index 57dde0bff..7b7162590 100644
--- a/embed/ephy-web-view.h
+++ b/embed/ephy-web-view.h
@@ -183,6 +183,7 @@ void ephy_web_view_get_security_level (EphyWebView
char **description);
void ephy_web_view_show_page_certificate (EphyWebView *view);
void ephy_web_view_show_print_preview (EphyWebView *view);
+void ephy_web_view_print (EphyWebView *view);
GSList * ephy_web_view_get_go_up_list (EphyWebView *view);
void ephy_web_view_set_title (EphyWebView *view,
const char *view_title);
diff --git a/src/window-commands.c b/src/window-commands.c
index b93c04639..847339946 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -102,12 +102,14 @@ window_cmd_file_print (GtkAction *action,
EphyWindow *window)
{
EphyEmbed *embed;
+ EphyWebView *view;
embed = ephy_embed_container_get_active_child
(EPHY_EMBED_CONTAINER (window));
g_return_if_fail (EPHY_IS_EMBED (embed));
+ view = ephy_embed_get_web_view (embed);
- webkit_web_view_execute_script (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed), "print();");
+ ephy_web_view_print (view);
}
void