aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lahey <clahey@ximian.com>2003-11-30 19:38:12 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-11-30 19:38:12 +0800
commit3ee87498b5087ca1e7bd78142ee6c5539673b09f (patch)
tree97a99ba23db0a53c41d19154eb15956b17b9f6f2
parentf84a5ff4e920c25d089786864f1ae2cdd94586d6 (diff)
downloadgsoc2013-epiphany-3ee87498b5087ca1e7bd78142ee6c5539673b09f.tar
gsoc2013-epiphany-3ee87498b5087ca1e7bd78142ee6c5539673b09f.tar.gz
gsoc2013-epiphany-3ee87498b5087ca1e7bd78142ee6c5539673b09f.tar.bz2
gsoc2013-epiphany-3ee87498b5087ca1e7bd78142ee6c5539673b09f.tar.lz
gsoc2013-epiphany-3ee87498b5087ca1e7bd78142ee6c5539673b09f.tar.xz
gsoc2013-epiphany-3ee87498b5087ca1e7bd78142ee6c5539673b09f.tar.zst
gsoc2013-epiphany-3ee87498b5087ca1e7bd78142ee6c5539673b09f.zip
Marco Pesenti Gritti <marco@gnome.org>
2003-11-30 Chris Lahey <clahey@ximian.com> Marco Pesenti Gritti <marco@gnome.org> * data/Makefile.am: * data/epiphany-lockdown.schemas.in: * src/ephy-main.c: (main): * src/ephy-tab.c: (ephy_tab_new_window_cb), (ephy_tab_size_to_cb): * src/ephy-window.c: (update_chromes_visibility), (update_chrome), (ephy_window_fullscreen), (ephy_window_unfullscreen), (show_embed_popup), (update_layout_toggles), (chrome_notifier), (ephy_window_init), (ephy_window_finalize), (ephy_window_request_chrome), (ephy_window_set_print_preview), (ephy_window_show), (print_dialog_preview_cb): * src/ephy-window.h: * src/ppview-toolbar.c: (ppview_toolbar_set_window), (toolbar_cmd_ppv_close): * src/window-commands.c: (window_cmd_view_bookmarks_bar), (window_cmd_view_toolbar), (window_cmd_view_statusbar): Implement lockdown pref to not allow javascript to modify chromes. Do necessary changes to chromes code to make it possible.
-rw-r--r--ChangeLog23
-rw-r--r--data/Makefile.am4
-rw-r--r--data/epiphany-lockdown.schemas.in26
-rw-r--r--src/ephy-main.c2
-rw-r--r--src/ephy-tab.c4
-rw-r--r--src/ephy-window.c243
-rw-r--r--src/ephy-window.h5
-rwxr-xr-xsrc/ppview-toolbar.c11
-rw-r--r--src/window-commands.c33
9 files changed, 205 insertions, 146 deletions
diff --git a/ChangeLog b/ChangeLog
index 8147ef5b5..9718812b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2003-11-30 Chris Lahey <clahey@ximian.com>
+ Marco Pesenti Gritti <marco@gnome.org>
+
+ * data/Makefile.am:
+ * data/epiphany-lockdown.schemas.in:
+ * src/ephy-main.c: (main):
+ * src/ephy-tab.c: (ephy_tab_new_window_cb), (ephy_tab_size_to_cb):
+ * src/ephy-window.c: (update_chromes_visibility), (update_chrome),
+ (ephy_window_fullscreen), (ephy_window_unfullscreen),
+ (show_embed_popup), (update_layout_toggles), (chrome_notifier),
+ (ephy_window_init), (ephy_window_finalize),
+ (ephy_window_request_chrome), (ephy_window_set_print_preview),
+ (ephy_window_show), (print_dialog_preview_cb):
+ * src/ephy-window.h:
+ * src/ppview-toolbar.c: (ppview_toolbar_set_window),
+ (toolbar_cmd_ppv_close):
+ * src/window-commands.c: (window_cmd_view_bookmarks_bar),
+ (window_cmd_view_toolbar), (window_cmd_view_statusbar):
+
+ Implement lockdown pref to not allow javascript to modify
+ chromes. Do necessary changes to chromes code to make
+ it possible.
+
2003-11-28 Marco Pesenti Gritti <marco@gnome.org>
* embed/downloader-view.c: (status_icon_activated),
diff --git a/data/Makefile.am b/data/Makefile.am
index 2f18dac23..999810340 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -28,8 +28,8 @@ applicationsdir = $(datadir)/application-registry
applications_DATA = epiphany.applications
schemadir = $(sysconfdir)/gconf/schemas
-schema_in_files = epiphany.schemas.in
-schema_DATA = epiphany.schemas
+schema_in_files = epiphany.schemas.in epiphany-lockdown.schemas.in
+schema_DATA = epiphany.schemas epiphany-lockdown.schemas
aboutdir = $(pkgdatadir)
about_DATA = epiphany.xhtml conspiracy.xhtml
diff --git a/data/epiphany-lockdown.schemas.in b/data/epiphany-lockdown.schemas.in
new file mode 100644
index 000000000..7cdbb4ea8
--- /dev/null
+++ b/data/epiphany-lockdown.schemas.in
@@ -0,0 +1,26 @@
+<gconfschemafile>
+ <schemalist>
+ <schema>
+ <key>/schemas/apps/epiphany/lockdown/disable_javascript_chrome</key>
+ <applyto>/apps/epiphany/lockdown/disable_javascript_chrome</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Disable JavaScript chrome control</short>
+ <long>Disable JavaScript's control over window chrome.</long>
+ </locale>
+ </schema>
+ <schema>
+ <key>/schemas/apps/epiphany/lockdown/hide_menubar</key>
+ <applyto>/apps/epiphany/lockdown/hide_menubar</applyto>
+ <owner>epiphany</owner>
+ <type>bool</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Hide menubar by default</short>
+ <long>Hide the menubar by default.</long>
+ </locale>
+ </schema>
+ </schemalist>
+</gconfschemafile>
diff --git a/src/ephy-main.c b/src/ephy-main.c
index b7d29b4af..276b39734 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -157,6 +157,7 @@ main (int argc, char *argv[])
ephy_file_helpers_init ();
ephy_stock_icons_init ();
eel_gconf_monitor_add ("/apps/epiphany/general");
+ eel_gconf_monitor_add ("/apps/epiphany/lockdown");
bonobo_activate ();
ephy_shell = ephy_shell_new ();
@@ -182,6 +183,7 @@ main (int argc, char *argv[])
}
eel_gconf_monitor_remove ("/apps/epiphany/general");
+ eel_gconf_monitor_remove ("/apps/epiphany/lockdown");
ephy_state_save ();
ephy_file_helpers_shutdown ();
gnome_vfs_shutdown ();
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index def1e741b..960090bd8 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -870,7 +870,7 @@ ephy_tab_new_window_cb (EphyEmbed *embed, EphyEmbed **new_embed,
EphyWindow *window;
window = ephy_window_new ();
- ephy_window_set_chrome (window, chromemask);
+ ephy_window_request_chrome (window, chromemask);
new_tab = ephy_tab_new ();
ephy_window_add_tab (window, new_tab, EPHY_NOTEBOOK_INSERT_GROUPED, FALSE);
@@ -928,7 +928,6 @@ ephy_tab_size_to_cb (EphyEmbed *embed, gint width, gint height,
GtkWidget *notebook;
EphyWindow *window;
GtkWidget *widget;
- EmbedChromeMask chromemask;
tab->priv->width = width;
tab->priv->height = height;
@@ -936,7 +935,6 @@ ephy_tab_size_to_cb (EphyEmbed *embed, gint width, gint height,
window = tab->priv->window;
notebook = ephy_window_get_notebook (window);
widget = GTK_WIDGET (embed);
- chromemask = ephy_window_get_chrome (window);
/* Do not resize window with multiple tabs.
* Do not resize window already showed because
diff --git a/src/ephy-window.c b/src/ephy-window.c
index a74598f8d..7d02e98af 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2000, 2001, 2002, 2003 Marco Pesenti Gritti
*
@@ -286,6 +287,9 @@ static GtkActionEntry ephy_popups_entries [] = {
};
static guint ephy_popups_n_entries = G_N_ELEMENTS (ephy_popups_entries);
+#define CONF_LOCKDOWN_DISABLE_JAVASCRIPT_CHROME "/apps/epiphany/lockdown/disable_javascript_chrome"
+#define CONF_LOCKDOWN_HIDE_MENUBAR "/apps/epiphany/lockdown/hide_menubar"
+
#define EPHY_WINDOW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_WINDOW, EphyWindowPrivate))
struct EphyWindowPrivate
@@ -306,11 +310,19 @@ struct EphyWindowPrivate
EphyTab *active_tab;
EphyDialog *find_dialog;
EphyDialog *print_dialog;
- EmbedChromeMask chrome_mask;
+ EmbedChromeMask requested_chrome_mask;
+ EmbedChromeMask actual_chrome_mask;
gboolean closing;
gboolean is_fullscreen;
+ gboolean is_ppview;
gboolean has_size;
guint num_tabs;
+
+ guint disable_js_chrome_notifier_id;
+ guint show_toolbars_notifier_id;
+ guint show_bookmarks_bar_notifier_id;
+ guint show_statusbar_notifier_id;
+ guint hide_menubar_notifier_id;
};
enum
@@ -429,10 +441,11 @@ exit_fullscreen_button_clicked_cb (GtkWidget *button, EphyWindow *window)
}
static void
-update_chromes_visibility (EphyWindow *window, EmbedChromeMask flags)
+update_chromes_visibility (EphyWindow *window)
{
GtkWidget *menubar;
gboolean fullscreen;
+ EmbedChromeMask flags = window->priv->actual_chrome_mask;
fullscreen = window->priv->is_fullscreen;
@@ -481,6 +494,60 @@ update_chromes_visibility (EphyWindow *window, EmbedChromeMask flags)
}
static void
+update_chrome(EphyWindow *window)
+{
+ EmbedChromeMask chrome_mask;
+
+ if (window->priv->is_ppview)
+ {
+ window->priv->actual_chrome_mask = EMBED_CHROME_PPVIEWTOOLBARON;
+ }
+ else
+ {
+ if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_JAVASCRIPT_CHROME))
+ {
+ chrome_mask = EMBED_CHROME_DEFAULT;
+ }
+ else
+ {
+ chrome_mask = window->priv->requested_chrome_mask;
+ }
+
+ if ((chrome_mask & EMBED_CHROME_BOOKMARKSBAR_DEFAULT) ||
+ (chrome_mask & EMBED_CHROME_DEFAULT))
+ {
+ /* keep only not layout flags */
+ chrome_mask &= (EMBED_CHROME_WINDOWRAISED |
+ EMBED_CHROME_WINDOWLOWERED |
+ EMBED_CHROME_CENTERSCREEN |
+ EMBED_CHROME_OPENASDIALOG |
+ EMBED_CHROME_OPENASPOPUP);
+
+ /* Load defaults */
+ if (eel_gconf_get_boolean (CONF_WINDOWS_SHOW_TOOLBARS))
+ {
+ chrome_mask |= EMBED_CHROME_TOOLBARON;
+ }
+ if (eel_gconf_get_boolean (CONF_WINDOWS_SHOW_BOOKMARKS_BAR))
+ {
+ chrome_mask |= EMBED_CHROME_BOOKMARKSBARON;
+ }
+ if (eel_gconf_get_boolean (CONF_WINDOWS_SHOW_STATUSBAR))
+ {
+ chrome_mask |= EMBED_CHROME_STATUSBARON;
+ }
+ if (!eel_gconf_get_boolean (CONF_LOCKDOWN_HIDE_MENUBAR))
+ {
+ chrome_mask |= EMBED_CHROME_MENUBARON;
+ }
+ }
+ window->priv->actual_chrome_mask = chrome_mask;
+ }
+
+ update_chromes_visibility (window);
+}
+
+static void
ephy_window_fullscreen (EphyWindow *window)
{
GtkWidget *popup, *button, *icon, *label, *hbox;
@@ -517,7 +584,7 @@ ephy_window_fullscreen (EphyWindow *window)
"size-changed", G_CALLBACK (size_changed_cb),
popup);
- update_chromes_visibility (window, window->priv->chrome_mask);
+ update_chromes_visibility (window);
}
static void
@@ -532,7 +599,7 @@ ephy_window_unfullscreen (EphyWindow *window)
gtk_widget_destroy (window->priv->exit_fullscreen_popup);
window->priv->exit_fullscreen_popup = NULL;
- update_chromes_visibility (window, window->priv->chrome_mask);
+ update_chromes_visibility (window);
}
static gboolean
@@ -1058,7 +1125,7 @@ show_embed_popup (EphyWindow *window, EphyTab *tab, EphyEmbedEvent *event)
EphyEmbedEventType type;
/* Do not show the menu in print preview mode */
- if (window->priv->chrome_mask & EMBED_CHROME_PPVIEWTOOLBARON)
+ if (window->priv->is_ppview)
{
return;
}
@@ -1482,6 +1549,35 @@ ensure_default_icon (void)
}
static void
+update_layout_toggles (EphyWindow *window)
+{
+ GtkActionGroup *action_group = GTK_ACTION_GROUP (window->priv->action_group);
+ GtkAction *action;
+
+ action = gtk_action_group_get_action (action_group, "ViewToolbar");
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ eel_gconf_get_boolean (CONF_WINDOWS_SHOW_TOOLBARS));
+
+ action = gtk_action_group_get_action (action_group, "ViewBookmarksBar");
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ eel_gconf_get_boolean (CONF_WINDOWS_SHOW_BOOKMARKS_BAR));
+
+ action = gtk_action_group_get_action (action_group, "ViewStatusbar");
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ eel_gconf_get_boolean (CONF_WINDOWS_SHOW_STATUSBAR));
+}
+
+static void
+chrome_notifier (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ EphyWindow *window)
+{
+ update_chrome (window);
+ update_layout_toggles(window);
+}
+
+static void
ephy_window_init (EphyWindow *window)
{
EphyExtension *manager;
@@ -1491,12 +1587,14 @@ ephy_window_init (EphyWindow *window)
window->priv = EPHY_WINDOW_GET_PRIVATE (window);
window->priv->active_tab = NULL;
- window->priv->chrome_mask = 0;
+ window->priv->requested_chrome_mask = EMBED_CHROME_DEFAULT;
+ window->priv->actual_chrome_mask = 0;
window->priv->closing = FALSE;
window->priv->ppview_toolbar = NULL;
window->priv->exit_fullscreen_popup = NULL;
window->priv->num_tabs = 0;
window->priv->is_fullscreen = FALSE;
+ window->priv->is_ppview = FALSE;
window->priv->has_size = FALSE;
ensure_default_icon ();
@@ -1524,33 +1622,42 @@ ephy_window_init (EphyWindow *window)
window->priv->enc_menu = ephy_encoding_menu_new (window);
window->priv->bmk_menu = ephy_bookmarks_menu_new (window);
+ window->priv->disable_js_chrome_notifier_id = eel_gconf_notification_add
+ (CONF_LOCKDOWN_DISABLE_JAVASCRIPT_CHROME,
+ (GConfClientNotifyFunc)chrome_notifier, window);
+
+ window->priv->show_toolbars_notifier_id = eel_gconf_notification_add
+ (CONF_WINDOWS_SHOW_TOOLBARS,
+ (GConfClientNotifyFunc)chrome_notifier, window);
+
+ window->priv->show_bookmarks_bar_notifier_id = eel_gconf_notification_add
+ (CONF_WINDOWS_SHOW_BOOKMARKS_BAR,
+ (GConfClientNotifyFunc)chrome_notifier, window);
+
+ window->priv->show_statusbar_notifier_id = eel_gconf_notification_add
+ (CONF_WINDOWS_SHOW_STATUSBAR,
+ (GConfClientNotifyFunc)chrome_notifier, window);
+
+ window->priv->hide_menubar_notifier_id = eel_gconf_notification_add
+ (CONF_LOCKDOWN_HIDE_MENUBAR,
+ (GConfClientNotifyFunc)chrome_notifier, window);
+
/* Once the window is fully created let the extensions attach to it */
manager = EPHY_EXTENSION (ephy_shell_get_extensions_manager (ephy_shell));
ephy_extension_attach_window (manager, window);
}
static void
-save_window_chrome (EphyWindow *window)
-{
- EmbedChromeMask flags = window->priv->chrome_mask;
-
- if (!(flags & EMBED_CHROME_OPENASPOPUP) &&
- !(flags & EMBED_CHROME_PPVIEWTOOLBARON))
- {
- eel_gconf_set_boolean (CONF_WINDOWS_SHOW_BOOKMARKS_BAR,
- flags & EMBED_CHROME_BOOKMARKSBARON);
- eel_gconf_set_boolean (CONF_WINDOWS_SHOW_TOOLBARS,
- flags & EMBED_CHROME_TOOLBARON);
- eel_gconf_set_boolean (CONF_WINDOWS_SHOW_STATUSBAR,
- flags & EMBED_CHROME_STATUSBARON);
- }
-}
-
-static void
ephy_window_finalize (GObject *object)
{
EphyWindow *window = EPHY_WINDOW (object);
+ eel_gconf_notification_remove (window->priv->disable_js_chrome_notifier_id);
+ eel_gconf_notification_remove (window->priv->show_toolbars_notifier_id);
+ eel_gconf_notification_remove (window->priv->show_bookmarks_bar_notifier_id);
+ eel_gconf_notification_remove (window->priv->show_statusbar_notifier_id);
+ eel_gconf_notification_remove (window->priv->hide_menubar_notifier_id);
+
if (window->priv->find_dialog)
{
g_object_unref (G_OBJECT (window->priv->find_dialog));
@@ -1587,81 +1694,20 @@ ephy_window_new (void)
return EPHY_WINDOW (g_object_new (EPHY_TYPE_WINDOW, NULL));
}
-EmbedChromeMask
-ephy_window_get_chrome (EphyWindow *window)
-{
- return window->priv->chrome_mask;
-}
-
-static void
-translate_default_chrome (EmbedChromeMask *chrome_mask)
-{
- gboolean bbar;
-
- bbar = (*chrome_mask & EMBED_CHROME_BOOKMARKSBAR_DEFAULT) ||
- (*chrome_mask & EMBED_CHROME_DEFAULT);
-
- /* keep only not layout flags */
- *chrome_mask &= (EMBED_CHROME_WINDOWRAISED |
- EMBED_CHROME_WINDOWLOWERED |
- EMBED_CHROME_CENTERSCREEN |
- EMBED_CHROME_OPENASDIALOG |
- EMBED_CHROME_OPENASPOPUP);
-
- /* Load defaults */
- if (eel_gconf_get_boolean (CONF_WINDOWS_SHOW_STATUSBAR))
- {
- *chrome_mask |= EMBED_CHROME_STATUSBARON;
- }
- if (eel_gconf_get_boolean (CONF_WINDOWS_SHOW_TOOLBARS))
- {
- *chrome_mask |= EMBED_CHROME_TOOLBARON;
- }
- if (eel_gconf_get_boolean (CONF_WINDOWS_SHOW_BOOKMARKS_BAR) && bbar)
- {
- *chrome_mask |= EMBED_CHROME_BOOKMARKSBARON;
- }
-
- *chrome_mask |= EMBED_CHROME_MENUBARON;
-}
-
-static void
-update_layout_toggles (EphyWindow *window)
+void
+ephy_window_request_chrome (EphyWindow *window,
+ EmbedChromeMask flags)
{
- GtkActionGroup *action_group = GTK_ACTION_GROUP (window->priv->action_group);
- EmbedChromeMask mask = window->priv->chrome_mask;
- GtkAction *action;
-
- action = gtk_action_group_get_action (action_group, "ViewToolbar");
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
- mask & EMBED_CHROME_TOOLBARON);
-
- action = gtk_action_group_get_action (action_group, "ViewBookmarksBar");
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
- mask & EMBED_CHROME_BOOKMARKSBARON);
-
- action = gtk_action_group_get_action (action_group, "ViewStatusbar");
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
- mask & EMBED_CHROME_STATUSBARON);
+ window->priv->requested_chrome_mask = flags;
+ update_chrome (window);
}
void
-ephy_window_set_chrome (EphyWindow *window,
- EmbedChromeMask flags)
+ephy_window_set_print_preview (EphyWindow *window, gboolean enabled)
{
- if ((flags & EMBED_CHROME_DEFAULT) ||
- (flags & EMBED_CHROME_BOOKMARKSBAR_DEFAULT))
- {
- translate_default_chrome (&flags);
- }
-
- update_chromes_visibility (window, flags);
-
- window->priv->chrome_mask = flags;
-
- update_layout_toggles (window);
-
- save_window_chrome (window);
+ window->priv->is_ppview = enabled;
+ update_chrome (window);
+ ephy_notebook_set_show_tabs (EPHY_NOTEBOOK (window->priv->notebook), enabled);
}
GtkWidget *
@@ -1774,17 +1820,15 @@ ephy_window_show (GtkWidget *widget)
{
EphyWindow *window = EPHY_WINDOW(widget);
- if (!window->priv->chrome_mask)
- {
- ephy_window_set_chrome (window, EMBED_CHROME_DEFAULT);
- }
+ update_chrome (window);
+ update_layout_toggles(window);
if (!window->priv->has_size)
{
gboolean keep_state = TRUE;
/* Do not keep state of sized popups */
- if (window->priv->chrome_mask & EMBED_CHROME_OPENASPOPUP)
+ if (window->priv->actual_chrome_mask & EMBED_CHROME_OPENASPOPUP)
{
EphyTab *tab;
int width, height;
@@ -1931,7 +1975,8 @@ static void
print_dialog_preview_cb (EphyDialog *dialog,
EphyWindow *window)
{
- ephy_window_set_chrome (window, EMBED_CHROME_PPVIEWTOOLBARON);
+ window->priv->is_ppview = TRUE;
+ update_chrome(window);
ephy_notebook_set_show_tabs (EPHY_NOTEBOOK (window->priv->notebook), FALSE);
}
diff --git a/src/ephy-window.h b/src/ephy-window.h
index 5865bbdd0..40a728fc4 100644
--- a/src/ephy-window.h
+++ b/src/ephy-window.h
@@ -70,10 +70,11 @@ GType ephy_window_get_type (void);
EphyWindow *ephy_window_new (void);
-void ephy_window_set_chrome (EphyWindow *window,
+void ephy_window_request_chrome (EphyWindow *window,
EmbedChromeMask chrome_flags);
-EmbedChromeMask ephy_window_get_chrome (EphyWindow *window);
+void ephy_window_set_print_preview (EphyWindow *window,
+ gboolean enabled);
GtkWidget *ephy_window_get_notebook (EphyWindow *window);
diff --git a/src/ppview-toolbar.c b/src/ppview-toolbar.c
index 8215f6b2f..bdf70f322 100755
--- a/src/ppview-toolbar.c
+++ b/src/ppview-toolbar.c
@@ -61,7 +61,6 @@ static GObjectClass *parent_class = NULL;
struct PPViewToolbarPrivate
{
EphyWindow *window;
- EmbedChromeMask original_mask;
GtkUIManager *ui_merge;
GtkActionGroup *action_group;
guint ui_id;
@@ -240,8 +239,6 @@ ppview_toolbar_set_window (PPViewToolbar *t, EphyWindow *window)
t->priv->window = window;
t->priv->ui_merge = GTK_UI_MANAGER (t->priv->window->ui_merge);
- t->priv->original_mask = ephy_window_get_chrome (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,
@@ -384,7 +381,6 @@ toolbar_cmd_ppv_close (GtkUIManager *merge,
{
EphyWindow *window;
EphyEmbed *embed;
- GtkWidget *notebook;
g_return_if_fail (EPHY_IS_PPVIEW_TOOLBAR (t));
@@ -394,12 +390,7 @@ toolbar_cmd_ppv_close (GtkUIManager *merge,
embed = ephy_window_get_active_embed (window);
g_return_if_fail (EPHY_IS_EMBED (embed));
- ephy_window_set_chrome (window, t->priv->original_mask);
-
- notebook = ephy_window_get_notebook (window);
- g_return_if_fail (EPHY_IS_NOTEBOOK (notebook));
-
- ephy_notebook_set_show_tabs (EPHY_NOTEBOOK (notebook), TRUE);
+ ephy_window_set_print_preview (window, FALSE);
ephy_embed_print_preview_close (embed);
}
diff --git a/src/window-commands.c b/src/window-commands.c
index b86db7377..25ee9bff7 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -556,57 +556,30 @@ void
window_cmd_view_bookmarks_bar (GtkAction *action,
EphyWindow *window)
{
- EmbedChromeMask mask;
gboolean active;
- gboolean current_state;
- mask = ephy_window_get_chrome (window);
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- current_state = (mask & EMBED_CHROME_BOOKMARKSBARON) > 0;
-
- if (active != current_state)
- {
- mask ^= EMBED_CHROME_BOOKMARKSBARON;
- ephy_window_set_chrome (window, mask);
- }
+ eel_gconf_set_boolean (CONF_WINDOWS_SHOW_BOOKMARKS_BAR, active);
}
void
window_cmd_view_toolbar (GtkAction *action,
EphyWindow *window)
{
- EmbedChromeMask mask;
gboolean active;
- gboolean current_state;
- mask = ephy_window_get_chrome (window);
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- current_state = (mask & EMBED_CHROME_TOOLBARON) > 0;
-
- if (active != current_state)
- {
- mask ^= EMBED_CHROME_TOOLBARON;
- ephy_window_set_chrome (window, mask);
- }
+ eel_gconf_set_boolean (CONF_WINDOWS_SHOW_TOOLBARS, active);
}
void
window_cmd_view_statusbar (GtkAction *action,
EphyWindow *window)
{
- EmbedChromeMask mask;
gboolean active;
- gboolean current_state;
- mask = ephy_window_get_chrome (window);
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- current_state = (mask & EMBED_CHROME_STATUSBARON) > 0;
-
- if (active != current_state)
- {
- mask ^= EMBED_CHROME_STATUSBARON;
- ephy_window_set_chrome (window, mask);
- }
+ eel_gconf_set_boolean (CONF_WINDOWS_SHOW_STATUSBAR, active);
}
void