[nautilus] Improve search button handling in split view mode



commit df7048157403efefb560c5d1075f04088af3048b
Author: Holger Berndt <berndth gmx de>
Date:   Sat Dec 5 19:09:37 2009 +0100

    Improve search button handling in split view mode
    
    This commit fixes issues that were introduced in
    merge commit e92c336df90df012746d08d9af8121edc38b0f3c
    Now the escape key during temporary search toggles the search key off again,
    as does changing active pane during temporary searches.

 src/nautilus-navigation-window-pane.c |   19 ++++++++++++++++++-
 src/nautilus-navigation-window.c      |   12 ++++++------
 src/nautilus-navigation-window.h      |    5 +++++
 3 files changed, 29 insertions(+), 7 deletions(-)
---
diff --git a/src/nautilus-navigation-window-pane.c b/src/nautilus-navigation-window-pane.c
index 306c601..cc71e80 100644
--- a/src/nautilus-navigation-window-pane.c
+++ b/src/nautilus-navigation-window-pane.c
@@ -616,11 +616,15 @@ nautilus_navigation_window_pane_hide_temporary_bars (NautilusNavigationWindowPan
 		nautilus_directory_unref (directory);
 	}
 	if (pane->temporary_search_bar) {
+		NautilusNavigationWindow *window;
+
 		if (!eel_preferences_get_boolean (NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY)) {
 			nautilus_navigation_window_pane_set_bar_mode (pane, NAUTILUS_BAR_PATH);
 		} else {
 			nautilus_navigation_window_pane_set_bar_mode (pane, NAUTILUS_BAR_NAVIGATION);
 		}
+		window = NAUTILUS_NAVIGATION_WINDOW (NAUTILUS_WINDOW_PANE (pane)->window);
+		nautilus_navigation_window_set_search_button (window, FALSE);
 		pane->temporary_search_bar = FALSE;
 		success = TRUE;
 	}
@@ -766,7 +770,9 @@ void
 nautilus_navigation_window_pane_set_bar_mode (NautilusNavigationWindowPane *pane,
 					      NautilusBarMode mode)
 {
-    gboolean use_entry;
+	gboolean use_entry;
+	GtkWidget *focus_widget;
+	NautilusNavigationWindow *window;
 
 	switch (mode) {
 
@@ -801,6 +807,17 @@ nautilus_navigation_window_pane_set_bar_mode (NautilusNavigationWindowPane *pane
 						   G_CALLBACK (location_button_toggled_cb),
 						   pane);
 	}
+
+	window = NAUTILUS_NAVIGATION_WINDOW (NAUTILUS_WINDOW_PANE (pane)->window);
+	focus_widget = gtk_window_get_focus (GTK_WINDOW (window));
+	if (focus_widget != NULL && !nautilus_navigation_window_is_in_temporary_navigation_bar (focus_widget, window) &&
+				    !nautilus_navigation_window_is_in_temporary_search_bar (focus_widget, window)) {
+		if (mode == NAUTILUS_BAR_NAVIGATION || mode == NAUTILUS_BAR_PATH) {
+			nautilus_navigation_window_set_search_button (window, FALSE);
+		} else {
+			nautilus_navigation_window_set_search_button (window, TRUE);
+		}
+	}
 }
 
 gboolean
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index e9f147f..fb4d864 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -297,8 +297,8 @@ nautilus_navigation_window_unset_focus_widget (NautilusNavigationWindow *window)
 	}
 }
 
-static inline gboolean
-is_in_temporary_navigation_bar (GtkWidget *widget,
+inline gboolean
+nautilus_navigation_window_is_in_temporary_navigation_bar (GtkWidget *widget,
 				NautilusNavigationWindow *window)
 {
 	GList *walk;
@@ -313,8 +313,8 @@ is_in_temporary_navigation_bar (GtkWidget *widget,
 	return is_in_any;
 }
 
-static inline gboolean
-is_in_temporary_search_bar (GtkWidget *widget,
+inline gboolean
+nautilus_navigation_window_is_in_temporary_search_bar (GtkWidget *widget,
 			    NautilusNavigationWindow *window)
 {
 	GList *walk;
@@ -339,8 +339,8 @@ remember_focus_widget (NautilusNavigationWindow *window)
 
 	focus_widget = gtk_window_get_focus (GTK_WINDOW (window));
 	if (focus_widget != NULL &&
-	    !is_in_temporary_navigation_bar (focus_widget, navigation_window) &&
-	    !is_in_temporary_search_bar (focus_widget, navigation_window)) {
+	    !nautilus_navigation_window_is_in_temporary_navigation_bar (focus_widget, navigation_window) &&
+	    !nautilus_navigation_window_is_in_temporary_search_bar (focus_widget, navigation_window)) {
 		nautilus_navigation_window_unset_focus_widget (navigation_window);
 
 		navigation_window->details->last_focus_widget = focus_widget;
diff --git a/src/nautilus-navigation-window.h b/src/nautilus-navigation-window.h
index 643d38f..863e91d 100644
--- a/src/nautilus-navigation-window.h
+++ b/src/nautilus-navigation-window.h
@@ -110,4 +110,9 @@ void     nautilus_navigation_window_split_view_on        (NautilusNavigationWind
 void     nautilus_navigation_window_split_view_off       (NautilusNavigationWindow *window);
 gboolean nautilus_navigation_window_split_view_showing   (NautilusNavigationWindow *window);
 
+inline gboolean nautilus_navigation_window_is_in_temporary_navigation_bar (GtkWidget *widget,
+				NautilusNavigationWindow *window);
+inline gboolean nautilus_navigation_window_is_in_temporary_search_bar (GtkWidget *widget,
+			    NautilusNavigationWindow *window);
+
 #endif



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