[nautilus] Move nautilus_navigation_window_pane_set_active into a vfunc



commit adc968f34c1085ce4e5378fba92655082052f13d
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Dec 17 10:28:34 2009 +0100

    Move nautilus_navigation_window_pane_set_active into a vfunc
    
    Now nautilus_window_pane_set_active works for both navigational
    and spatial panes.

 src/nautilus-navigation-window-pane.c |   23 +++++++++++------------
 src/nautilus-navigation-window-pane.h |    1 -
 src/nautilus-window-pane.c            |    3 +++
 src/nautilus-window-pane.h            |    2 ++
 src/nautilus-window.c                 |   16 ++++------------
 5 files changed, 20 insertions(+), 25 deletions(-)
---
diff --git a/src/nautilus-navigation-window-pane.c b/src/nautilus-navigation-window-pane.c
index ddb3c0b..a6d530d 100644
--- a/src/nautilus-navigation-window-pane.c
+++ b/src/nautilus-navigation-window-pane.c
@@ -48,27 +48,25 @@ G_DEFINE_TYPE (NautilusNavigationWindowPane,
 #define parent_class nautilus_navigation_window_pane_parent_class
 
 
-void
-nautilus_navigation_window_pane_set_active (NautilusNavigationWindowPane *pane, gboolean is_active)
+static void
+real_set_active (NautilusWindowPane *pane, gboolean is_active)
 {
-	GList *walk;
+	NautilusNavigationWindowPane *nav_pane;
+	GList *l;
 
-	if (NAUTILUS_WINDOW_PANE (pane)->is_active == is_active) {
-		return;
-	}
-	nautilus_window_pane_set_active (NAUTILUS_WINDOW_PANE (pane), is_active);
+	nav_pane = NAUTILUS_NAVIGATION_WINDOW_PANE (pane);
 
 	/* path bar */
-	for (walk = NAUTILUS_PATH_BAR (pane->path_bar)->button_list; walk; walk = walk->next) {
-		gtk_widget_set_sensitive (gtk_bin_get_child (GTK_BIN (nautilus_path_bar_get_button_from_button_list_entry (walk->data))), is_active);
+	for (l = NAUTILUS_PATH_BAR (nav_pane->path_bar)->button_list; l; l = l->next) {
+		gtk_widget_set_sensitive (gtk_bin_get_child (GTK_BIN (nautilus_path_bar_get_button_from_button_list_entry (l->data))), is_active);
 	}
 
 	/* navigation bar (manual entry) */
-	nautilus_location_bar_set_active (NAUTILUS_LOCATION_BAR (pane->navigation_bar), is_active);
+	nautilus_location_bar_set_active (NAUTILUS_LOCATION_BAR (nav_pane->navigation_bar), is_active);
 
 	/* if actions/menus exist, update those as well */
-	if (NAUTILUS_NAVIGATION_WINDOW (NAUTILUS_WINDOW_PANE (pane)->window)->details->navigation_action_group) {
-		nautilus_navigation_window_pane_initialize_tabs_menu(pane);
+	if (NAUTILUS_NAVIGATION_WINDOW (pane->window)->details->navigation_action_group) {
+		nautilus_navigation_window_pane_initialize_tabs_menu (nav_pane);
 	}
 }
 
@@ -861,6 +859,7 @@ nautilus_navigation_window_pane_class_init (NautilusNavigationWindowPaneClass *c
 {
 	G_OBJECT_CLASS (class)->dispose = nautilus_navigation_window_pane_dispose;
 	NAUTILUS_WINDOW_PANE_CLASS (class)->show = nautilus_navigation_window_pane_show;
+	NAUTILUS_WINDOW_PANE_CLASS (class)->set_active = real_set_active;
 	NAUTILUS_WINDOW_PANE_CLASS (class)->sync_search_widgets = real_sync_search_widgets;
 	NAUTILUS_WINDOW_PANE_CLASS (class)->sync_location_widgets = real_sync_location_widgets;
 }
diff --git a/src/nautilus-navigation-window-pane.h b/src/nautilus-navigation-window-pane.h
index e6aa65b..ef3abea 100644
--- a/src/nautilus-navigation-window-pane.h
+++ b/src/nautilus-navigation-window-pane.h
@@ -88,7 +88,6 @@ void     nautilus_navigation_window_pane_show_location_bar_temporarily (Nautilus
 void     nautilus_navigation_window_pane_show_navigation_bar_temporarily (NautilusNavigationWindowPane *pane);
 void     nautilus_navigation_window_pane_always_use_location_entry (NautilusNavigationWindowPane *pane, gboolean use_entry);
 gboolean nautilus_navigation_window_pane_hide_temporary_bars (NautilusNavigationWindowPane *pane);
-void     nautilus_navigation_window_pane_set_active (NautilusNavigationWindowPane *pane, gboolean is_active);
 /* notebook */
 void     nautilus_navigation_window_pane_add_slot_in_tab (NautilusNavigationWindowPane *pane, NautilusWindowSlot *slot, NautilusWindowOpenSlotFlags flags);
 void     nautilus_navigation_window_pane_remove_page (NautilusNavigationWindowPane *pane, int page_num);
diff --git a/src/nautilus-window-pane.c b/src/nautilus-window-pane.c
index b718ec4..cd3aa49 100644
--- a/src/nautilus-window-pane.c
+++ b/src/nautilus-window-pane.c
@@ -218,6 +218,9 @@ nautilus_window_pane_set_active (NautilusWindowPane *pane, gboolean is_active)
 
 	/* notify the current slot about its activity state (so that it can e.g. modify the bg color) */
 	nautilus_window_slot_is_in_active_pane (pane->active_slot, is_active);
+
+	EEL_CALL_METHOD (NAUTILUS_WINDOW_PANE_CLASS, pane,
+			 set_active, (pane, is_active));
 }
 
 static void
diff --git a/src/nautilus-window-pane.h b/src/nautilus-window-pane.h
index 3fef33c..7a6a172 100644
--- a/src/nautilus-window-pane.h
+++ b/src/nautilus-window-pane.h
@@ -40,6 +40,8 @@ struct _NautilusWindowPaneClass {
 	GObjectClass parent_class;
 
 	void (*show) (NautilusWindowPane *pane);
+	void (*set_active) (NautilusWindowPane *pane,
+			    gboolean is_active);
 	void (*sync_search_widgets) (NautilusWindowPane *pane);
 	void (*sync_location_widgets) (NautilusWindowPane *pane);
 };
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 283ff6c..87a0e2c 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -813,19 +813,11 @@ real_set_active_pane (NautilusWindow *window, NautilusWindowPane *new_pane)
 {
 	/* make old pane inactive, and new one active.
 	 * Currently active pane may be NULL (after init). */
-	if (NAUTILUS_IS_NAVIGATION_WINDOW (window)) {
-		if (new_pane->window->details->active_pane && new_pane->window->details->active_pane != new_pane) {
-			nautilus_navigation_window_pane_set_active
-				(NAUTILUS_NAVIGATION_WINDOW_PANE (new_pane->window->details->active_pane), FALSE);
-		}
-		nautilus_navigation_window_pane_set_active (NAUTILUS_NAVIGATION_WINDOW_PANE (new_pane), TRUE);
-	}
-	else {
-		if (new_pane->window->details->active_pane && new_pane->window->details->active_pane != new_pane) {
-			nautilus_window_pane_set_active (new_pane->window->details->active_pane, FALSE);
-		}
-		nautilus_window_pane_set_active (new_pane, TRUE);
+	if (window->details->active_pane &&
+	    window->details->active_pane != new_pane) {
+		nautilus_window_pane_set_active (new_pane->window->details->active_pane, FALSE);
 	}
+	nautilus_window_pane_set_active (new_pane, TRUE);
 
 	window->details->active_pane = new_pane;
 }



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