Index: widgets/rb-library-browser.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/widgets/rb-library-browser.c,v
retrieving revision 1.4
diff -u -r1.4 rb-library-browser.c
--- widgets/rb-library-browser.c	2 Mar 2006 06:50:08 -0000	1.4
+++ widgets/rb-library-browser.c	2 Mar 2006 13:20:04 -0000
@@ -500,6 +500,12 @@
 	RBLibraryBrowserPrivate *priv = RB_LIBRARY_BROWSER_GET_PRIVATE (widget);
 	RBPropertyView *view;
 	RhythmDBPropertyModel *prop_model;
+	GList *saved_selections; 
+
+	/* save the current selections */
+	saved_selections = g_hash_table_lookup (priv->selections,
+						(gpointer)browser_properties[0].type);
+	saved_selections = rb_string_list_copy (saved_selections);  
 	
 	if (priv->model)
 		g_object_unref (G_OBJECT (priv->model));
@@ -512,4 +518,9 @@
 	g_object_set (G_OBJECT (prop_model), "query-model", priv->model, NULL);
 
 	rebuild_child_model (widget, 0);
+
+	/* restore the old selection */
+	rb_property_view_set_selection (view, saved_selections);
+	rb_list_deep_free (saved_selections); 
+
 }
Index: sources/rb-library-source.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/sources/rb-library-source.c,v
retrieving revision 1.152
diff -u -r1.152 rb-library-source.c
--- sources/rb-library-source.c	28 Feb 2006 10:31:22 -0000	1.152
+++ sources/rb-library-source.c	2 Mar 2006 13:20:04 -0000
@@ -112,6 +112,7 @@
 
 void rb_library_source_browser_views_activated_cb (GtkWidget *widget,
 						 RBLibrarySource *source);
+static GPtrArray * construct_query_without_browser (RBLibrarySource *source);
 static GPtrArray * construct_query_from_selection (RBLibrarySource *source);
 static void songs_view_drag_data_received_cb (GtkWidget *widget,
 					      GdkDragContext *dc,
@@ -623,6 +624,8 @@
 impl_search (RBSource *asource, const char *search_text)
 {
 	RBLibrarySource *source = RB_LIBRARY_SOURCE (asource);
+	RhythmDBQueryModel *query_model;
+	GPtrArray *query; 
 
 	if (search_text == NULL && source->priv->search_text == NULL)
 		return;
@@ -640,6 +643,18 @@
 	source->priv->search_text = g_strdup (search_text);
 	rb_library_source_do_query (source);
 
+	/* construct a query model based only on search text */
+	query_model = rhythmdb_query_model_new_empty (source->priv->db);
+	query = construct_query_without_browser (source); 
+	rhythmdb_do_full_query_parsed (source->priv->db, 
+				       RHYTHMDB_QUERY_RESULTS (query_model), 
+				       query);
+	rhythmdb_query_free (query); 
+
+	/* use query model to constrain browser */
+	rb_library_browser_set_model(source->priv->browser, 
+				     query_model);  
+	
 	rb_source_notify_filter_changed (RB_SOURCE (source));
 }
 
@@ -1089,11 +1104,10 @@
 }
 
 static GPtrArray *
-construct_query_from_selection (RBLibrarySource *source)
+construct_query_without_browser (RBLibrarySource *source)
 {
 	GPtrArray *query;
 	RhythmDBEntryType entry_type;
-	GPtrArray *browser_query;
 
 	g_object_get (G_OBJECT (source), "entry-type", &entry_type, NULL);
 	query = rhythmdb_query_parse (source->priv->db,
@@ -1103,7 +1117,7 @@
 				      RHYTHMDB_QUERY_END);
 
 	/* select where type="song"
-	 */
+`	 */
 
 	if (source->priv->search_text) {
 		GPtrArray *subquery = rhythmdb_query_parse (source->priv->db,
@@ -1121,7 +1135,16 @@
 		 */
 	}
 
-	
+	return query;
+}
+
+static GPtrArray *
+construct_query_from_selection (RBLibrarySource *source)
+{
+	GPtrArray *query;
+	GPtrArray *browser_query;
+
+	query = construct_query_without_browser (source);
 	browser_query = rb_library_browser_construct_query (source->priv->browser);
 	rhythmdb_query_concatenate (query, browser_query);
 	rhythmdb_query_free (browser_query);
