From 8a886cb6af00b1a2fb7c544ba9b8cd82586e9c48 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Fri, 30 Mar 2012 12:42:07 +0200 Subject: ephy-window: listen to org.gnome.Epiphany.ui.show-toolbars We were not properly changing the UI if the key was changing at runtime. --- src/ephy-window.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/ephy-window.c') diff --git a/src/ephy-window.c b/src/ephy-window.c index a54f7f2d3..36243a3ad 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -726,6 +726,19 @@ sync_chromes_visibility (EphyWindow *window) ephy_notebook_set_show_tabs (EPHY_NOTEBOOK (priv->notebook), show_tabsbar); } +static void +set_toolbar_visibility (EphyWindow *window, gboolean show_toolbar) +{ + EphyWindowPrivate *priv = window->priv; + + if (show_toolbar) + priv->chrome |= EPHY_WEB_VIEW_CHROME_TOOLBAR; + else + priv->chrome &= ~EPHY_WEB_VIEW_CHROME_TOOLBAR; + + sync_chromes_visibility (window); +} + static void sync_tab_load_status (EphyWebView *view, GParamSpec *pspec, @@ -3127,6 +3140,19 @@ allow_popups_notifier (GSettings *settings, g_list_free (tabs); } +static void +show_toolbars_setting_cb (GSettings *settings, + char *key, + EphyWindow *window) +{ + gboolean show_toolbars; + + show_toolbars = g_settings_get_boolean (EPHY_SETTINGS_UI, + EPHY_PREFS_UI_SHOW_TOOLBARS); + + set_toolbar_visibility (window, show_toolbars); +} + static void sync_user_input_cb (EphyLocationController *action, GParamSpec *pspec, @@ -3364,6 +3390,10 @@ ephy_window_constructor (GType type, "changed::" EPHY_PREFS_WEB_ENABLE_POPUPS, G_CALLBACK (allow_popups_notifier), window); + g_signal_connect (EPHY_SETTINGS_UI, + "changed::" EPHY_PREFS_UI_SHOW_TOOLBARS, + G_CALLBACK (show_toolbars_setting_cb), window); + /* network status */ single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell)); sync_network_status (single, NULL, window); -- cgit v1.2.3