nemo r41 - trunk/broker



Author: arj
Date: Mon Jan  7 11:01:47 2008
New Revision: 41
URL: http://svn.gnome.org/viewvc/nemo?rev=41&view=rev

Log:
Fix searching for text using xesam



Modified:
   trunk/broker/Xesam.cs

Modified: trunk/broker/Xesam.cs
==============================================================================
--- trunk/broker/Xesam.cs	(original)
+++ trunk/broker/Xesam.cs	Mon Jan  7 11:01:47 2008
@@ -257,10 +257,12 @@
 "  </query> " +
 "</request> ";
 
-					System.Console.WriteLine(xml_string);
+//					System.Console.WriteLine(xml_string);
 
 					string search_id = bus_search.NewSearch(session_id, xml_string);
 
+					bool search_closed = false;
+
 					hits_added_callbacks.Add(search_id, new Callback(10, delegate(ref int count, UInt32 amount) {
 						System.Console.WriteLine("hits added: {0} - {1}", amount, session_id);
 
@@ -304,15 +306,29 @@
 
 								callback(real_results);
 								
+								System.Console.WriteLine("no more results");
+								
 								// We don't want more results
-								hits_added_callbacks.Remove(search_id);
+								if (hits_added_callbacks.ContainsKey(search_id))
+									hits_added_callbacks.Remove(search_id);
+								if (hits_done_callbacks.ContainsKey(search_id))
+									hits_done_callbacks.Remove(search_id);
+								if (!search_closed) {
+									bus_search.CloseSession(session_id);
+									search_closed = true;
+								}
 							}));
 						}
 					}));
 
 					hits_done_callbacks.Add(search_id, delegate  { 
 						System.Console.WriteLine("closing session {0}", session_id);
-						bus_search.CloseSession(session_id);
+
+						if (!search_closed) {
+							bus_search.CloseSession(session_id);
+							search_closed = true;
+						}
+
 						hits_added_callbacks.Remove(search_id);
 
 						if (!got_results) // no results



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