From 7a76c2dad619494ac04a0713d56882a3b141384c Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 6 Jan 2014 10:57:20 -0800 Subject: window: sync initial state for start-with-sidebar action When we construct the NautilusWindow, we show or hide the sidebar according to the value in GSettings, but we never sync the initial state of the corresponding toggle action. Based on a patch by Paul Menzel https://bugzilla.gnome.org/show_bug.cgi?id=699165 --- src/nautilus-window.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 8e24f4fc3..b3c338616 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -458,6 +458,8 @@ nautilus_window_set_initial_window_geometry (NautilusWindow *window) GdkScreen *screen; guint max_width_for_screen, max_height_for_screen; guint default_width, default_height; + gboolean show_sidebar; + GtkAction *action; screen = gtk_window_get_screen (GTK_WINDOW (window)); @@ -472,6 +474,17 @@ nautilus_window_set_initial_window_geometry (NautilusWindow *window) max_width_for_screen), MIN (default_height, max_height_for_screen)); + + show_sidebar = g_settings_get_boolean (nautilus_window_state, NAUTILUS_WINDOW_STATE_START_WITH_SIDEBAR); + action = gtk_action_group_get_action (window->details->main_action_group, + NAUTILUS_ACTION_SHOW_HIDE_SIDEBAR); + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), show_sidebar); + + if (show_sidebar) { + nautilus_window_show_sidebar (window); + } else { + nautilus_window_hide_sidebar (window); + } } static gboolean @@ -1520,12 +1533,6 @@ nautilus_window_constructed (GObject *self) slot = nautilus_window_open_slot (window, 0); nautilus_window_set_active_slot (window, slot); - if (g_settings_get_boolean (nautilus_window_state, NAUTILUS_WINDOW_STATE_START_WITH_SIDEBAR)) { - nautilus_window_show_sidebar (window); - } else { - nautilus_window_hide_sidebar (window); - } - window->details->bookmarks_id = g_signal_connect_swapped (nautilus_application_get_bookmarks (application), "changed", G_CALLBACK (nautilus_window_sync_bookmarks), window); -- cgit v1.2.1