[nautilus] navigation-window: use g_settings_bind() for statusbar visibility
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] navigation-window: use g_settings_bind() for statusbar visibility
- Date: Thu, 17 Feb 2011 16:30:18 +0000 (UTC)
commit 417bb5c31758a3b321fbac0d53402bed1034c6db
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Feb 15 13:51:34 2011 -0500
navigation-window: use g_settings_bind() for statusbar visibility
src/nautilus-navigation-window-menus.c | 31 +++++++----------------
src/nautilus-navigation-window.c | 42 ++++---------------------------
src/nautilus-navigation-window.h | 3 --
3 files changed, 16 insertions(+), 60 deletions(-)
---
diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c
index 6bfbf07..cfea3e0 100644
--- a/src/nautilus-navigation-window-menus.c
+++ b/src/nautilus-navigation-window-menus.c
@@ -192,21 +192,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)
{
@@ -258,11 +243,6 @@ nautilus_navigation_window_update_show_hide_menu_items (NautilusNavigationWindow
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),
nautilus_navigation_window_split_view_showing (window));
@@ -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);
}
/**
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index c3b1c55..a935d4f 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -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);
diff --git a/src/nautilus-navigation-window.h b/src/nautilus-navigation-window.h
index 8f669f4..9cc4228 100644
--- a/src/nautilus-navigation-window.h
+++ b/src/nautilus-navigation-window.h
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]