Index: src/ephy-window.c
===================================================================
RCS file: /cvs/gnome/epiphany/src/ephy-window.c,v
retrieving revision 1.267
retrieving revision 1.268
diff -p -u -u -p -r1.267 -r1.268
--- src/ephy-window.c	1 Feb 2005 19:51:55 -0000	1.267
+++ src/ephy-window.c	1 Feb 2005 22:51:33 -0000	1.268
@@ -17,7 +17,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
- *  $Id: ephy-window.c,v 1.267 2005/02/01 19:51:55 chpe Exp $
+ *  $Id: ephy-window.c,v 1.268 2005/02/01 22:51:33 chpe Exp $
  */
 
 #include "config.h"
@@ -548,6 +548,8 @@ sync_chromes_visibility (EphyWindow *win
 {
 	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 *win
 	{
 		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 (EphyEmbedCh
  * 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");
