[nautilus] all: use nautilus_window_get_active_pane()



commit ac606bd25e13914c28702a5099905ead4e1c1510
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Jan 6 02:30:06 2012 +0100

    all: use nautilus_window_get_active_pane()

 src/nautilus-window-manage-views.c |    3 +-
 src/nautilus-window-menus.c        |   37 +++++++++++++++++++----------------
 src/nautilus-window-pane.c         |    2 +-
 src/nautilus-window.c              |    4 +--
 4 files changed, 24 insertions(+), 22 deletions(-)
---
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 83b6930..69dffe9 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -510,7 +510,8 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
 			slot_flags = NAUTILUS_WINDOW_OPEN_SLOT_APPEND;
 		}
 
-		target_slot = nautilus_window_open_slot (window->details->active_pane, slot_flags);
+		target_slot = nautilus_window_open_slot (nautilus_window_get_active_pane (window),
+							 slot_flags);
 	}
 
 	/* close the current window if the flags say so */
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index 0b0fbec..1b74a6f 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -835,8 +835,9 @@ action_tabs_previous_callback (GtkAction *action,
 			       gpointer user_data)
 {
 	NautilusWindowPane *pane;
+	NautilusWindow *window = user_data;
 
-	pane = NAUTILUS_WINDOW (user_data)->details->active_pane;
+	pane = nautilus_window_get_active_pane (window);
 	nautilus_notebook_set_current_page_relative (NAUTILUS_NOTEBOOK (pane->notebook), -1);
 }
 
@@ -845,8 +846,9 @@ action_tabs_next_callback (GtkAction *action,
 			   gpointer user_data)
 {
 	NautilusWindowPane *pane;
+	NautilusWindow *window = user_data;
 
-	pane = NAUTILUS_WINDOW (user_data)->details->active_pane;
+	pane = nautilus_window_get_active_pane (window);
 	nautilus_notebook_set_current_page_relative (NAUTILUS_NOTEBOOK (pane->notebook), 1);
 }
 
@@ -855,8 +857,9 @@ action_tabs_move_left_callback (GtkAction *action,
 				gpointer user_data)
 {
 	NautilusWindowPane *pane;
+	NautilusWindow *window = user_data;
 
-	pane = NAUTILUS_WINDOW (user_data)->details->active_pane;
+	pane = nautilus_window_get_active_pane (window);
 	nautilus_notebook_reorder_current_child_relative (NAUTILUS_NOTEBOOK (pane->notebook), -1);
 }
 
@@ -865,27 +868,27 @@ action_tabs_move_right_callback (GtkAction *action,
 				 gpointer user_data)
 {
 	NautilusWindowPane *pane;
+	NautilusWindow *window = user_data;
 
-	pane = NAUTILUS_WINDOW (user_data)->details->active_pane;
+	pane = nautilus_window_get_active_pane (window);
 	nautilus_notebook_reorder_current_child_relative (NAUTILUS_NOTEBOOK (pane->notebook), 1);
 }
 
 static void
-action_tab_change_action_activate_callback (GtkAction *action, gpointer user_data)
+action_tab_change_action_activate_callback (GtkAction *action, 
+					    gpointer user_data)
 {
-	NautilusWindow *window;
+	NautilusWindowPane *pane;
+	NautilusWindow *window = user_data;
+	GtkNotebook *notebook;
+	int num;
 
-	window = NAUTILUS_WINDOW (user_data);
-	if (window && window->details->active_pane) {
-		GtkNotebook *notebook;
-		notebook = GTK_NOTEBOOK (window->details->active_pane->notebook);
-		if (notebook) {
-			int num;
-			num = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (action), "num"));
-			if (num < gtk_notebook_get_n_pages (notebook)) {
-				gtk_notebook_set_current_page (notebook, num);
-			}
-		}
+	pane = nautilus_window_get_active_pane (window);
+	notebook = GTK_NOTEBOOK (pane->notebook);
+
+	num = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (action), "num"));
+	if (num < gtk_notebook_get_n_pages (notebook)) {
+		gtk_notebook_set_current_page (notebook, num);
 	}
 }
 
diff --git a/src/nautilus-window-pane.c b/src/nautilus-window-pane.c
index 104cc43..e4cdcad 100644
--- a/src/nautilus-window-pane.c
+++ b/src/nautilus-window-pane.c
@@ -859,7 +859,7 @@ nautilus_window_pane_sync_location_widgets (NautilusWindowPane *pane)
 	}
 
 	/* Update window global UI if this is the active pane */
-	if (pane == pane->window->details->active_pane) {
+	if (pane == nautilus_window_get_active_pane (pane->window)) {
 		nautilus_window_update_up_button (pane->window);
 
 		/* Check if the back and forward buttons need enabling or disabling. */
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index a58b6ca..3e605f2 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -2138,9 +2138,7 @@ nautilus_window_split_view_off (NautilusWindow *window)
 	NautilusWindowPane *pane, *active_pane;
 	GList *l, *next;
 
-	g_return_if_fail (window);
-
-	active_pane = window->details->active_pane;
+	active_pane = nautilus_window_get_active_pane (window);
 
 	/* delete all panes except the first (main) pane */
 	for (l = window->details->panes; l != NULL; l = next) {



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