[nautilus] slot: simplify new search directory creation



commit 15be7f1f433fe08a05df050b422f72d27e24c42c
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Sep 17 13:12:26 2012 -0400

    slot: simplify new search directory creation
    
    There's no need to first open the location and then set the query, as
    that causes another reload we can avoid.

 src/nautilus-window-slot.c |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 9370f14..b57db28 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -106,24 +106,13 @@ sync_search_directory (NautilusWindowSlot *slot)
 	nautilus_directory_unref (directory);
 }
 
-static gboolean
-sync_search_location_cb (NautilusWindow *window,
-			 GError *error,
-			 gpointer user_data)
-{
-	NautilusWindowSlot *slot = user_data;
-	if (error == NULL) {
-		sync_search_directory (slot);
-	}
-	return (error == NULL);
-}
-
 static void
 create_new_search (NautilusWindowSlot *slot)
 {
 	char *uri;
 	NautilusDirectory *directory;
 	GFile *location;
+	NautilusQuery *query;
 
 	uri = nautilus_search_directory_generate_new_uri ();
 	location = g_file_new_for_uri (uri);
@@ -131,9 +120,13 @@ create_new_search (NautilusWindowSlot *slot)
 	directory = nautilus_directory_get (location);
 	g_assert (NAUTILUS_IS_SEARCH_DIRECTORY (directory));
 
-	nautilus_window_slot_open_location_full (slot, location, 0, NULL, sync_search_location_cb, slot);
+	query = nautilus_query_editor_get_query (slot->query_editor);
+	nautilus_search_directory_set_query (NAUTILUS_SEARCH_DIRECTORY (directory), query);
+
+	nautilus_window_slot_open_location (slot, location, 0);
 
 	nautilus_directory_unref (directory);
+	g_object_unref (query);
 	g_object_unref (location);
 	g_free (uri);
 }



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