[nautilus/gnome-3-8] window: sync initial state for start-with-sidebar action



commit 55365d9fc66bec75846fa91bb18b814dc950dba2
Author: Cosimo Cecchi <cosimo endlessm com>
Date:   Mon Jan 6 10:57:20 2014 -0800

    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 <paulepanter users sourceforge net>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699165

 src/nautilus-window.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index c1f6765..dcccdb6 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -455,6 +455,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));
        
@@ -469,6 +471,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
@@ -1178,12 +1191,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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]