[tracker] tracker-needle: Improve "icons" or "images" category to allow filtering by all or title



commit ab75a1099128d39ecd55c09f1f471df574ed581d
Author: Martyn Russell <martyn lanedo com>
Date:   Sat Apr 2 21:12:09 2011 +0100

    tracker-needle: Improve "icons" or "images" category to allow filtering by all or title
    
    Now there is a new matching mechanism, "all" which doesn't require
    search criteria and will display all images in a nice grid like fashion.
    
    The other is to display images with the criteria in the title/filename.

 src/tracker-needle/tracker-needle.ui         |   18 ++++-
 src/tracker-needle/tracker-needle.vala       |  105 +++++++++++++++++++----
 src/tracker-needle/tracker-query.vala        |  116 +++++++++++++++++++-------
 src/tracker-needle/tracker-result-store.vala |   22 +++--
 src/tracker-needle/tracker-view.vala         |   14 +++-
 5 files changed, 212 insertions(+), 63 deletions(-)
---
diff --git a/src/tracker-needle/tracker-needle.ui b/src/tracker-needle/tracker-needle.ui
index 7abba00..0edd39a 100644
--- a/src/tracker-needle/tracker-needle.ui
+++ b/src/tracker-needle/tracker-needle.ui
@@ -93,6 +93,18 @@
               </packing>
             </child>
             <child>
+              <object class="GtkRadioToolButton" id="toolbutton_find_in_all">
+                <property name="use_underline">True</property>
+                <property name="stock_id">gtk-select-all</property>
+                <property name="active">True</property>
+                <property name="group">toolbutton_find_in_titles</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkSeparatorToolItem" id="&lt;separator&gt;">
                 <property name="visible">True</property>
               </object>
@@ -102,7 +114,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkToolItem" id="toolbutton_search_label">
+              <object class="GtkToolItem" id="toolitem_search_label">
                 <property name="visible">True</property>
                 <property name="is_important">True</property>
                 <child>
@@ -119,7 +131,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkToolItem" id="toolbutton_search_entry">
+              <object class="GtkToolItem" id="toolitem_search_entry">
                 <property name="visible">True</property>
                 <property name="is_important">True</property>
                 <child>
@@ -135,8 +147,8 @@
                         <property name="has_focus">True</property>
                         <property name="model">liststore_search</property>
                         <property name="text_column">0</property>
-                        <accelerator key="f" signal="grab-focus" modifiers="GDK_CONTROL_MASK"/>
                         <accelerator key="s" signal="grab-focus" modifiers="GDK_CONTROL_MASK"/>
+                        <accelerator key="f" signal="grab-focus" modifiers="GDK_CONTROL_MASK"/>
                       </object>
                     </child>
                   </object>
diff --git a/src/tracker-needle/tracker-needle.vala b/src/tracker-needle/tracker-needle.vala
index 3174c42..e15c840 100644
--- a/src/tracker-needle/tracker-needle.vala
+++ b/src/tracker-needle/tracker-needle.vala
@@ -35,6 +35,8 @@ public class Tracker.Needle {
 	private SeparatorToolItem separator_secondary;
 	private ToggleToolButton find_in_contents;
 	private ToggleToolButton find_in_titles;
+	private ToggleToolButton find_in_all;
+	private ToolItem search_entry;
 	private ComboBoxEntry search_list;
 	private Entry search;
 	private Spinner spinner;
@@ -51,17 +53,20 @@ public class Tracker.Needle {
 	private int size_small = 0;
 	private int size_medium = 0;
 	private int size_big = 0;
-	static bool current_find_in = true;
+	static bool current_find_in_filelist = true;
+	static bool current_find_in_icons = true;
 
 	private ResultStore categories_model;
 	private ResultStore files_model;
 	private ResultStore files_in_title_model;
 	private ResultStore images_model;
+	private ResultStore images_in_title_model;
 
 	private void create_models () {
 		// Categories model
 		categories_model = new ResultStore (6);
 		categories_model.add_query (Tracker.Query.Type.APPLICATIONS,
+		                            Tracker.Query.Match.FTS,
 		                            "?urn",
 		                            "tracker:coalesce(nfo:softwareCmdLine(?urn), ?urn)",
 		                            "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))",
@@ -70,6 +75,7 @@ public class Tracker.Needle {
 		                            "\"\"");
 
 		categories_model.add_query (Tracker.Query.Type.IMAGES,
+		                            Tracker.Query.Match.FTS,
 		                            "?urn",
 		                            "nie:url(?urn)",
 		                            "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))",
@@ -77,6 +83,7 @@ public class Tracker.Needle {
 		                            "nfo:fileSize(?urn)",
 		                            "nie:url(?urn)");
 		categories_model.add_query (Tracker.Query.Type.MUSIC,
+		                            Tracker.Query.Match.FTS_INDIRECT,
 		                            "?urn",
 		                            "nie:url(?urn)",
 		                            "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))",
@@ -84,6 +91,7 @@ public class Tracker.Needle {
 		                            "nfo:duration(?urn)",
 		                            "nie:url(?urn)");
 		categories_model.add_query (Tracker.Query.Type.VIDEOS,
+		                            Tracker.Query.Match.FTS,
 		                            "?urn",
 		                            "nie:url(?urn)",
 		                            "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))",
@@ -91,6 +99,7 @@ public class Tracker.Needle {
 		                            "nfo:duration(?urn)",
 		                            "nie:url(?urn)");
 		categories_model.add_query (Tracker.Query.Type.DOCUMENTS,
+		                            Tracker.Query.Match.FTS,
 		                            "?urn",
 		                            "nie:url(?urn)",
 		                            "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))",
@@ -98,6 +107,7 @@ public class Tracker.Needle {
 		                            "nfo:pageCount(?urn)",
 		                            "nie:url(?urn)");
 		categories_model.add_query (Tracker.Query.Type.MAIL,
+		                            Tracker.Query.Match.FTS,
 		                            "?urn",
 		                            "nie:url(?urn)",
 		                            "tracker:coalesce(nco:fullname(?sender), nco:nickname(?sender), nco:emailAddress(?sender))",
@@ -105,6 +115,7 @@ public class Tracker.Needle {
 		                            "nmo:receivedDate(?urn)",
 		                            "fn:concat(\"To: \", tracker:coalesce(nco:fullname(?to), nco:nickname(?to), nco:emailAddress(?to)))");
 		categories_model.add_query (Tracker.Query.Type.FOLDERS,
+		                            Tracker.Query.Match.FTS,
 		                            "?urn",
 		                            "nie:url(?urn)",
 		                            "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))",
@@ -115,6 +126,7 @@ public class Tracker.Needle {
 		// Files model
 		files_model = new ResultStore (7);
 		files_model.add_query (Tracker.Query.Type.ALL,
+		                       Tracker.Query.Match.FTS,
 		                       "?urn",
 		                       "nie:url(?urn)",
 		                       "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))",
@@ -123,9 +135,9 @@ public class Tracker.Needle {
 		                       "nfo:fileLastModified(?urn)",
 		                       "nie:url(?urn)");
 
-		// Files model, search in titles
 		files_in_title_model = new ResultStore (7);
-		files_in_title_model.add_query (Tracker.Query.Type.ALL_ONLY_IN_TITLES,
+		files_in_title_model.add_query (Tracker.Query.Type.ALL,
+		                                Tracker.Query.Match.TITLES,
 		                                "?urn",
 		                                "nie:url(?urn)",
 		                                "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))",
@@ -136,14 +148,27 @@ public class Tracker.Needle {
 
 		// Images model
 		images_model = new ResultStore (6);
-		images_model.icon_size = 48;
+		images_model.icon_size = 128;
 		images_model.add_query (Tracker.Query.Type.IMAGES,
+		                        Tracker.Query.Match.NONE,
 		                        "?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_in_title_model = new ResultStore (6);
+		images_in_title_model.icon_size = 128;
+		images_in_title_model.add_query (Tracker.Query.Type.IMAGES,
+		                                 Tracker.Query.Match.TITLES,
+		                                 "?urn",
+		                                 "nie:url(?urn)",
+		                                 "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))",
+		                                 "nfo:fileSize(?urn)",
+		                                 "nfo:fileLastModified(?urn)",
+		                                 "nie:url(?urn)");
 	}
 
 	public Needle () {
@@ -233,6 +258,10 @@ public class Tracker.Needle {
 		find_in_titles = builder.get_object ("toolbutton_find_in_titles") as ToggleToolButton;
 		find_in_titles.toggled.connect (find_in_toggled);
 
+		find_in_all = builder.get_object ("toolbutton_find_in_all") as ToggleToolButton;
+		find_in_all.toggled.connect (find_in_toggled);
+
+		search_entry = builder.get_object ("toolitem_search_entry") as ToolItem;
 		search_list = builder.get_object ("comboboxentry_search") as ComboBoxEntry;
 		search = search_list.get_child () as Entry;
 		search.changed.connect (search_changed);
@@ -269,7 +298,7 @@ public class Tracker.Needle {
 		treeview.row_activated.connect (view_row_selected);
 		view.pack_start (sw_filelist, true, true, 0);
 
-		sw_icons = new Tracker.View (Tracker.View.Display.FILE_ICONS, images_model);
+		sw_icons = new Tracker.View (Tracker.View.Display.FILE_ICONS, null);
 		iconview = (IconView) sw_icons.get_child ();
 		iconview.item_activated.connect (icon_item_selected);
 		view.pack_start (sw_icons, true, true, 0);
@@ -372,8 +401,11 @@ public class Tracker.Needle {
 		ResultStore store = null;
 
 		if (criteria.length < 3) {
-			search_finished (store);
-			return false;
+			// Allow empty search criteria for finding all
+			if (!view_icons.active || !find_in_all.active) {
+				search_finished (store);
+				return false;
+			}
 		}
 
 		search_history_find_or_insert (criteria, true);
@@ -383,7 +415,14 @@ public class Tracker.Needle {
 
 		if (view_icons.active) {
 			sw_icons.show ();
-			store = images_model;
+
+			if (find_in_all.active) {
+				store = images_model;
+			} else {
+				store = images_in_title_model;
+			}
+
+			sw_icons.store = store;
 		} else {
 			sw_icons.hide ();
 		}
@@ -417,15 +456,25 @@ public class Tracker.Needle {
 	}
 
 	private void view_toggled () {
-		bool show_find_in;
-
 		if (!view_icons.active &&
 			!view_filelist.active &&
 			!view_categories.active) {
 				return;
 		}
 
-		show_find_in = view_filelist.active || view_icons.active;
+		if (view_categories.active || view_filelist.active) {
+			if (current_find_in_filelist) {
+				find_in_contents.active = true;
+			} else {
+				find_in_titles.active = true;
+			}
+		} else if (view_icons.active) {
+			if (current_find_in_icons) {
+				find_in_titles.active = true;
+			} else {
+				find_in_all.active = true;
+			}
+		}
 
 		// Show no results Window when switching
 		sw_noresults.show ();
@@ -434,28 +483,48 @@ public class Tracker.Needle {
 		sw_categories.hide ();
 
 		// Show/Hide secondary widgets
-		separator_secondary.visible = show_find_in;
-		find_in_contents.visible = show_find_in;
-		find_in_titles.visible = show_find_in;
+		separator_secondary.visible = view_filelist.active || view_icons.active;
+		find_in_contents.visible = view_filelist.active;
+		find_in_titles.visible = view_filelist.active || view_icons.active;
+		find_in_all.visible = view_icons.active; // only show this in one view
 
 		search_run ();
 		//current_view = rows;
 	}
 
 	private void find_in_toggled () {
-		if (current_find_in == find_in_contents.active) {
-			return;
+		if (!find_in_contents.active &&
+		    !find_in_titles.active &&
+		    !find_in_all.active) {
+		    return;
 		}
 
 		if (find_in_contents.active) {
 			debug ("Find in toggled to 'contents'");
+
+			search_entry.sensitive = true;
+
 			search_run ();
-		} else {
+		} else if (find_in_titles.active) {
 			debug ("Find in toggled to 'titles'");
+
+			search_entry.sensitive = true;
+
+			search_run ();
+		} else if (find_in_all.active) {
+			debug ("Find in toggled to 'all'");
+
+			// We hide the entry in this case, which is special
+			search_entry.sensitive = false;
+
 			search_run ();
 		}
 
-		current_find_in = find_in_contents.active;
+		if (view_filelist.active) {
+			current_find_in_filelist = find_in_contents.active;
+		} else if (view_icons.active) {
+			current_find_in_icons = find_in_titles.active;
+		}
 	}
 
 	private void launch_selected (TreeModel model, TreePath path, int col) {
diff --git a/src/tracker-needle/tracker-query.vala b/src/tracker-needle/tracker-query.vala
index fcf9863..3259396 100644
--- a/src/tracker-needle/tracker-query.vala
+++ b/src/tracker-needle/tracker-query.vala
@@ -22,7 +22,6 @@ using Tracker.Sparql;
 public class Tracker.Query {
 	public enum Type {
 		ALL,
-		ALL_ONLY_IN_TITLES,
 		CONTACTS,
 		APPLICATIONS,
 		MUSIC,
@@ -34,20 +33,45 @@ public class Tracker.Query {
 		FOLDERS
 	}
 
-	private string [] where_clauses = {
-		// ALL
-		"WHERE {
-		  ?urn fts:match \"%s\" ;
-		  nfo:belongsToContainer ?parent ;
-		  tracker:available true .
-		}",
+	public enum Match {
+		NONE,
+		FTS,
+		FTS_INDIRECT,
+		TITLES,
+		TITLES_INDIRECT
+	}
+
+	private string [] match_clauses = {
+		// NONE (i.e. just show all)
+		"",
+
+		// FTS
+		"?urn fts:match \"%s\"",
+
+		// FTS_INDIRECT (with sub-matching)
+		"?match fts:match \"%s\"",
+
+		// TITLES
+		"FILTER (fn:contains (fn:lower-case (nfo:fileName(?urn)), \"%s\"))",
+
+		// TITLES INDIRECT (with sub-matching)
+		"FILTER (fn:contains (fn:lower-case (nie:title (?match), \"%s\"))"
+	};
 
 		// ALL_ONLY_IN_TITLES
+//		"WHERE {
+//		  ?urn a nfo:FileDataObject ;
+//		  nfo:belongsToContainer ?parent ;
+//		  tracker:available true .
+//		  FILTER (fn:contains (fn:lower-case (nfo:fileName(?urn)), \"%s\"))
+//		}",
+
+	private string [] where_clauses = {
+		// ALL
 		"WHERE {
-		  ?urn a nfo:FileDataObject ;
-		  nfo:belongsToContainer ?parent ;
+		  %s .
+		  ?urn nfo:belongsToContainer ?parent ;
 		  tracker:available true .
-		  FILTER (fn:contains (fn:lower-case (nfo:fileName(?urn)), \"%s\"))
 		}",
 
 		// CONTACTS
@@ -55,8 +79,8 @@ public class Tracker.Query {
 
 		// APPLICATIONS
 		"WHERE {
-		  ?urn a nfo:Software ;
-		         fts:match \"%s\"
+		  ?urn a nfo:Software .
+		  %s
 		}",
 
 		// MUSIC
@@ -70,7 +94,7 @@ public class Tracker.Query {
 		    ?match a nfo:Audio
 		    FILTER (?urn = ?match)
 		  }
-		  ?match fts:match \"%s\" .
+		  %s .
 		  ?urn nmm:performer [ nmm:artistName ?performer ] ;
 		       nmm:musicAlbum [ nie:title ?album ] ;
 		       nie:url ?tooltip
@@ -79,22 +103,22 @@ public class Tracker.Query {
 		// IMAGES
 		"WHERE {
 		  ?urn a nfo:Image ;
-		         nie:url ?tooltip ;
-		         fts:match \"%s\"
+		         nie:url ?tooltip .
+		  %s
 		}",
 
 		// VIDEOS
 		"WHERE {
 		  ?urn a nfo:Video ;
-		         nie:url ?tooltip ;
-		         fts:match \"%s\" .
+		         nie:url ?tooltip .
+		  %s
 		}",
 
 		// DOCUMENTS
 		"WHERE {
 		  ?urn a nfo:Document ;
-		         nie:url ?tooltip ;
-		         fts:match \"%s\" .
+		         nie:url ?tooltip .
+		  %s
 		  OPTIONAL {
 		    ?urn nco:creator ?creator .
 		  }
@@ -107,8 +131,8 @@ public class Tracker.Query {
 		"WHERE {
 		  ?urn a nmo:Email ;
 		         nmo:from ?sender ;
-		         nmo:to ?to ;
-		         fts:match \"%s\" .
+		         nmo:to ?to .
+		  %s
 		}",
 
 		// CALENDAR
@@ -117,8 +141,8 @@ public class Tracker.Query {
 		// FOLDERS
 		"WHERE {
 		  ?urn a nfo:Folder ;
-		         nie:url ?tooltip ;
-		         fts:match \"%s\" .
+		         nie:url ?tooltip .
+		  %s
 		  OPTIONAL {
 		    ?urn nfo:belongsToContainer ?parent .
 		  }
@@ -140,18 +164,45 @@ public class Tracker.Query {
 		}
 	}
 
-	public async uint get_count_async (Type query_type, Cancellable? cancellable = null) throws IOError
+	private bool check_query_and_match_type (Type query_type, Match match_type) {
+		if (query_type != Type.IMAGES && match_type == Match.NONE) {
+			critical ("You can not use a non-IMAGES query (%d) with NONE matching", query_type);
+			return false;
+		}
+
+		if (query_type == Type.MUSIC && !(match_type == Match.FTS_INDIRECT ||
+		                                  match_type == Match.TITLES_INDIRECT)) {
+			critical ("You can not use a MUSIC query with match TITLES or FTS, INDIRECT required");
+			return false;
+		}
+
+		if (query_type != Type.MUSIC && !(match_type == Match.NONE ||
+		                                  match_type == Match.FTS ||
+		                                  match_type == Match.TITLES)) {
+			critical ("You can not use a non-MUSIC query (%d) with INDIRECT matching (%d)", query_type, match_type);
+			return false;
+		}
+
+		return true;
+	}
+
+	public async uint get_count_async (Type query_type, Match match_type, Cancellable? cancellable = null) throws IOError
 	requires (connection != null) {
 		Sparql.Cursor cursor = null;
 
-		if (criteria == null || criteria.length < 1) {
+		if (!check_query_and_match_type (query_type, match_type)) {
+			return 0;
+		}
+
+		if (match_type != Match.NONE && (criteria == null || criteria.length < 1)) {
 			warning ("Criteria was NULL or an empty string, no query performed");
 			return 0;
 		}
 
 		string criteria_escaped = Tracker.Sparql.escape_string (criteria);
+		string match = match_clauses[match_type].printf (criteria_escaped);
 
-		query = "SELECT count(?urn) " + where_clauses[query_type].printf (criteria_escaped);
+		query = "SELECT count(?urn) " + where_clauses[query_type].printf (match);
 
 		try {
 			cursor = yield connection.query_async (query, null);
@@ -163,11 +214,15 @@ public class Tracker.Query {
 		return (uint) cursor.get_integer (0);
 	}
 
-	public async Sparql.Cursor? perform_async (Type query_type, string [] ?args, Cancellable? cancellable = null) throws IOError
+	public async Sparql.Cursor? perform_async (Type query_type, Match match_type, string [] ?args, Cancellable? cancellable = null) throws IOError
 	requires (connection != null) {
 		Sparql.Cursor cursor = null;
 
-		if (criteria == null || criteria.length < 1) {
+		if (!check_query_and_match_type (query_type, match_type)) {
+			return null;
+		}
+
+		if (match_type != Match.NONE && (criteria == null || criteria.length < 1)) {
 			warning ("Criteria was NULL or an empty string, no query performed");
 			return null;
 		}
@@ -178,8 +233,9 @@ public class Tracker.Query {
 		}
 
 		string criteria_escaped = Tracker.Sparql.escape_string (criteria);
+		string match = match_clauses[match_type].printf (criteria_escaped);
 
-		query = "SELECT " + string.joinv (" ", args) + " " + where_clauses[query_type].printf (criteria_escaped);
+		query = "SELECT " + string.joinv (" ", args) + " " + where_clauses[query_type].printf (match);
 		query += @" OFFSET $offset LIMIT $limit";
 
 		debug ("Running query: '%s'", query);
diff --git a/src/tracker-needle/tracker-result-store.vala b/src/tracker-needle/tracker-result-store.vala
index afc0cfc..1d5d0b8 100644
--- a/src/tracker-needle/tracker-result-store.vala
+++ b/src/tracker-needle/tracker-result-store.vala
@@ -37,6 +37,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
 
 	private struct QueryData {
 		Tracker.Query.Type type;
+		Tracker.Query.Match match;
 		string [] args;
 	}
 
@@ -89,7 +90,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
 			query.limit = 100;
 			query.offset = op.offset;
 
-			cursor = yield query.perform_async (op.node.query.type, op.node.query.args, cancellable);
+			cursor = yield query.perform_async (op.node.query.type, op.node.query.match, op.node.query.args, cancellable);
 
 			for (i = op.offset; i < op.offset + 100; i++) {
 				ResultNode *result;
@@ -196,7 +197,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
 			Tracker.Query query = new Tracker.Query ();
 			query.criteria = _search_term;
 
-			count = yield query.get_count_async (query_data.type, cancellable);
+			count = yield query.get_count_async (query_data.type, query_data.match, cancellable);
 		} catch (GLib.IOError ie) {
 			warning ("Could not get count: %s\n", ie.message);
 			return;
@@ -452,9 +453,6 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
 	private async void fetch_thumbnail (TreeIter iter) {
 		GLib.File file;
 		GLib.FileInfo info;
-		GLib.Icon icon;
-		TreePath path;
-		Gtk.IconInfo icon_info;
 		ResultNode *result;
 		string thumb_path;
 		Gdk.Pixbuf pixbuf = null;
@@ -480,6 +478,9 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
 			if (thumb_path != null) {
 				pixbuf = new Gdk.Pixbuf.from_file_at_size (thumb_path, icon_size, icon_size);
 			} else {
+				GLib.Icon icon;
+				Gtk.IconInfo icon_info;
+
 				icon = (GLib.Icon) info.get_attribute_object ("standard::icon");
 
 				if (icon == null) {
@@ -487,7 +488,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
 				}
 
 				var theme = IconTheme.get_for_screen (Gdk.Screen.get_default ());
-				icon_info = theme.lookup_by_gicon (icon, icon_size, 0);
+				icon_info = theme.lookup_by_gicon (icon, icon_size, 0); // Gtk.IconLookupFlags.FORCE_SIZE
 
 				if (icon_info == null) {
 					return;
@@ -500,6 +501,8 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
 		}
 
 		if (pixbuf != null) {
+			TreePath path;
+
 			result.pixbuf = pixbuf;
 			path = get_path (iter);
 			row_changed (path, iter);
@@ -530,7 +533,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
 
 				if (pixbuf == null) {
 					var theme = IconTheme.get_for_screen (Gdk.Screen.get_default ());
-					int size = 24;
+					int size = icon_size;
 
 					switch (cat.type) {
 					case Tracker.Query.Type.APPLICATIONS:
@@ -767,10 +770,10 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
 
 		n_columns = _n_columns;
 		timestamp = 1;
-		icon_size = 24;
+		icon_size = 24; // Default value, overridden by tracker-needle.vala
 	}
 
-	public void add_query (Tracker.Query.Type type, ...) {
+	public void add_query (Tracker.Query.Type type, Tracker.Query.Match match, ...) {
 		var l = va_list ();
 		string str = null;
 		string [] args = null;
@@ -791,6 +794,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
 
 		query_data = QueryData ();
 		query_data.type = type;
+		query_data.match = match;
 		query_data.args = args;
 
 		queries += query_data;
diff --git a/src/tracker-needle/tracker-view.vala b/src/tracker-needle/tracker-view.vala
index 7f06177..686377e 100644
--- a/src/tracker-needle/tracker-view.vala
+++ b/src/tracker-needle/tracker-view.vala
@@ -49,7 +49,11 @@ public class Tracker.View : ScrolledWindow {
 				_store.row_changed.connect (store_row_changed);
 			}
 
-			((TreeView )view).model = _store;
+			if (display != Display.FILE_ICONS) {
+				((TreeView) view).model = _store;
+			} else {
+				((IconView) view).model = _store;
+			}
 		}
 	}
 
@@ -129,10 +133,14 @@ public class Tracker.View : ScrolledWindow {
 			IconView iv = (IconView) view;
 
 			iv.set_model (store);
-			iv.set_item_width (96);
+			iv.set_item_width (128);
+			iv.set_item_padding (1);
+			iv.set_row_spacing (2);
+			iv.set_column_spacing (2);
 			iv.set_selection_mode (SelectionMode.SINGLE);
 			iv.set_pixbuf_column (6);
-			iv.set_text_column (2);
+			iv.set_text_column (-1); // was 2, -1 is for no text
+			iv.set_tooltip_column (5);
 
 			break;
 		}



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