[nautilus] window: move nautilus_window_update_up_button() to NautilusWindow



commit f49a5b864058cc5bb4b1534ab03e89d1e9fdbc34
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Jan 7 01:49:28 2012 +0100

    window: move nautilus_window_update_up_button() to NautilusWindow

 src/nautilus-window-manage-views.c |   34 ++--------------------------------
 src/nautilus-window-manage-views.h |    1 -
 src/nautilus-window-pane.c         |    2 +-
 src/nautilus-window-private.h      |    1 +
 src/nautilus-window.c              |   29 +++++++++++++++++++++++++++++
 5 files changed, 33 insertions(+), 34 deletions(-)
---
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index bded52a..b5bebca 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -257,35 +257,6 @@ handle_go_elsewhere (NautilusWindowSlot *slot,
 	}
 }
 
-void
-nautilus_window_update_up_button (NautilusWindow *window)
-{
-	GtkAction *action;
-	GtkActionGroup *action_group;
-	NautilusWindowSlot *slot;
-	gboolean allowed;
-	GFile *parent;
-
-	slot = nautilus_window_get_active_slot (window);
-
-	allowed = FALSE;
-	if (slot->location != NULL) {
-		parent = g_file_get_parent (slot->location);
-		allowed = parent != NULL;
-
-		g_clear_object (&parent);
-	}
-
-	action_group = nautilus_window_get_main_action_group (window);
-
-	action = gtk_action_group_get_action (action_group,
-					      NAUTILUS_ACTION_UP);
-	gtk_action_set_sensitive (action, allowed);
-	action = gtk_action_group_get_action (action_group,
-					      NAUTILUS_ACTION_UP_ACCEL);
-	gtk_action_set_sensitive (action, allowed);
-}
-
 static void
 viewed_file_changed_callback (NautilusFile *file,
                               NautilusWindowSlot *slot)
@@ -1419,9 +1390,8 @@ update_for_new_location (NautilusWindowSlot *slot)
         nautilus_file_unref (file);
 
 	if (slot == nautilus_window_get_active_slot (window)) {
-		/* Check if we can go up. */
-		nautilus_window_update_up_button (window);
-
+		/* Sync up and zoom action states */
+		nautilus_window_sync_up_button (window);
 		nautilus_window_sync_zoom_widgets (window);
 
 		/* Set up the content view menu for this new location. */
diff --git a/src/nautilus-window-manage-views.h b/src/nautilus-window-manage-views.h
index 17734aa..4cb9c02 100644
--- a/src/nautilus-window-manage-views.h
+++ b/src/nautilus-window-manage-views.h
@@ -36,6 +36,5 @@ void nautilus_window_manage_views_close_slot (NautilusWindowPane *pane,
 
 /* NautilusWindowInfo implementation: */
 void nautilus_window_report_location_change   (NautilusWindow     *window);
-void nautilus_window_update_up_button         (NautilusWindow     *window);
 
 #endif /* NAUTILUS_WINDOW_MANAGE_VIEWS_H */
diff --git a/src/nautilus-window-pane.c b/src/nautilus-window-pane.c
index d735782..7a3a0b2 100644
--- a/src/nautilus-window-pane.c
+++ b/src/nautilus-window-pane.c
@@ -921,7 +921,7 @@ nautilus_window_pane_sync_location_widgets (NautilusWindowPane *pane)
 
 	/* Update window global UI if this is the active pane */
 	if (pane == nautilus_window_get_active_pane (pane->window)) {
-		nautilus_window_update_up_button (pane->window);
+		nautilus_window_sync_up_button (pane->window);
 
 		/* Check if the back and forward buttons need enabling or disabling. */
 		active_slot = nautilus_window_get_active_slot (pane->window);
diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h
index 2be8c8c..1cdd96a 100644
--- a/src/nautilus-window-private.h
+++ b/src/nautilus-window-private.h
@@ -150,6 +150,7 @@ void nautilus_window_sync_allow_stop       (NautilusWindow *window,
 void nautilus_window_sync_title            (NautilusWindow *window,
 					    NautilusWindowSlot *slot);
 void nautilus_window_sync_zoom_widgets     (NautilusWindow *window);
+void nautilus_window_sync_up_button        (NautilusWindow *window);
 
 /* window menus */
 GtkActionGroup *nautilus_window_create_toolbar_action_group (NautilusWindow *window);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index eb8431e..9c0edcd 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1383,6 +1383,35 @@ nautilus_window_load_view_as_menus (NautilusWindow *window)
 }
 
 void
+nautilus_window_sync_up_button (NautilusWindow *window)
+{
+	GtkAction *action;
+	GtkActionGroup *action_group;
+	NautilusWindowSlot *slot;
+	gboolean allowed;
+	GFile *parent;
+
+	slot = nautilus_window_get_active_slot (window);
+
+	allowed = FALSE;
+	if (slot->location != NULL) {
+		parent = g_file_get_parent (slot->location);
+		allowed = parent != NULL;
+
+		g_clear_object (&parent);
+	}
+
+	action_group = nautilus_window_get_main_action_group (window);
+
+	action = gtk_action_group_get_action (action_group,
+					      NAUTILUS_ACTION_UP);
+	gtk_action_set_sensitive (action, allowed);
+	action = gtk_action_group_get_action (action_group,
+					      NAUTILUS_ACTION_UP_ACCEL);
+	gtk_action_set_sensitive (action, allowed);
+}
+
+void
 nautilus_window_sync_title (NautilusWindow *window,
 			    NautilusWindowSlot *slot)
 {



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