From d50425cfd3009d18404d37bb245e8ebd5ac4b3d6 Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Sun, 17 Apr 2011 19:02:15 -0700 Subject: 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. --- src/ephy-window.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ephy-window.c b/src/ephy-window.c index 4a874ce27..b7da95576 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)); } } @@ -4042,6 +4062,14 @@ ephy_window_view_toolbar_cb (GtkAction *action, EPHY_WEB_VIEW_CHROME_TOOLBAR, TRUE); } +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) -- cgit v1.2.3