[epiphany] Add UI options to hide the menubar



commit d50425cfd3009d18404d37bb245e8ebd5ac4b3d6
Author: Xan Lopez <xlopez igalia com>
Date:   Sun Apr 17 19:02:15 2011 -0700

    Add UI options to hide the menubar
    
    In the future Web-app like windows will have this hidden by default,
    but for now we can also add an option to hide it elsewhere.

 data/ui/epiphany-ui.xml |    3 +++
 src/ephy-window.c       |   30 +++++++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/data/ui/epiphany-ui.xml b/data/ui/epiphany-ui.xml
index 5d1ffbf..90ae367 100644
--- a/data/ui/epiphany-ui.xml
+++ b/data/ui/epiphany-ui.xml
@@ -47,6 +47,7 @@
 					<separator/>
 				</menu>
 			</placeholder>
+			<menuitem name="HideMenubar" action="HideMenubar"/>
 			<menuitem name="ViewDownloadsBar" action="ViewDownloadsBar"/>
 			<separator name="ViewSep1"/>
 			<menuitem name="ViewPopupsMenu" action="ViewPopupWindows"/>
@@ -138,6 +139,8 @@
 		<menuitem name="CopyImageLocationDP" action="CopyImageLocation"/>
 		<separator />
 		<menuitem name="InspectElementDP" action="InspectElement"/>
+		<separator />
+		<menuitem action="HideMenubar" />
 	</popup>
 
 	<popup name="EphyLinkPopup" action="PopupAction">
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 4a874ce..b7da955 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -92,6 +92,8 @@ static void notebook_switch_page_cb		(GtkNotebook *notebook,
 						 EphyWindow *window);
 static void ephy_window_view_toolbar_cb         (GtkAction *action,
 						 EphyWindow *window);
+static void ephy_window_view_menubar_cb         (GtkAction *action,
+						 EphyWindow *window);
 static void ephy_window_view_popup_windows_cb	(GtkAction *action,
 						 EphyWindow *window);
 static void sync_tab_load_status		(EphyWebView *view,
@@ -283,6 +285,10 @@ static const GtkToggleActionEntry ephy_menu_toggle_entries [] =
 	{ "ViewDownloadsBar", NULL, N_("_Downloads Bar"), NULL,
 	  N_("Show the active downloads for this window"),
 	  NULL, FALSE },
+
+	{ "HideMenubar", NULL, N_("Hide Men_ubar"), NULL,
+	  NULL,
+	  G_CALLBACK (ephy_window_view_menubar_cb), FALSE },
 	{ "ViewFullscreen", GTK_STOCK_FULLSCREEN, N_("_Fullscreen"), "F11",
 	  N_("Browse at full screen"),
 	  G_CALLBACK (window_cmd_view_fullscreen), FALSE },
@@ -1448,7 +1454,8 @@ update_chromes_actions (EphyWindow *window)
 	GtkAction *action;
 	gboolean show_menubar, show_toolbar, show_tabsbar;
 
-	get_chromes_visibility (window, &show_menubar,
+	get_chromes_visibility (window,
+				&show_menubar,
 				&show_toolbar,
 				&show_tabsbar);
 
@@ -1460,6 +1467,15 @@ update_chromes_actions (EphyWindow *window)
 	g_signal_handlers_unblock_by_func (G_OBJECT (action),
 		 			   G_CALLBACK (ephy_window_view_toolbar_cb),
 		 			   window);
+
+	action = gtk_action_group_get_action (action_group, "HideMenubar");
+	g_signal_handlers_block_by_func (G_OBJECT (action),
+		 			 G_CALLBACK (ephy_window_view_menubar_cb),
+		 			 window);
+	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), !show_menubar);
+	g_signal_handlers_unblock_by_func (G_OBJECT (action),
+		 			   G_CALLBACK (ephy_window_view_menubar_cb),
+		 			   window);
 }
 
 static void
@@ -4014,6 +4030,10 @@ sync_prefs_with_chrome (EphyWindow *window)
 		g_settings_set_boolean (EPHY_SETTINGS_UI,
 					EPHY_PREFS_UI_SHOW_TOOLBARS,
 				        flags & EPHY_WEB_VIEW_CHROME_TOOLBAR);
+
+		g_settings_set_boolean (EPHY_SETTINGS_LOCKDOWN,
+					EPHY_PREFS_LOCKDOWN_MENUBAR,
+				        !(flags & EPHY_WEB_VIEW_CHROME_MENUBAR));
 	}
 }
 
@@ -4043,6 +4063,14 @@ ephy_window_view_toolbar_cb (GtkAction *action,
 }
 
 static void
+ephy_window_view_menubar_cb (GtkAction *action,
+			     EphyWindow *window)
+{
+	sync_chrome_with_view_toggle (action, window,
+				      EPHY_WEB_VIEW_CHROME_MENUBAR, TRUE);
+}
+
+static void
 ephy_window_view_popup_windows_cb (GtkAction *action,
 				   EphyWindow *window)
 {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]