[nautilus] window-pane: toggle the search button when showing a saved search



commit 58e544c260349a01242f40769e61e9b7098069fd
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Mar 21 11:33:46 2011 -0400

    window-pane: toggle the search button when showing a saved search
    
    https://bugzilla.gnome.org/show_bug.cgi?id=645027

 src/nautilus-window-pane.c |   27 +++++++++++++++++++++++----
 src/nautilus-window-slot.c |    1 +
 2 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/src/nautilus-window-pane.c b/src/nautilus-window-pane.c
index 68452fc..ecc6c25 100644
--- a/src/nautilus-window-pane.c
+++ b/src/nautilus-window-pane.c
@@ -877,6 +877,22 @@ nautilus_window_pane_sync_location_widgets (NautilusWindowPane *pane)
 	}
 }
 
+static void
+toggle_toolbar_search_button (NautilusWindowPane *pane)
+{
+	GtkActionGroup *group;
+	GtkAction *action;
+
+	group = pane->action_group;
+	action = gtk_action_group_get_action (group, NAUTILUS_ACTION_SEARCH);
+
+	g_signal_handlers_block_by_func (action,
+					 action_show_hide_search_callback, pane);
+	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+	g_signal_handlers_unblock_by_func (action,
+					   action_show_hide_search_callback, pane);	
+}
+
 void
 nautilus_window_pane_sync_search_widgets (NautilusWindowPane *pane)
 {
@@ -892,10 +908,13 @@ nautilus_window_pane_sync_search_widgets (NautilusWindowPane *pane)
 		search_directory = NAUTILUS_SEARCH_DIRECTORY (directory);
 	}
 
-	if (search_directory != NULL &&
-	    !nautilus_search_directory_is_saved_search (search_directory)) {
-		nautilus_toolbar_set_show_search_bar (NAUTILUS_TOOLBAR (pane->tool_bar), TRUE);
-		pane->temporary_search_bar = FALSE;
+	if (search_directory != NULL) {
+		if (!nautilus_search_directory_is_saved_search (search_directory)) {
+			nautilus_toolbar_set_show_search_bar (NAUTILUS_TOOLBAR (pane->tool_bar), TRUE);
+			pane->temporary_search_bar = FALSE;
+		} else {
+			toggle_toolbar_search_button (pane);
+		}
 	} else {
 		search_bar_cancel_callback (pane->search_bar, pane);
 	}
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 9649cfa..b2cd696 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -88,6 +88,7 @@ real_update_query_editor (NautilusWindowSlot *slot)
 		if (nautilus_search_directory_is_saved_search (search_directory)) {
 			query_editor = nautilus_query_editor_new (TRUE,
 								  nautilus_search_directory_is_indexed (search_directory));
+			nautilus_window_pane_sync_search_widgets (slot->pane);
 		} else {
 			query_editor = nautilus_query_editor_new_with_bar (FALSE,
 									   nautilus_search_directory_is_indexed (search_directory),



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