Commit 417bb5c3 authored by Cosimo Cecchi's avatar Cosimo Cecchi

navigation-window: use g_settings_bind() for statusbar visibility

parent 1373f01d
......@@ -191,21 +191,6 @@ action_show_hide_sidebar_callback (GtkAction *action,
}
}
static void
action_show_hide_statusbar_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_status_bar (window);
} else {
nautilus_navigation_window_hide_status_bar (window);
}
}
static void
action_split_view_callback (GtkAction *action,
gpointer user_data)
......@@ -257,11 +242,6 @@ nautilus_navigation_window_update_show_hide_menu_items (NautilusNavigationWindow
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
nautilus_navigation_window_sidebar_showing (window));
action = gtk_action_group_get_action (window->details->navigation_action_group,
NAUTILUS_ACTION_SHOW_HIDE_STATUSBAR);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
nautilus_navigation_window_status_bar_showing (window));
action = gtk_action_group_get_action (window->details->navigation_action_group,
NAUTILUS_ACTION_SHOW_HIDE_EXTRA_PANE);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
......@@ -818,7 +798,7 @@ static const GtkToggleActionEntry navigation_toggle_entries[] = {
/* name, stock id */ { "Show Hide Statusbar", NULL,
/* label, accelerator */ N_("St_atusbar"), NULL,
/* tooltip */ N_("Change the visibility of this window's statusbar"),
G_CALLBACK (action_show_hide_statusbar_callback),
NULL,
/* is_active */ TRUE },
/* name, stock id */ { "Search", "edit-find-symbolic",
/* label, accelerator */ N_("_Search for Files..."),
......@@ -977,6 +957,15 @@ navigation_window_menus_set_bindings (NautilusNavigationWindow *window)
action,
"active",
G_SETTINGS_BIND_DEFAULT);
action = gtk_action_group_get_action (window->details->navigation_action_group,
NAUTILUS_ACTION_SHOW_HIDE_STATUSBAR);
g_settings_bind (nautilus_window_state,
NAUTILUS_WINDOW_STATE_START_WITH_STATUS_BAR,
action,
"active",
G_SETTINGS_BIND_DEFAULT);
}
/**
......
......@@ -460,35 +460,6 @@ nautilus_navigation_window_set_search_button (NautilusNavigationWindow *window,
g_object_set_data (G_OBJECT (action), "blocked", NULL);
}
void
nautilus_navigation_window_hide_status_bar (NautilusNavigationWindow *window)
{
gtk_widget_hide (NAUTILUS_WINDOW (window)->details->statusbar);
nautilus_navigation_window_update_show_hide_menu_items (window);
g_settings_set_boolean (nautilus_window_state, NAUTILUS_WINDOW_STATE_START_WITH_STATUS_BAR, FALSE);
}
void
nautilus_navigation_window_show_status_bar (NautilusNavigationWindow *window)
{
gtk_widget_show (NAUTILUS_WINDOW (window)->details->statusbar);
nautilus_navigation_window_update_show_hide_menu_items (window);
g_settings_set_boolean (nautilus_window_state, NAUTILUS_WINDOW_STATE_START_WITH_STATUS_BAR, TRUE);
}
gboolean
nautilus_navigation_window_status_bar_showing (NautilusNavigationWindow *window)
{
if (NAUTILUS_WINDOW (window)->details->statusbar != NULL) {
return gtk_widget_get_visible (NAUTILUS_WINDOW (window)->details->statusbar);
}
/* If we're not visible yet we haven't changed visibility, so its TRUE */
return TRUE;
}
/**
* nautilus_navigation_window_get_base_page_index:
* @window: Window to get index from
......@@ -539,12 +510,6 @@ nautilus_navigation_window_show (GtkWidget *widget)
nautilus_navigation_window_hide_sidebar (window);
}
if (g_settings_get_boolean (nautilus_window_state, NAUTILUS_WINDOW_STATE_START_WITH_STATUS_BAR)) {
nautilus_navigation_window_show_status_bar (window);
} else {
nautilus_navigation_window_hide_status_bar (window);
}
GTK_WIDGET_CLASS (parent_class)->show (widget);
}
......@@ -830,7 +795,12 @@ nautilus_navigation_window_init (NautilusNavigationWindow *window)
window->details->split_view_hpane = hpaned;
gtk_box_pack_start (GTK_BOX (vbox), win->details->statusbar, FALSE, FALSE, 0);
gtk_widget_show (win->details->statusbar);
g_settings_bind (nautilus_window_state,
NAUTILUS_WINDOW_STATE_START_WITH_STATUS_BAR,
win->details->statusbar,
"visible",
G_SETTINGS_BIND_DEFAULT);
nautilus_navigation_window_initialize_actions (window);
nautilus_navigation_window_pane_setup (pane);
......
......@@ -76,9 +76,6 @@ gint nautilus_navigation_window_get_base_page_index (NautilusNavigationWind
void nautilus_navigation_window_hide_sidebar (NautilusNavigationWindow *window);
void nautilus_navigation_window_show_sidebar (NautilusNavigationWindow *window);
gboolean nautilus_navigation_window_sidebar_showing (NautilusNavigationWindow *window);
void nautilus_navigation_window_hide_status_bar (NautilusNavigationWindow *window);
void nautilus_navigation_window_show_status_bar (NautilusNavigationWindow *window);
gboolean nautilus_navigation_window_status_bar_showing (NautilusNavigationWindow *window);
void nautilus_navigation_window_back_or_forward (NautilusNavigationWindow *window,
gboolean back,
guint distance,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment