[tracker/tracker-needle-model: 25/25] needle: Make category headers stand out more.



commit 6bdde1cfab4928ad5cfd708f0dd2e708aa61fcc0
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Mar 24 12:20:04 2011 +0100

    needle: Make category headers stand out more.
    
    Also the number of hits is displayed now

 src/tracker-needle/tracker-result-store.vala |   26 +------------
 src/tracker-needle/tracker-view.vala         |   53 +++++++++++++++++++++----
 2 files changed, 45 insertions(+), 34 deletions(-)
---
diff --git a/src/tracker-needle/tracker-result-store.vala b/src/tracker-needle/tracker-result-store.vala
index 31799f5..779cbe3 100644
--- a/src/tracker-needle/tracker-result-store.vala
+++ b/src/tracker-needle/tracker-result-store.vala
@@ -528,31 +528,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
 		}
 
 		if (iter.user_data2 == null) {
-			if (column == 2) {
-				switch (cat.type) {
-				case Tracker.Query.Type.APPLICATIONS:
-					value.set_string (_("Applications"));
-					break;
-				case Tracker.Query.Type.MUSIC:
-					value.set_string (_("Music"));
-					break;
-				case Tracker.Query.Type.IMAGES:
-					value.set_string (_("Images"));
-					break;
-				case Tracker.Query.Type.VIDEOS:
-					value.set_string (_("Videos"));
-					break;
-				case Tracker.Query.Type.DOCUMENTS:
-					value.set_string (_("Documents"));
-					break;
-				case Tracker.Query.Type.MAIL:
-					value.set_string (_("Mail"));
-					break;
-				case Tracker.Query.Type.FOLDERS:
-					value.set_string (_("Folders"));
-					break;
-				}
-			} else if (column == n_columns) {
+			if (column == n_columns) {
 				Gdk.Pixbuf pixbuf;
 
 				pixbuf = cat.pixbuf;
diff --git a/src/tracker-needle/tracker-view.vala b/src/tracker-needle/tracker-view.vala
index 6a4133e..46c5bed 100644
--- a/src/tracker-needle/tracker-view.vala
+++ b/src/tracker-needle/tracker-view.vala
@@ -295,20 +295,55 @@ public class Tracker.View : ScrolledWindow {
 	                                 TreeIter     iter) {
 		string text, subtext;
 		string markup = null;
+		int n_children;
 
 		renderer_background_func (cell_layout, cell, tree_model, iter);
-		tree_model.get (iter, 2, out text, 3, out subtext, -1);
+		n_children = tree_model.iter_n_children (iter);
 
-		if (text != null) {
-			markup = Markup.escape_text (text);
-		}
+		if (n_children > 0) {
+			// Category row
+			Tracker.Query.Type type;
+			string cat = null;
+
+			tree_model.get (iter, 7, out type, -1);
+			switch (type) {
+			case Tracker.Query.Type.APPLICATIONS:
+				cat = _("Applications");
+				break;
+			case Tracker.Query.Type.MUSIC:
+				cat = _("Music");
+				break;
+			case Tracker.Query.Type.IMAGES:
+				cat = _("Images");
+				break;
+			case Tracker.Query.Type.VIDEOS:
+				cat = _("Videos");
+				break;
+			case Tracker.Query.Type.DOCUMENTS:
+				cat = _("Documents");
+				break;
+			case Tracker.Query.Type.MAIL:
+				cat = _("Mail");
+				break;
+			case Tracker.Query.Type.FOLDERS:
+				cat = _("Folders");
+				break;
+			}
 
-		if (subtext != null) {
-			markup += "\n<small><span color='grey'>%s</span></small>".printf (Markup.escape_text (subtext));
-		}
+			markup = "<b><big>%s</big></b> <small>(%d %s)</small>".printf (cat, n_children, _("Items"));
+		} else {
+			// Result row
+			tree_model.get (iter, 2, out text, 3, out subtext, -1);
+
+			if (text != null) {
+				markup = Markup.escape_text (text);
 
-		if (markup == null) {
-			markup = "<span color='grey'>%s</span>\n".printf (_("Loading..."));
+				if (subtext != null) {
+					markup += "\n<small><span color='grey'>%s</span></small>".printf (Markup.escape_text (subtext));
+				}
+			} else {
+				markup = "<span color='grey'>%s</span>\n".printf (_("Loading..."));
+			}
 		}
 
 		cell.set ("markup", markup);



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