Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-utils/gsearchtool/ChangeLog,v
retrieving revision 1.337
diff -u -p -r1.337 ChangeLog
--- ChangeLog	21 Oct 2004 23:54:33 -0000	1.337
+++ ChangeLog	23 Oct 2004 22:10:01 -0000
@@ -1,3 +1,10 @@
+2004-10-23  Dennis Cranston <dennis_cranston at yahoo com>
+
+	* gsearchtool.[ch], gsearchtool-callbacks.c:  Add logic to perform 
+	a two pass search for simple filename searches.  First use locate, 
+	then use find.  For testing, the force_quick_search key needs to be 
+	set and the disable_quick_search needs to be unset.
+
 2004-10-21  Dennis Cranston <dennis_cranston at yahoo com>
 
 	* gsearchtool.c:  Convert the look-in-folder-entry widget from a 
Index: gsearchtool.h
===================================================================
RCS file: /cvs/gnome/gnome-utils/gsearchtool/gsearchtool.h,v
retrieving revision 1.37
diff -u -p -r1.37 gsearchtool.h
--- gsearchtool.h	17 Jul 2004 00:22:26 -0000	1.37
+++ gsearchtool.h	23 Oct 2004 22:10:01 -0000
@@ -85,8 +85,10 @@ extern struct _SearchStruct {
 	gboolean		not_running_timeout;
 	gboolean		aborted;
 	gboolean		quick_mode;
+	gboolean		first_pass;
 	RunStatus        	running;
 	GHashTable              *pixbuf_hash;
+	GHashTable		*file_hash;
 } search_command;
 
 extern struct _InterfaceStruct {
@@ -131,7 +133,7 @@ struct _SearchConstraint {
 };
 
 gchar *
-build_search_command 		(void);
+build_search_command 		(gboolean first_pass);
 
 void
 spawn_search_command 		(gchar *command);
Index: gsearchtool-callbacks.c
===================================================================
RCS file: /cvs/gnome/gnome-utils/gsearchtool/gsearchtool-callbacks.c,v
retrieving revision 1.68
diff -u -p -r1.68 gsearchtool-callbacks.c
--- gsearchtool-callbacks.c	21 Oct 2004 23:54:33 -0000	1.68
+++ gsearchtool-callbacks.c	23 Oct 2004 22:10:02 -0000
@@ -159,7 +159,7 @@ click_find_cb (GtkWidget	*widget, 
 	gtk_widget_set_sensitive (interface.stop_button, FALSE);
 	gtk_widget_set_sensitive (interface.find_button, FALSE);
 
-	command = build_search_command ();
+	command = build_search_command (TRUE);
 	
 	if (search_command.lock == FALSE) {
 		spawn_search_command (command);
Index: gsearchtool.c
===================================================================
RCS file: /cvs/gnome/gnome-utils/gsearchtool/gsearchtool.c,v
retrieving revision 1.238
diff -u -p -r1.238 gsearchtool.c
--- gsearchtool.c	21 Oct 2004 23:54:33 -0000	1.238
+++ gsearchtool.c	23 Oct 2004 22:10:05 -0000
@@ -295,7 +295,7 @@ has_additional_constraints (void)
 }
 
 gchar *
-build_search_command (void)
+build_search_command (gboolean first_pass)
 {
 	GString *command;
 	gchar *file_is_named_utf8;
@@ -346,6 +346,7 @@ build_search_command (void)
 	
 	command = g_string_new ("");
 	search_command.show_hidden_files = FALSE;
+	search_command.first_pass = FALSE;
 	search_command.quick_mode = FALSE;
 	search_command.regex_string = NULL;
 	search_command.date_format_pref = NULL;
@@ -366,7 +367,7 @@ build_search_command (void)
 		disable_quick_search = gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/disable_quick_search");
 		force_quick_search = gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/force_quick_search");
 		
-		if ((disable_quick_search != TRUE) && (locate != NULL)) {
+		if ((disable_quick_search != TRUE) && (first_pass == TRUE) && (locate != NULL)) {
 		    	if ((force_quick_search == TRUE) || 
 			    ((is_path_in_home_folder (look_in_folder_locale) != TRUE) 
 			     && (is_path_in_mount_folder (look_in_folder_locale) != TRUE)
@@ -379,6 +380,7 @@ build_search_command (void)
 							locate_command_default_options,
 							look_in_folder_locale,
 							file_is_named_escaped);
+				search_command.first_pass = TRUE;
 				search_command.quick_mode = TRUE;
 		 	}
 			else {
@@ -519,6 +521,12 @@ add_file_to_search_results (const gchar 
 	gchar *utf8_base_name, *utf8_dir_name;
 	gchar *base_name, *dir_name;
 	
+	if (g_hash_table_lookup_extended (search_command.file_hash, file, NULL, NULL) == TRUE) {
+		return;
+	}
+	
+	g_hash_table_insert (search_command.file_hash, g_strdup(file), NULL);
+	
 	mime_type = gnome_vfs_get_file_mime_type (file, NULL, FALSE);
 	 
 	description = get_file_type_for_mime_type (file, mime_type);
@@ -1258,34 +1266,45 @@ handle_search_command_stdout_io (GIOChan
 
 	if (condition != G_IO_IN || broken_pipe == TRUE) { 
 		
+		g_io_channel_shutdown (ioc, TRUE, NULL);
+		
 		if (search_data->running == MAKE_IT_STOP) {
 			search_data->aborted = TRUE;
 		}
 		
-		search_data->lock = FALSE;
-		search_data->running = NOT_RUNNING;
-		search_data->not_running_timeout = TRUE;
-		g_hash_table_destroy (search_data->pixbuf_hash);
-		g_timeout_add (500, not_running_timeout_cb, NULL);
-
-		update_search_counts ();
-		stop_animation ();
-
-		gtk_window_set_default (GTK_WINDOW(interface.main_window), interface.find_button);
-		gtk_widget_set_sensitive (interface.additional_constraints, TRUE);
-		gtk_widget_set_sensitive (interface.expander, TRUE);
-		gtk_widget_set_sensitive (interface.table, TRUE);
-		gtk_widget_set_sensitive (interface.find_button, TRUE);
-		gtk_widget_hide (interface.stop_button);
-		gtk_widget_show (interface.find_button);
-
-		/* Free the gchar fields of search_command structure. */
-		g_free (search_data->look_in_folder);
-		g_free (search_data->file_is_named_pattern);
-		g_free (search_data->regex_string);
-		g_free (search_data->date_format_pref);
-
-		g_io_channel_shutdown (ioc, TRUE, NULL);
+		if (search_data->first_pass == TRUE) {
+			gchar *command;
+			
+			command = build_search_command (FALSE);
+			spawn_search_command (command);
+			
+			g_free (command);
+		}
+		else {
+			search_data->lock = FALSE;
+			search_data->running = NOT_RUNNING;
+			search_data->not_running_timeout = TRUE;
+			g_hash_table_destroy (search_data->pixbuf_hash);
+			g_hash_table_destroy (search_data->file_hash);
+			g_timeout_add (500, not_running_timeout_cb, NULL); 
+
+			update_search_counts (); 
+			stop_animation ();
+
+			gtk_window_set_default (GTK_WINDOW(interface.main_window), interface.find_button);
+			gtk_widget_set_sensitive (interface.additional_constraints, TRUE);
+			gtk_widget_set_sensitive (interface.expander, TRUE);
+			gtk_widget_set_sensitive (interface.table, TRUE);
+			gtk_widget_set_sensitive (interface.find_button, TRUE);
+			gtk_widget_hide (interface.stop_button);
+			gtk_widget_show (interface.find_button); 
+
+			/* Free the gchar fields of search_command structure. */
+			g_free (search_data->look_in_folder);
+			g_free (search_data->file_is_named_pattern);
+			g_free (search_data->regex_string);
+			g_free (search_data->date_format_pref);
+		}
 		return FALSE;
 	}
 	return TRUE;
@@ -1502,26 +1521,29 @@ spawn_search_command (gchar *command)
 		return;
 	}
 	
-	search_command.lock = TRUE;
-	search_command.aborted = FALSE;
-	search_command.running = RUNNING; 
-	search_command.pixbuf_hash = g_hash_table_new (g_str_hash, g_str_equal);
-	
-	/* Get value of nautilus date_format key */
-	search_command.date_format_pref = gsearchtool_gconf_get_string ("/apps/nautilus/preferences/date_format");
-
-	gtk_window_set_default (GTK_WINDOW(interface.main_window), interface.stop_button);
-	gtk_widget_show (interface.stop_button);
-	gtk_widget_set_sensitive (interface.stop_button, TRUE);
-	gtk_widget_hide (interface.find_button);
-	gtk_widget_set_sensitive (interface.find_button, FALSE);
-	gtk_widget_set_sensitive (interface.results, TRUE);
-	gtk_widget_set_sensitive (interface.additional_constraints, FALSE);
-	gtk_widget_set_sensitive (interface.expander, FALSE);
-	gtk_widget_set_sensitive (interface.table, FALSE);
+	if (search_command.first_pass == TRUE) {
+		search_command.lock = TRUE;
+		search_command.aborted = FALSE;
+		search_command.running = RUNNING; 
+		search_command.pixbuf_hash = g_hash_table_new (g_str_hash, g_str_equal);
+		search_command.file_hash = g_hash_table_new (g_str_hash, g_str_equal);
+	
+		/* Get value of nautilus date_format key */
+		search_command.date_format_pref = gsearchtool_gconf_get_string ("/apps/nautilus/preferences/date_format");
+
+		gtk_window_set_default (GTK_WINDOW(interface.main_window), interface.stop_button);
+		gtk_widget_show (interface.stop_button);
+		gtk_widget_set_sensitive (interface.stop_button, TRUE);
+		gtk_widget_hide (interface.find_button);
+		gtk_widget_set_sensitive (interface.find_button, FALSE);
+		gtk_widget_set_sensitive (interface.results, TRUE);
+		gtk_widget_set_sensitive (interface.additional_constraints, FALSE);
+		gtk_widget_set_sensitive (interface.expander, FALSE);
+		gtk_widget_set_sensitive (interface.table, FALSE);
 
-	gtk_tree_view_scroll_to_point (GTK_TREE_VIEW(interface.tree), 0, 0);
-	gtk_list_store_clear (GTK_LIST_STORE(interface.model));
+		gtk_tree_view_scroll_to_point (GTK_TREE_VIEW(interface.tree), 0, 0);	
+		gtk_list_store_clear (GTK_LIST_STORE(interface.model));
+	}
 	
 	ioc_stdout = g_io_channel_unix_new (child_stdout);
 	ioc_stderr = g_io_channel_unix_new (child_stderr);
