diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-02-02 06:51:33 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-02-02 06:51:33 +0800 |
commit | bbe51560c5c217f6d942aff4a3770e6703416326 (patch) | |
tree | 396aa2e3425cffaf3907a1f92494f1c33682fea5 /src/ephy-window.c | |
parent | 7864d3ac6cb6527f871b3932a05a868cdb60e126 (diff) | |
download | gsoc2013-epiphany-bbe51560c5c217f6d942aff4a3770e6703416326.tar gsoc2013-epiphany-bbe51560c5c217f6d942aff4a3770e6703416326.tar.gz gsoc2013-epiphany-bbe51560c5c217f6d942aff4a3770e6703416326.tar.bz2 gsoc2013-epiphany-bbe51560c5c217f6d942aff4a3770e6703416326.tar.lz gsoc2013-epiphany-bbe51560c5c217f6d942aff4a3770e6703416326.tar.xz gsoc2013-epiphany-bbe51560c5c217f6d942aff4a3770e6703416326.tar.zst gsoc2013-epiphany-bbe51560c5c217f6d942aff4a3770e6703416326.zip |
Remove the accel group from the window when hiding the menubar in lockdown
2005-02-01 Christian Persch <chpe@cvs.gnome.org>
* data/epiphany-lockdown.schemas.in:
* src/ephy-window.c: (sync_chromes_visibility), (setup_ui_manager),
(ephy_window_set_print_preview):
Remove the accel group from the window when hiding the menubar
in lockdown mode. From bug #165550.
Diffstat (limited to 'src/ephy-window.c')
-rw-r--r-- | src/ephy-window.c | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c index 4a7adbc45..17695d395 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -548,6 +548,8 @@ sync_chromes_visibility (EphyWindow *window) { EphyWindowPrivate *priv = window->priv; GtkWidget *menubar; + GtkAccelGroup *accel_group; + GSList *groups; gboolean show_statusbar, show_menubar, show_toolbar, show_bookmarksbar; get_chromes_visibility (window, &show_menubar, @@ -568,6 +570,23 @@ sync_chromes_visibility (EphyWindow *window) { g_object_set (priv->fullscreen_popup, "visible", !show_toolbar, NULL); } + + /* en/disable accel group */ + accel_group = gtk_ui_manager_get_accel_group (window->priv->manager); + groups = gtk_accel_groups_from_object (G_OBJECT (window)); + + if (priv->chrome & EPHY_EMBED_CHROME_MENUBAR && + priv->ppv_mode == FALSE) + { + if (g_slist_find (groups, accel_group) == NULL) + { + gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); + } + } + else if (g_slist_find (groups, accel_group) != NULL) + { + gtk_window_remove_accel_group (GTK_WINDOW (window), accel_group); + } } static void @@ -1160,8 +1179,6 @@ setup_ui_manager (EphyWindow *window) window->priv->manager = manager; g_signal_connect (manager, "add_widget", G_CALLBACK (add_widget), window); - gtk_window_add_accel_group (GTK_WINDOW (window), - gtk_ui_manager_get_accel_group (manager)); } static void @@ -2786,33 +2803,30 @@ ephy_window_new_with_chrome (EphyEmbedChrome chrome) * Sets whether the window is in print preview mode. **/ void -ephy_window_set_print_preview (EphyWindow *window, gboolean enabled) +ephy_window_set_print_preview (EphyWindow *window, + gboolean enabled) { - GtkAccelGroup *accel_group; - - accel_group = gtk_ui_manager_get_accel_group (window->priv->manager); + EphyWindowPrivate *priv = window->priv; - if (window->priv->ppv_mode == enabled) return; + if (priv->ppv_mode == enabled) return; - window->priv->ppv_mode = enabled; + priv->ppv_mode = enabled; sync_chromes_visibility (window); - ephy_notebook_set_show_tabs (EPHY_NOTEBOOK (window->priv->notebook), !enabled); + ephy_notebook_set_show_tabs (EPHY_NOTEBOOK (priv->notebook), !enabled); if (enabled) { - g_return_if_fail (window->priv->ppview_toolbar == NULL); + g_return_if_fail (priv->ppview_toolbar == NULL); - window->priv->ppview_toolbar = ppview_toolbar_new (window); - gtk_window_remove_accel_group (GTK_WINDOW (window), accel_group); + priv->ppview_toolbar = ppview_toolbar_new (window); } else { - g_return_if_fail (window->priv->ppview_toolbar != NULL); + g_return_if_fail (priv->ppview_toolbar != NULL); - g_object_unref (window->priv->ppview_toolbar); - window->priv->ppview_toolbar = NULL; - gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); + g_object_unref (priv->ppview_toolbar); + priv->ppview_toolbar = NULL; } g_object_notify (G_OBJECT (window), "print-preview-mode"); |