Add toggle to hide/show main toolbar.

2005-07-11  Alexander Larsson  <alexl@redhat.com>

	* libnautilus-private/nautilus-global-preferences.[ch]:
	* src/nautilus-actions.h:
	* src/nautilus-navigation-window-menus.c:
	* src/nautilus-navigation-window-ui.xml:
	* src/nautilus-navigation-window.c:
	Add toggle to hide/show main toolbar.
This commit is contained in:
Alexander Larsson 2005-07-11 08:52:21 +00:00 committed by Alexander Larsson
parent c5258c211b
commit c2b26edbf8
7 changed files with 73 additions and 0 deletions

View file

@ -1,3 +1,12 @@
2005-07-11 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-global-preferences.[ch]:
* src/nautilus-actions.h:
* src/nautilus-navigation-window-menus.c:
* src/nautilus-navigation-window-ui.xml:
* src/nautilus-navigation-window.c:
Add toggle to hide/show main toolbar.
2005-07-10 Christian Neumair <chris@gnome-de.org>
* src/nautilus-property-browser.c: (add_color_to_browser): Don't allow

View file

@ -390,6 +390,10 @@ static const PreferenceDefault preference_defaults[] = {
PREFERENCE_BOOLEAN,
GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_START_WITH_TOOLBAR,
PREFERENCE_BOOLEAN,
GINT_TO_POINTER (TRUE)
},
{ NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR,
PREFERENCE_BOOLEAN,
GINT_TO_POINTER (TRUE)

View file

@ -85,6 +85,7 @@ typedef enum
#define NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY "preferences/always_use_location_entry"
#define NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR "preferences/start_with_status_bar"
#define NAUTILUS_PREFERENCES_START_WITH_SIDEBAR "preferences/start_with_sidebar"
#define NAUTILUS_PREFERENCES_START_WITH_TOOLBAR "preferences/start_with_toolbar"
#define NAUTILUS_PREFERENCES_SIDE_PANE_VIEW "preferences/side_pane_view"
#define NAUTILUS_PREFERENCES_NAVIGATION_WINDOW_SAVED_GEOMETRY "preferences/navigation_window_saved_geometry"

View file

@ -33,6 +33,7 @@
#define NAUTILUS_ACTION_UP_ACCEL "UpAccel"
#define NAUTILUS_ACTION_UP_ACCEL "UpAccel"
#define NAUTILUS_ACTION_FORWARD "Forward"
#define NAUTILUS_ACTION_SHOW_HIDE_TOOLBAR "Show Hide Toolbar"
#define NAUTILUS_ACTION_SHOW_HIDE_SIDEBAR "Show Hide Sidebar"
#define NAUTILUS_ACTION_SHOW_HIDE_STATUSBAR "Show Hide Statusbar"
#define NAUTILUS_ACTION_SHOW_HIDE_LOCATION_BAR "Show Hide Location Bar"

View file

@ -143,6 +143,23 @@ action_clear_history_callback (GtkAction *action,
forget_history_if_confirmed (NAUTILUS_WINDOW (user_data));
}
static void
action_show_hide_toolbar_callback (GtkAction *action,
gpointer user_data)
{
NautilusNavigationWindow *window;
window = NAUTILUS_NAVIGATION_WINDOW (user_data);
if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
nautilus_navigation_window_show_toolbar (window);
} else {
nautilus_navigation_window_hide_toolbar (window);
}
}
static void
action_show_hide_sidebar_callback (GtkAction *action,
gpointer user_data)
@ -195,6 +212,11 @@ nautilus_navigation_window_update_show_hide_menu_items (NautilusNavigationWindow
g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
action = gtk_action_group_get_action (window->details->navigation_action_group,
NAUTILUS_ACTION_SHOW_HIDE_TOOLBAR);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
nautilus_navigation_window_toolbar_showing (window));
action = gtk_action_group_get_action (window->details->navigation_action_group,
NAUTILUS_ACTION_SHOW_HIDE_SIDEBAR);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
@ -414,6 +436,11 @@ static const GtkActionEntry navigation_entries[] = {
};
static const GtkToggleActionEntry navigation_toggle_entries[] = {
{ "Show Hide Toolbar", NULL, /* name, stock id */
N_("_Main Toolbar"), NULL, /* label, accelerator */
N_("Change the visibility of this window's main toolbar"), /* tooltip */
G_CALLBACK (action_show_hide_toolbar_callback),
TRUE}, /* is_active */
{ "Show Hide Sidebar", NULL, /* name, stock id */
N_("_Side Pane"), "F9", /* label, accelerator */
N_("Change the visibility of this window's sidebar"), /* tooltip */

View file

@ -11,6 +11,7 @@
</menu>
<menu action="View">
<placeholder name="Show Hide Placeholder">
<menuitem name="Show Hide Toolbar" action="Show Hide Toolbar"/>
<menuitem name="Show Hide Sidebar" action="Show Hide Sidebar"/>
<menuitem name="Show Hide Location Bar" action="Show Hide Location Bar"/>
<menuitem name="Show Hide Statusbar" action="Show Hide Statusbar"/>

View file

@ -1031,6 +1031,29 @@ nautilus_navigation_window_status_bar_showing (NautilusNavigationWindow *window)
return TRUE;
}
void
nautilus_navigation_window_hide_toolbar (NautilusNavigationWindow *window)
{
gtk_widget_hide (window->details->toolbar);
nautilus_navigation_window_update_show_hide_menu_items (window);
if (eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR) &&
eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR)) {
eel_preferences_set_boolean (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR, FALSE);
}
}
void
nautilus_navigation_window_show_toolbar (NautilusNavigationWindow *window)
{
gtk_widget_show (window->details->toolbar);
nautilus_navigation_window_update_show_hide_menu_items (window);
if (eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR) &&
!eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR)) {
eel_preferences_set_boolean (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR, TRUE);
}
}
void
nautilus_navigation_window_hide_sidebar (NautilusNavigationWindow *window)
{
@ -1117,6 +1140,13 @@ nautilus_navigation_window_show (GtkWidget *widget)
/* Initially show or hide views based on preferences; once the window is displayed
* these can be controlled on a per-window basis from View menu items.
*/
if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR)) {
nautilus_navigation_window_show_toolbar (window);
} else {
nautilus_navigation_window_hide_toolbar (window);
}
if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR)) {
nautilus_navigation_window_show_location_bar (window, FALSE);
} else {