nemo r26 - in trunk: . gtk gtk-gui



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

Log:
Don't do needless searching for text and handle the case of empty search text



Modified:
   trunk/NEWS
   trunk/gtk-gui/MainWindow.cs
   trunk/gtk/MainWindow.cs

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Mon Jan  7 10:41:22 2008
@@ -6,6 +6,8 @@
 - Fix bug that caused a crash in metadata store
 - Optimize metadata store to be faster at checking for valid files
 - Make resize work a little better by not redrawing so often
+- Don't do needless searching for text and handle the case of empty
+  search text
 
 0.1.2 alpha
 -----------

Modified: trunk/gtk-gui/MainWindow.cs
==============================================================================
--- trunk/gtk-gui/MainWindow.cs	(original)
+++ trunk/gtk-gui/MainWindow.cs	Mon Jan  7 10:41:22 2008
@@ -237,14 +237,14 @@
         this.prev_button.UseUnderline = true;
         // Container child prev_button.Gtk.Container+ContainerChild
         Gtk.Alignment w22 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
-        // Container child GtkAlignment.Gtk.Container+ContainerChild
+        // Container child GtkAlignment1.Gtk.Container+ContainerChild
         Gtk.HBox w23 = new Gtk.HBox();
         w23.Spacing = 2;
-        // Container child GtkHBox.Gtk.Container+ContainerChild
+        // Container child GtkHBox1.Gtk.Container+ContainerChild
         Gtk.Image w24 = new Gtk.Image();
         w24.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-go-back", Gtk.IconSize.Menu, 16);
         w23.Add(w24);
-        // Container child GtkHBox.Gtk.Container+ContainerChild
+        // Container child GtkHBox1.Gtk.Container+ContainerChild
         Gtk.Label w26 = new Gtk.Label();
         w26.LabelProp = "";
         w23.Add(w26);
@@ -262,14 +262,14 @@
         this.next_button.UseUnderline = true;
         // Container child next_button.Gtk.Container+ContainerChild
         Gtk.Alignment w31 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
-        // Container child GtkAlignment.Gtk.Container+ContainerChild
+        // Container child GtkAlignment2.Gtk.Container+ContainerChild
         Gtk.HBox w32 = new Gtk.HBox();
         w32.Spacing = 2;
-        // Container child GtkHBox.Gtk.Container+ContainerChild
+        // Container child GtkHBox2.Gtk.Container+ContainerChild
         Gtk.Image w33 = new Gtk.Image();
         w33.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-go-forward", Gtk.IconSize.Menu, 16);
         w32.Add(w33);
-        // Container child GtkHBox.Gtk.Container+ContainerChild
+        // Container child GtkHBox2.Gtk.Container+ContainerChild
         Gtk.Label w35 = new Gtk.Label();
         w35.LabelProp = "";
         w32.Add(w35);

Modified: trunk/gtk/MainWindow.cs
==============================================================================
--- trunk/gtk/MainWindow.cs	(original)
+++ trunk/gtk/MainWindow.cs	Mon Jan  7 10:41:22 2008
@@ -193,9 +193,25 @@
 		do_search_text(true);
 	}
 
+	string last_search_text;
+	bool search_result_valid;
+
     protected void do_search_text(bool quick_search)
     {
-    	System.Console.WriteLine("searching using text");
+    	if (search_input.Text == "" || search_input.Text == null)
+    	{
+			Singleton<OverlayTracker>.Instance.hide_all_and_die();
+    		search_result_valid = false;
+    		return;
+    	}
+    	
+    	if (last_search_text == search_input.Text)
+    		return;
+    
+    	last_search_text = search_input.Text;
+    	search_result_valid = true;
+
+    	System.Console.WriteLine("searching using text: {0}", search_input.Text);
     
 		broker.SearchForText(search_input.Text, quick_search, 
 			Helpers.RunInMainThread<List<Tuple<string[], File>>>(delegate (List<Tuple<string[], File>> search_results) {  
@@ -291,6 +307,9 @@
 
 	protected void on_search_text_results(List<Tuple<string[], File>> search_results, string search_text)
 	{
+		if (!search_result_valid)
+			return;
+	
 		System.Console.WriteLine("got search text results {0}", search_results.Count);
 
 		List<Nemo.Item> items = new List<Nemo.Item>();



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