beagle r4722 - trunk/beagle/search/Beagle.Search



Author: dbera
Date: Fri Apr 18 21:52:23 2008
New Revision: 4722
URL: http://svn.gnome.org/viewvc/beagle?rev=4722&view=rev

Log:
Replace a Hashtable by an enum ... right, such magic can only be seen @dBera.


Modified:
   trunk/beagle/search/Beagle.Search/SearchWindow.cs

Modified: trunk/beagle/search/Beagle.Search/SearchWindow.cs
==============================================================================
--- trunk/beagle/search/Beagle.Search/SearchWindow.cs	(original)
+++ trunk/beagle/search/Beagle.Search/SearchWindow.cs	Fri Apr 18 21:52:23 2008
@@ -47,7 +47,7 @@
 		private Beagle.Search.ScopeType scope = ScopeType.Everything;
 		private Beagle.Search.SortType sort = SortType.Modified;
 		private Beagle.Search.TypeFilter filter = null;
-		private Dictionary<QueryDomain, bool> domains = null; // FIXME Overkill
+		private QueryDomain domain = QueryDomain.Local;
 
 		// Whether we should grab focus from the text entry
 		private bool grab_focus = false;
@@ -180,9 +180,6 @@
 				pages.CurrentPage = pages.PageNum (quicktips);
 			}
 
-			domains = new Dictionary<QueryDomain, bool> (3);
-			domains [QueryDomain.Local] = true;
-
 			StartCheckingIndexingStatus ();
 		}
 
@@ -247,14 +244,7 @@
 				TotalMatches = 0;
 
 				current_query = new Query ();
-
-				// FIXME This is ugly!
-				if (! domains.ContainsKey (QueryDomain.Local) || ! domains [QueryDomain.Local] )
-					current_query.RemoveDomain (QueryDomain.Local);
-				if (domains.ContainsKey (QueryDomain.Neighborhood) && domains [QueryDomain.Neighborhood])
-					current_query.AddDomain (QueryDomain.Neighborhood);
-				if (domains.ContainsKey (QueryDomain.Global) && domains [QueryDomain.Global])
-					current_query.AddDomain (QueryDomain.Global);
+				current_query.QueryDomain = domain;
 
 				current_query.AddText (query);
 				current_query.HitsAddedEvent += OnHitsAdded;
@@ -376,7 +366,10 @@
 		
 		private void OnDomainChanged (QueryDomain domain, bool active)
 		{
-			domains [domain] = active;
+			if (active)
+				this.domain |= domain;
+			else
+				this.domain &= ~domain;
 
 			// FIXME: Most likely refire the query.
 		}



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