commit edcdbc524f7d86bcda020f6cc7270ac5b4c17ad6
Author: Adrien Dorsaz <adrien@adorsaz.ch>
Date:   Sat Mar 14 22:54:12 2015 +0100

    tracker-needle: add logic to do insensitive tag search

diff --git a/src/tracker-needle/tracker-needle.vala b/src/tracker-needle/tracker-needle.vala
index d2037b2..ee57915 100644
--- a/src/tracker-needle/tracker-needle.vala
+++ b/src/tracker-needle/tracker-needle.vala
@@ -38,6 +38,10 @@ public class Tracker.Needle {
 	private ToggleToolButton find_in_titles;
 	private ToggleToolButton find_in_tags;
 	private ToggleToolButton find_in_all;
+	private SeparatorToolItem separator_third;
+	private ToolItem sensitivity_label_toolitem;
+	private Switch sensitivity_switch;
+	private ToolItem sensitivity_switch_toolitem;
 	private ToolItem search_entry;
 	private ComboBox search_list;
 	private Entry search;
@@ -65,6 +69,7 @@ public class Tracker.Needle {
 	private ResultStore categories_model;
 	private ResultStore files_model;
 	private ResultStore files_in_tags_model;
+	private ResultStore files_in_tags_nocase_model;
 	private ResultStore files_in_title_model;
 	private ResultStore images_model;
 	private ResultStore images_in_title_model;
@@ -186,6 +191,19 @@ public class Tracker.Needle {
 		                       "nfo:fileLastModified(?urn)",
 		                       "nie:url(?urn)");
 
+		files_in_tags_nocase_model = new ResultStore(7);
+		files_in_tags_nocase_model.limit = limit;
+		files_in_tags_nocase_model.result_overflow.connect (result_overflow);
+		files_in_tags_nocase_model.add_query (Tracker.Query.Type.ALL,
+		                       Tracker.Query.Match.TAGS_ONLY_INSENSITIVE,
+		                       "?urn",
+		                       "nie:url(?urn)",
+		                       "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))",
+		                       "nie:url(?urn)",
+		                       "nfo:fileSize(?urn)",
+		                       "nfo:fileLastModified(?urn)",
+		                       "nie:url(?urn)");
+
 		// Images model
 		images_model = new ResultStore (6);
 		images_model.limit = limit;
@@ -333,6 +351,16 @@ public class Tracker.Needle {
 		find_in_all.get_accessible().set_name("Find in All");
 		find_in_all.get_child().get_accessible().set_name("Find in All");
 
+		separator_third = builder.get_object("separator_third") as SeparatorToolItem;
+
+		sensitivity_label_toolitem = builder.get_object("toolitem_sensitivity_label") as ToolItem;
+
+		sensitivity_switch = builder.get_object ("switch_sensitivity") as Switch;
+		sensitivity_switch.notify["active"].connect (find_in_toggled);
+		sensitivity_switch.get_accessible().set_name("Switch sensitivity query");
+
+		sensitivity_switch_toolitem = builder.get_object("toolitem_sensitivity_switch") as ToolItem;
+
 		search_entry = builder.get_object ("toolitem_search_entry") as ToolItem;
 		search_entry.get_accessible().set_name("Search Entry");
 
@@ -545,8 +573,14 @@ public class Tracker.Needle {
 			current_view = sw_filelist;
 
 			if (find_in_tags.active) {
-				store = files_in_tags_model;
+				if(sensitivity_switch.active){
+					store = files_in_tags_model;
+				} else {
+					store = files_in_tags_nocase_model;
+				}
+
 				store.search_tags = search_tags();
+
 				debug("Tags to look for: %s", string.joinv("; ", store.search_tags.data));
 			} else if (find_in_contents.active) {
 				store = files_model;
@@ -561,7 +595,7 @@ public class Tracker.Needle {
 
 		if (store != null) {
 			// We can set tags to search by but we don't anymore
-			// except if user want explecitly search by tags only.
+			// except if user want explicitly search by tags only.
 			if (!find_in_tags.active) {
 				store.search_tags = null;
 			}
@@ -605,6 +639,11 @@ public class Tracker.Needle {
 		find_in_tags.visible = view_filelist.active;
 		find_in_all.visible = view_icons.active; // only show this in one view
 
+		// Show/Hide third widgets
+		separator_third.visible = find_in_tags.active;
+		sensitivity_label_toolitem.visible = find_in_tags.active;
+		sensitivity_switch_toolitem.visible = find_in_tags.active;
+
 		search_run ();
 		//current_view = rows;
 	}
@@ -652,6 +691,11 @@ public class Tracker.Needle {
 		} else if (view_icons.active) {
 			current_find_in_icons = find_in_titles.active;
 		}
+
+		// Show sensitivity switch only if find_in_tags is active
+		separator_third.visible = find_in_tags.active;
+		sensitivity_label_toolitem.visible = find_in_tags.active;
+		sensitivity_switch_toolitem.visible = find_in_tags.active;
 	}
 
 	private void view_row_activated (TreeView view, TreePath path, TreeViewColumn column) {
