aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--embed/ephy-embed-container.c4
-rw-r--r--embed/ephy-web-view.c73
-rw-r--r--embed/ephy-web-view.h16
-rw-r--r--po/POTFILES.in1
-rw-r--r--src/Makefile.am2
-rw-r--r--src/ephy-find-toolbar.c4
-rw-r--r--src/ephy-window.c117
-rw-r--r--src/ephy-window.h4
-rw-r--r--src/ppview-toolbar.c375
-rw-r--r--src/ppview-toolbar.h60
-rw-r--r--src/window-commands.c9
11 files changed, 49 insertions, 616 deletions
diff --git a/embed/ephy-embed-container.c b/embed/ephy-embed-container.c
index 50d1c143c..75ca72e78 100644
--- a/embed/ephy-embed-container.c
+++ b/embed/ephy-embed-container.c
@@ -47,10 +47,6 @@ ephy_embed_container_base_init (gpointer g_class)
g_param_spec_object ("active-child", NULL, NULL,
GTK_TYPE_WIDGET /* Can't use an interface type here */,
G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
- g_object_interface_install_property (g_class,
- g_param_spec_boolean ("is-print-preview", NULL, NULL,
- FALSE,
- G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
}
}
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 44143b97e..ed745aecc 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -3011,46 +3011,53 @@ ephy_web_view_show_page_certificate (EphyWebView *view)
}
/**
- * ephy_web_view_set_print_preview_mode:
+ * ephy_web_view_show_print_preview
* @view: an #EphyWebView
- * @preview_mode: Whether the print preview mode is enabled.
*
- * Enable and disable the print preview mode.
+ * Generates a print preview of the specified view.
+ * An external viewer is used to display the preview.
+ *
+ * Since: 2.30
**/
void
-ephy_web_view_set_print_preview_mode (EphyWebView *view,
- gboolean preview_mode)
+ephy_web_view_show_print_preview (EphyWebView *view)
{
-}
+ WebKitWebFrame *main_frame;
+ GtkPrintOperation *operation;
+ GError *error;
+ EphyEmbedShell *shell;
-/**
- * ephy_web_view_print_preview_n_pages:
- * @view: an #EphyWebView
- *
- * Returns the number of pages which would appear in @view's loaded document
- * if it were to be printed.
- *
- * Return value: the number of pages in @view's loaded document
- **/
-int
-ephy_web_view_print_preview_n_pages (EphyWebView *view)
-{
- return 0;
-}
+ shell = ephy_embed_shell_get_default ();
+ error = NULL;
+ main_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view));
-/**
- * ephy_web_view_print_preview_navigate:
- * @view: an #EphyWebView
- * @type: an #EphyPrintPreviewNavType which determines where to navigate
- * @page: if @type is %EPHY_WEB_VIEW_PRINTPREVIEW_GOTO_PAGENUM, the desired page number
- *
- * Navigates @view's print preview.
- **/
-void
-ephy_web_view_print_preview_navigate (EphyWebView *view,
- EphyWebViewPrintPreviewNavType type,
- int page)
-{
+ 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);
+ g_object_unref (operation);
+
+ if (error) {
+ GtkWidget *info_bar;
+ GtkWidget *label;
+ GtkContainer *content_area;
+ EphyEmbed *embed = EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (view);
+
+ info_bar = gtk_info_bar_new_with_buttons (GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
+ label = gtk_label_new (error->message);
+ content_area = GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (info_bar)));
+ g_error_free (error);
+
+ gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_ERROR);
+ gtk_container_add (content_area, label);
+ g_signal_connect (info_bar, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
+
+ ephy_embed_add_top_widget (embed, info_bar, FALSE);
+ gtk_widget_show_all (info_bar);
+ }
+
+ return;
}
/**
diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h
index 37852bccd..57dde0bff 100644
--- a/embed/ephy-web-view.h
+++ b/embed/ephy-web-view.h
@@ -83,15 +83,6 @@ typedef enum
typedef enum
{
- EPHY_WEB_VIEW_PRINTPREVIEW_GOTO_PAGENUM = 0,
- EPHY_WEB_VIEW_PRINTPREVIEW_PREV_PAGE = 1,
- EPHY_WEB_VIEW_PRINTPREVIEW_NEXT_PAGE = 2,
- EPHY_WEB_VIEW_PRINTPREVIEW_HOME = 3,
- EPHY_WEB_VIEW_PRINTPREVIEW_END = 4
-} EphyWebViewPrintPreviewNavType;
-
-typedef enum
-{
EPHY_WEB_VIEW_STATE_IS_UNKNOWN,
EPHY_WEB_VIEW_STATE_IS_INSECURE,
EPHY_WEB_VIEW_STATE_IS_BROKEN,
@@ -191,12 +182,7 @@ void ephy_web_view_get_security_level (EphyWebView
EphyWebViewSecurityLevel *level,
char **description);
void ephy_web_view_show_page_certificate (EphyWebView *view);
-void ephy_web_view_set_print_preview_mode (EphyWebView *view,
- gboolean preview_mode);
-int ephy_web_view_print_preview_n_pages (EphyWebView *view);
-void ephy_web_view_print_preview_navigate (EphyWebView *view,
- EphyWebViewPrintPreviewNavType type,
- int page);
+void ephy_web_view_show_print_preview (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/po/POTFILES.in b/po/POTFILES.in
index 95eaadc40..a4a50abb3 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -71,6 +71,5 @@ src/ephy-toolbars-model.c
src/ephy-window.c
src/pdm-dialog.c
src/popup-commands.c
-src/ppview-toolbar.c
src/prefs-dialog.c
src/window-commands.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 0a984d7b5..712b7f569 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -36,7 +36,6 @@ NOINST_H_FILES = \
pdm-dialog.h \
popup-commands.h \
prefs-dialog.h \
- ppview-toolbar.h \
window-commands.h
INST_H_FILES = \
@@ -86,7 +85,6 @@ libephymain_la_SOURCES = \
pdm-dialog.c \
popup-commands.c \
prefs-dialog.c \
- ppview-toolbar.c \
window-commands.c \
$(INST_H_FILES) \
$(NOINST_H_FILES) \
diff --git a/src/ephy-find-toolbar.c b/src/ephy-find-toolbar.c
index 196957de1..0241b1541 100644
--- a/src/ephy-find-toolbar.c
+++ b/src/ephy-find-toolbar.c
@@ -187,14 +187,10 @@ tab_search_key_press_cb (EphyEmbed *embed,
GdkEventKey *event,
EphyFindToolbar *toolbar)
{
- EphyFindToolbarPrivate *priv = toolbar->priv;
GtkWidget *widget = (GtkWidget *) toolbar;
g_return_val_if_fail (event != NULL, FALSE);
- /* don't do anything in PPV mode */
- if (ephy_window_get_is_print_preview (priv->window)) return FALSE;
-
/* check for / and ' which open the find toolbar in text resp. link mode */
if (gtk_widget_get_visible (widget) == FALSE)
{
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 714d5ce87..594f79a27 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -25,7 +25,6 @@
#include "ephy-type-builtins.h"
#include "ephy-embed-type-builtins.h"
#include "ephy-state.h"
-#include "ppview-toolbar.h"
#include "window-commands.h"
#include "ephy-embed-container.h"
#include "ephy-embed-shell.h"
@@ -441,7 +440,6 @@ struct _EphyWindowPrivate
GtkActionGroup *popups_action_group;
EphyEncodingMenu *enc_menu;
EphyTabsMenu *tabs_menu;
- PPViewToolbar *ppview_toolbar;
GtkNotebook *notebook;
EphyEmbed *active_embed;
EphyFindToolbar *find_toolbar;
@@ -465,7 +463,6 @@ struct _EphyWindowPrivate
guint closing : 1;
guint has_size : 1;
guint fullscreen_mode : 1;
- guint ppv_mode : 1;
guint should_save_chrome : 1;
guint is_popup : 1;
guint present_on_insert : 1;
@@ -477,7 +474,6 @@ enum
PROP_0,
PROP_ACTIVE_CHILD,
PROP_CHROME,
- PROP_PPV_MODE,
PROP_SINGLE_TAB_MODE
};
@@ -747,8 +743,7 @@ exit_fullscreen_clicked_cb (EphyWindow *window)
static gboolean
get_toolbar_visibility (EphyWindow *window)
{
- return ((window->priv->chrome & EPHY_WEB_VIEW_CHROME_TOOLBAR) != 0) &&
- !window->priv->ppv_mode;
+ return ((window->priv->chrome & EPHY_WEB_VIEW_CHROME_TOOLBAR) != 0);
}
static void
@@ -761,14 +756,7 @@ get_chromes_visibility (EphyWindow *window,
EphyWindowPrivate *priv = window->priv;
EphyWebViewChrome flags = priv->chrome;
- if (window->priv->ppv_mode)
- {
- *show_menubar = *show_statusbar
- = *show_toolbar
- = *show_tabsbar
- = FALSE;
- }
- else if (window->priv->fullscreen_mode)
+ if (window->priv->fullscreen_mode)
{
*show_toolbar = (flags & EPHY_WEB_VIEW_CHROME_TOOLBAR) != 0;
*show_menubar = *show_statusbar = FALSE;
@@ -988,8 +976,8 @@ ephy_window_key_press_event (GtkWidget *widget,
}
}
- /* Don't activate menubar in ppv mode, or in lockdown mode */
- if (priv->ppv_mode || eel_gconf_get_boolean (CONF_LOCKDOWN_HIDE_MENUBAR))
+ /* Don't activate menubar in lockdown mode */
+ if (eel_gconf_get_boolean (CONF_LOCKDOWN_HIDE_MENUBAR))
{
return GTK_WIDGET_CLASS (ephy_window_parent_class)->key_press_event (widget, event);
}
@@ -1017,48 +1005,11 @@ ephy_window_key_press_event (GtkWidget *widget,
return GTK_WIDGET_CLASS (ephy_window_parent_class)->key_press_event (widget, event);
}
-void
-_ephy_window_set_print_preview (EphyWindow *window,
- gboolean enabled)
-{
- EphyWindowPrivate *priv = window->priv;
- GtkAccelGroup *accel_group;
-
- accel_group = gtk_ui_manager_get_accel_group (window->priv->manager);
-
- if (priv->ppv_mode == enabled) return;
-
- priv->ppv_mode = enabled;
-
- sync_chromes_visibility (window);
-
- if (enabled)
- {
- g_return_if_fail (priv->ppview_toolbar == NULL);
-
- ephy_find_toolbar_request_close (priv->find_toolbar);
-
- priv->ppview_toolbar = ppview_toolbar_new (window);
- gtk_window_remove_accel_group (GTK_WINDOW (window), accel_group);
- }
- else
- {
- g_return_if_fail (priv->ppview_toolbar != NULL);
-
- g_object_unref (priv->ppview_toolbar);
- priv->ppview_toolbar = NULL;
- gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
- }
-
- g_object_notify (G_OBJECT (window), "is-print-preview");
-}
-
static gboolean
ephy_window_delete_event (GtkWidget *widget,
GdkEventAny *event)
{
EphyWindow *window = EPHY_WINDOW (widget);
- EphyWindowPrivate *priv = window->priv;
EphyEmbed *modified_embed = NULL;
GList *tabs, *l;
gboolean modified = FALSE;
@@ -1067,22 +1018,6 @@ ephy_window_delete_event (GtkWidget *widget,
*/
if (eel_gconf_get_boolean("/apps/epiphany/lockdown/disable_quit")) return TRUE;
- /* Workaround a crash when closing a window while in print preview mode. See
- * mozilla bug #241809. /
- * Go back to normal mode instead of closing, see bug #326136.
- */
- if (priv->ppv_mode)
- {
- EphyEmbed *embed;
-
- embed = window->priv->active_embed;
- ephy_web_view_set_print_preview_mode (ephy_embed_get_web_view (embed), FALSE);
-
- _ephy_window_set_print_preview (window, FALSE);
-
- return TRUE;
- }
-
tabs = impl_get_children (EPHY_EMBED_CONTAINER (window));
for (l = tabs; l != NULL; l = l->next)
{
@@ -2188,12 +2123,6 @@ show_embed_popup (EphyWindow *window,
char *uri;
EphyEmbedEvent *embed_event;
- /* Do not show the menu in print preview mode */
- if (priv->ppv_mode)
- {
- return;
- }
-
#if 0
value = ephy_embed_event_get_property (event, "framed_page");
framed = g_value_get_int (value);
@@ -2924,9 +2853,6 @@ embed_modal_alert_cb (EphyEmbed *embed,
EphyWindowPrivate *priv = window->priv;
const char *address;
- /* if we're in ppv mode, we cannot switch tabs, so inhibit the alert */
- if (priv->ppv_mode) return TRUE;
-
/* switch the window to the tab, and bring the window to the foreground
* (since the alert is modal, the user won't be able to do anything
* with his current window anyway :|)
@@ -3315,12 +3241,6 @@ ephy_window_dispose (GObject *object)
g_object_unref (priv->tabs_menu);
priv->tabs_menu = NULL;
- if (priv->ppview_toolbar)
- {
- g_object_unref (priv->ppview_toolbar);
- priv->ppview_toolbar = NULL;
- }
-
priv->action_group = NULL;
priv->popups_action_group = NULL;
@@ -3345,9 +3265,6 @@ ephy_window_set_property (GObject *object,
switch (prop_id)
{
- case PROP_PPV_MODE:
- /* Read only */
- break;
case PROP_ACTIVE_CHILD:
impl_set_active_child (EPHY_EMBED_CONTAINER (window),
g_value_get_object (value));
@@ -3380,9 +3297,6 @@ ephy_window_get_property (GObject *object,
case PROP_CHROME:
g_value_set_flags (value, window->priv->chrome);
break;
- case PROP_PPV_MODE:
- g_value_set_boolean (value, window->priv->ppv_mode);
- break;
case PROP_SINGLE_TAB_MODE:
g_value_set_boolean (value, window->priv->is_popup);
break;
@@ -3503,10 +3417,6 @@ ephy_window_class_init (EphyWindowClass *klass)
"is-popup");
g_object_class_override_property (object_class,
- PROP_PPV_MODE,
- "is-print-preview");
-
- g_object_class_override_property (object_class,
PROP_CHROME,
"chrome");
@@ -3565,9 +3475,6 @@ ephy_window_open_link (EphyLink *link,
g_return_val_if_fail (address != NULL, NULL);
- /* don't do anything in ppv mode */
- if (window->priv->ppv_mode) return NULL;
-
if (embed == NULL)
{
embed = window->priv->active_embed;
@@ -4184,22 +4091,6 @@ ephy_window_view_popup_windows_cb (GtkAction *action,
}
/**
- * ephy_window_get_is_print_preview:
- * @window: an #EphyWindow
- *
- * Returns whether this window is in print preview mode.
- *
- * Return value: %TRUE if it is in print preview mode
- **/
-gboolean
-ephy_window_get_is_print_preview (EphyWindow *window)
-{
- g_return_val_if_fail (EPHY_IS_WINDOW (window), FALSE);
-
- return window->priv->ppv_mode;
-}
-
-/**
* ephy_window_get_context_event:
* @window: an #EphyWindow
*
diff --git a/src/ephy-window.h b/src/ephy-window.h
index e40c8dbf8..ab0e35b29 100644
--- a/src/ephy-window.h
+++ b/src/ephy-window.h
@@ -63,9 +63,6 @@ EphyWindow *ephy_window_new (void);
EphyWindow *ephy_window_new_with_chrome (EphyWebViewChrome chrome,
gboolean is_popup);
-void _ephy_window_set_print_preview (EphyWindow *window,
- gboolean enabled);
-
GObject *ephy_window_get_ui_manager (EphyWindow *window);
GtkWidget *ephy_window_get_toolbar (EphyWindow *window);
@@ -84,7 +81,6 @@ void ephy_window_set_zoom (EphyWindow *window,
void ephy_window_activate_location (EphyWindow *window);
-gboolean ephy_window_get_is_print_preview(EphyWindow *window);
EphyEmbedEvent *ephy_window_get_context_event (EphyWindow *window);
diff --git a/src/ppview-toolbar.c b/src/ppview-toolbar.c
deleted file mode 100644
index db27d42ed..000000000
--- a/src/ppview-toolbar.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright © 2002 Marco Pesenti Gritti
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-
-#include "ppview-toolbar.h"
-#include "ephy-embed-container.h"
-#include "ephy-embed-utils.h"
-#include "ephy-window.h"
-
-#include <string.h>
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-
-static void ppview_toolbar_class_init (PPViewToolbarClass *klass);
-static void ppview_toolbar_init (PPViewToolbar *t);
-static void ppview_toolbar_finalize (GObject *object);
-static void ppview_toolbar_set_window (PPViewToolbar *t, EphyWindow *window);
-static void
-ppview_toolbar_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void
-ppview_toolbar_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-enum
-{
- PROP_0,
- PROP_WINDOW
-};
-
-#define EPHY_PPVIEW_TOOLBAR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_PPVIEW_TOOLBAR, PPViewToolbarPrivate))
-
-struct PPViewToolbarPrivate
-{
- EphyWindow *window;
- GtkUIManager *manager;
- GtkActionGroup *action_group;
- guint ui_id;
- int current_page;
-};
-
-static void
-toolbar_cmd_ppv_goto_first (GtkUIManager *merge,
- PPViewToolbar *t);
-
-static void
-toolbar_cmd_ppv_goto_last (GtkUIManager *merge,
- PPViewToolbar *t);
-
-static void
-toolbar_cmd_ppv_go_back (GtkUIManager *merge,
- PPViewToolbar *t);
-
-static void
-toolbar_cmd_ppv_go_forward (GtkUIManager *merge,
- PPViewToolbar *t);
-
-static void
-toolbar_cmd_ppv_close (GtkUIManager *merge,
- PPViewToolbar *t);
-
-static const GtkActionEntry entries [] = {
- { "PPVGotoFirst", GTK_STOCK_GOTO_FIRST,
- N_("First"), NULL,
- N_("Go to the first page"),
- (GCallback)toolbar_cmd_ppv_goto_first },
- { "PPVGotoLast", GTK_STOCK_GOTO_LAST,
- N_("Last"), NULL,
- N_("Go to the last page"),
- (GCallback)toolbar_cmd_ppv_goto_last },
- { "PPVGoBack", GTK_STOCK_GO_BACK,
- N_("Previous"), NULL,
- N_("Go to the previous page"),
- (GCallback)toolbar_cmd_ppv_go_back },
- { "PPVGoForward", GTK_STOCK_GO_FORWARD,
- N_("Next"), NULL,
- N_("Go to next page"),
- (GCallback)toolbar_cmd_ppv_go_forward },
- { "PPVClose", GTK_STOCK_CLOSE,
- N_("Close"), NULL,
- N_("Close print preview"),
- (GCallback)toolbar_cmd_ppv_close },
-};
-
-static const char ui_info[] =
-"<ui>"
-"<toolbar name=\"PPViewToolbar\">"
-"<toolitem name=\"PPVGotoFirstItem\" action=\"PPVGotoFirst\" />"
-"<toolitem name=\"PPVGotoLastItem\" action=\"PPVGotoLast\" />"
-"<toolitem name=\"PPVGoBackItem\" action=\"PPVGoBack\" />"
-"<toolitem name=\"PPVGoForwardItem\" action=\"PPVGoForward\" />"
-"<toolitem name=\"PPVCloseItem\" action=\"PPVClose\" />"
-"</toolbar>"
-"</ui>\n";
-
-G_DEFINE_TYPE (PPViewToolbar, ppview_toolbar, G_TYPE_OBJECT)
-
-static void
-ppview_toolbar_class_init (PPViewToolbarClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = ppview_toolbar_finalize;
-
- object_class->set_property = ppview_toolbar_set_property;
- object_class->get_property = ppview_toolbar_get_property;
-
- g_object_class_install_property (object_class,
- PROP_WINDOW,
- g_param_spec_object ("window",
- "Window",
- "Window",
- EPHY_TYPE_WINDOW,
- G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB |
- G_PARAM_CONSTRUCT_ONLY));
-
- g_type_class_add_private (object_class, sizeof (PPViewToolbarPrivate));
-}
-
-static void
-ppview_toolbar_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- PPViewToolbar *t = EPHY_PPVIEW_TOOLBAR (object);
-
- switch (prop_id)
- {
- case PROP_WINDOW:
- ppview_toolbar_set_window (t, g_value_get_object (value));
- break;
- }
-}
-
-static void
-ppview_toolbar_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- /* no readable properties */
- g_return_if_reached ();
-}
-
-static void
-toolbar_update_sensitivity (PPViewToolbar *t)
-{
- int pages, c_page;
- EphyWindow *window = t->priv->window;
- EphyEmbed *embed;
- GtkAction *action;
- GtkActionGroup *action_group = t->priv->action_group;
-
- embed = ephy_embed_container_get_active_child
- (EPHY_EMBED_CONTAINER (window));
- g_return_if_fail (embed != NULL);
-
- pages = ephy_web_view_print_preview_n_pages (ephy_embed_get_web_view (embed));
- c_page = t->priv->current_page;
-
- action = gtk_action_group_get_action (action_group, "PPVGoBack");
- gtk_action_set_sensitive (action, c_page > 1);
- action = gtk_action_group_get_action (action_group, "PPVGotoFirst");
- gtk_action_set_sensitive (action, c_page > 1);
- action = gtk_action_group_get_action (action_group, "PPVGoForward");
- gtk_action_set_sensitive (action, c_page < pages);
- action = gtk_action_group_get_action (action_group, "PPVGotoLast");
- gtk_action_set_sensitive (action, c_page < pages);
-}
-
-static void
-ppview_toolbar_set_window (PPViewToolbar *t, EphyWindow *window)
-{
- GtkAction *action;
- GtkWidget *widget;
- GtkToolbarStyle style;
-
- g_return_if_fail (t->priv->window == NULL);
-
- t->priv->window = window;
- t->priv->manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (t->priv->window));
-
- t->priv->action_group = gtk_action_group_new ("PPViewActions");
- gtk_action_group_set_translation_domain (t->priv->action_group, NULL);
- gtk_action_group_add_actions (t->priv->action_group, entries,
- G_N_ELEMENTS (entries), t);
- gtk_ui_manager_insert_action_group (t->priv->manager,
- t->priv->action_group, 0);
- t->priv->ui_id = gtk_ui_manager_add_ui_from_string
- (t->priv->manager, ui_info, -1, NULL);
-
- action = gtk_action_group_get_action (t->priv->action_group,
- "PPVClose");
- g_object_set (action,
- "short-label",
- _("Close print preview"),
- "is-important",
- TRUE,
- NULL);
-
- /* Force the display of the text only when needed */
- widget = gtk_ui_manager_get_widget (t->priv->manager,
- "/PPViewToolbar");
- style = gtk_toolbar_get_style (GTK_TOOLBAR (widget));
- if (style == GTK_TOOLBAR_ICONS)
- {
- gtk_toolbar_set_style (GTK_TOOLBAR (widget),
- GTK_TOOLBAR_BOTH_HORIZ);
- }
-
- toolbar_update_sensitivity (t);
-}
-
-static void
-ppview_toolbar_init (PPViewToolbar *t)
-{
- t->priv = EPHY_PPVIEW_TOOLBAR_GET_PRIVATE (t);
-
- t->priv->current_page = 1;
-}
-
-static void
-ppview_toolbar_finalize (GObject *object)
-{
- PPViewToolbar *t = EPHY_PPVIEW_TOOLBAR (object);
-
- gtk_ui_manager_remove_ui (t->priv->manager, t->priv->ui_id);
- gtk_ui_manager_remove_action_group (t->priv->manager,
- t->priv->action_group);
- g_object_unref (t->priv->action_group);
-
- G_OBJECT_CLASS (ppview_toolbar_parent_class)->finalize (object);
-}
-
-PPViewToolbar *
-ppview_toolbar_new (EphyWindow *window)
-{
- return g_object_new (EPHY_TYPE_PPVIEW_TOOLBAR,
- "window", window,
- NULL);
-}
-
-static void
-toolbar_cmd_ppv_goto_first (GtkUIManager *merge,
- PPViewToolbar *t)
-{
- EphyWindow *window = t->priv->window;
- EphyEmbed *embed;
-
- embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
- g_return_if_fail (EPHY_IS_EMBED (embed));
-
- ephy_web_view_print_preview_navigate (ephy_embed_get_web_view (embed), EPHY_WEB_VIEW_PRINTPREVIEW_HOME, 0);
-
- t->priv->current_page = 1;
-
- toolbar_update_sensitivity (t);
-}
-
-static void
-toolbar_cmd_ppv_goto_last (GtkUIManager *merge,
- PPViewToolbar *t)
-{
- EphyWindow *window = t->priv->window;
- EphyEmbed *embed;
-
- embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
- g_return_if_fail (embed != NULL);
-
- ephy_web_view_print_preview_navigate (ephy_embed_get_web_view (embed),
- EPHY_WEB_VIEW_PRINTPREVIEW_END,
- 0);
-
- t->priv->current_page = ephy_web_view_print_preview_n_pages (ephy_embed_get_web_view (embed));
-
- toolbar_update_sensitivity (t);
-}
-
-static int
-clamp_page_limits (PPViewToolbar *t, int page)
-{
- EphyWindow *window = t->priv->window;
- EphyEmbed *embed;
- int pages;
-
- embed = ephy_embed_container_get_active_child
- (EPHY_EMBED_CONTAINER (window));
- g_return_val_if_fail (embed != NULL, -1);
-
- pages = ephy_web_view_print_preview_n_pages (ephy_embed_get_web_view (embed));
-
- return CLAMP (page, 1, pages);
-}
-
-static void
-toolbar_cmd_ppv_go_back (GtkUIManager *merge,
- PPViewToolbar *t)
-{
- EphyEmbedContainer *window = EPHY_EMBED_CONTAINER (t->priv->window);
- EphyEmbed *embed;
-
- embed = ephy_embed_container_get_active_child (window);
- g_return_if_fail (EPHY_IS_EMBED (embed));
-
- t->priv->current_page = clamp_page_limits (t, t->priv->current_page - 1);
-
- ephy_web_view_print_preview_navigate (ephy_embed_get_web_view (embed),
- EPHY_WEB_VIEW_PRINTPREVIEW_GOTO_PAGENUM,
- t->priv->current_page);
-
- toolbar_update_sensitivity (t);
-}
-
-static void
-toolbar_cmd_ppv_go_forward (GtkUIManager *merge,
- PPViewToolbar *t)
-{
- EphyWindow *window = t->priv->window;
- EphyEmbed *embed;
-
- embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
- g_return_if_fail (EPHY_IS_EMBED (embed));
-
- t->priv->current_page = clamp_page_limits (t, t->priv->current_page + 1);
-
- ephy_web_view_print_preview_navigate (ephy_embed_get_web_view (embed),
- EPHY_WEB_VIEW_PRINTPREVIEW_GOTO_PAGENUM,
- t->priv->current_page);
-
- toolbar_update_sensitivity (t);
-}
-
-static void
-toolbar_cmd_ppv_close (GtkUIManager *merge,
- PPViewToolbar *t)
-{
- EphyWindow *window;
- EphyEmbed *embed;
-
- g_return_if_fail (EPHY_IS_PPVIEW_TOOLBAR (t));
-
- window = t->priv->window;
- g_return_if_fail (EPHY_IS_WINDOW (window));
-
- embed = ephy_embed_container_get_active_child
- (EPHY_EMBED_CONTAINER (window));
- g_return_if_fail (EPHY_IS_EMBED (embed));
-
- _ephy_window_set_print_preview (window, FALSE);
-
- ephy_web_view_set_print_preview_mode (ephy_embed_get_web_view (embed), FALSE);
-}
diff --git a/src/ppview-toolbar.h b/src/ppview-toolbar.h
deleted file mode 100644
index 97b0bf7e8..000000000
--- a/src/ppview-toolbar.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright © 2002 Jorn Baayen
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PPVIEW_TOOLBAR_H
-#define PPVIEW_TOOLBAR_H
-
-#include "ephy-window.h"
-#include <glib-object.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define EPHY_TYPE_PPVIEW_TOOLBAR (ppview_toolbar_get_type ())
-#define EPHY_PPVIEW_TOOLBAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EPHY_TYPE_PPVIEW_TOOLBAR, PPViewToolbar))
-#define EPHY_PPVIEW_TOOLBAR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EPHY_TYPE_PPVIEW_TOOLBAR, PPViewToolbarClass))
-#define EPHY_IS_PPVIEW_TOOLBAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EPHY_TYPE_PPVIEW_TOOLBAR))
-#define EPHY_IS_PPVIEW_TOOLBAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_PPVIEW_TOOLBAR))
-#define EPHY_PPVIEW_TOOLBAR_GET_CLASS(o)(G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_PPVIEW_TOOLBAR, PPViewToolbarClass))
-
-typedef struct PPViewToolbar PPViewToolbar;
-typedef struct PPViewToolbarClass PPViewToolbarClass;
-typedef struct PPViewToolbarPrivate PPViewToolbarPrivate;
-
-struct PPViewToolbar
-{
- GObject parent;
-
- /*< private >*/
- PPViewToolbarPrivate *priv;
-};
-
-struct PPViewToolbarClass
-{
- GObjectClass parent_class;
-};
-
-GType ppview_toolbar_get_type (void);
-
-PPViewToolbar *ppview_toolbar_new (EphyWindow *window);
-
-G_END_DECLS
-
-#endif
diff --git a/src/window-commands.c b/src/window-commands.c
index bcd1c902c..2615d7819 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -89,13 +89,12 @@ window_cmd_file_print_preview (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));
-
- ephy_web_view_set_print_preview_mode (ephy_embed_get_web_view (embed), TRUE);
- _ephy_window_set_print_preview (window, TRUE);
+ (EPHY_EMBED_CONTAINER (window));
+ view = ephy_embed_get_web_view (embed);
+ ephy_web_view_show_print_preview (view);
}
void