nemo r27 - in trunk: broker gtk



Author: arj
Date: Mon Jan  7 10:42:05 2008
New Revision: 27
URL: http://svn.gnome.org/viewvc/nemo?rev=27&view=rev

Log:
Fix Quiting the application



Modified:
   trunk/broker/Broker.cs
   trunk/broker/Xesam.cs
   trunk/gtk/Tray.cs

Modified: trunk/broker/Broker.cs
==============================================================================
--- trunk/broker/Broker.cs	(original)
+++ trunk/broker/Broker.cs	Mon Jan  7 10:42:05 2008
@@ -27,10 +27,6 @@
 	    
 			cur_search_id = 0;
 
-			callbacks = new List<VoidFunction>();
-
-			own_thread_pool();
-
 			// metadata store
 			if (meta == null) {
 				meta = new MetadataStore(Singleton<Configuration>.Instance.data.watch_dir);
@@ -40,7 +36,7 @@
 
 		public abstract void stop();
 
-	    protected void stop_broker() 
+	    protected void stop_broker()
 	    {
 	        meta.stop();
 	    }
@@ -144,25 +140,6 @@
 			meta.trigger_type_labels_changed();
 	    }
 
-		private void own_thread_pool()
-		{
-			ThreadPool.QueueUserWorkItem(delegate(Object stateInfo) {
-				while (true) {
-					System.Threading.Monitor.Enter(callback_lock);
-					System.Threading.Monitor.Wait(callback_lock);
-					if (callbacks.Count > 0) {
-						callbacks[0]();
-						callbacks.RemoveAt(0);
-					}
-					System.Threading.Monitor.Exit(callback_lock);
-				}
-			});
-		}
-
-		// own threadpool implementation because the one in mono is broken
-	    private static object callback_lock = new Object();
-		private List<VoidFunction> callbacks;
-
 	    public void add_label(long parent_id, string label)
 	    {
 	        MetaLabel new_label = new MetaLabel();

Modified: trunk/broker/Xesam.cs
==============================================================================
--- trunk/broker/Xesam.cs	(original)
+++ trunk/broker/Xesam.cs	Mon Jan  7 10:42:05 2008
@@ -64,8 +64,6 @@
 
 			hits_added_callbacks = new Dictionary<string, Callback>();
 			hits_done_callbacks = new Dictionary<string, VoidFunction>();
-
-//	        start_iterating();
 		}
 
 		private class Callback
@@ -106,6 +104,11 @@
 		private void hits_done_handler(string session_id)
 		{
 			System.Console.WriteLine("is done {0}", session_id);
+
+			// for text search, we only want the first results so we need this hack 
+			if (!hits_added_callbacks.ContainsKey(session_id))
+				return;
+
 			VoidFunction callback = hits_done_callbacks[session_id];
 			callback();
 			hits_done_callbacks.Remove(session_id);
@@ -118,33 +121,9 @@
 		
 		string session_id;
 
-#if false
-	    public void start_iterating() 
-	    {
-	        if (iterating) // re-entrance protection
-	            return;
-
-			ThreadPool.QueueUserWorkItem(delegate(Object stateInfo) {
-	            while (!finished) {
-	            	System.Console.WriteLine("iterating");
-	                con.Iterate();
-	            	System.Console.WriteLine("iterating done");
-	            }
-            	System.Console.WriteLine("finished iterating");
-			});
-
-	        iterating = true;
-	    }
-#endif
-
 	    public override void stop() 
 	    {
-#if false
-	    	stop_broker();
-	        finished = true;
-	        bus_search.CloseSession(session_id); // final iteration
-	        iterating = false;
-#endif
+			stop_broker();
 	    }
 
 	 	public override void get_metadata(List<string> all_filenames, Dictionary<string, VoidFunction<string[]>> callbacks)

Modified: trunk/gtk/Tray.cs
==============================================================================
--- trunk/gtk/Tray.cs	(original)
+++ trunk/gtk/Tray.cs	Mon Jan  7 10:42:05 2008
@@ -125,6 +125,7 @@
 
 			Singleton<Configuration>.Instance.save_configuration();
 			main_quit();
+
 			Application.Quit();
 		}
 	}



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