[tracker] tracker-needle: Display fancier details in the categories view
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tracker-needle: Display fancier details in the categories view
- Date: Thu, 24 Mar 2011 23:19:22 +0000 (UTC)
commit ba3ddb79a66c8b3f532028511b83ab7b3fdddf1e
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Mar 24 11:51:12 2011 +0100
tracker-needle: Display fancier details in the categories view
src/tracker-needle/tracker-needle.vala | 2 +-
src/tracker-needle/tracker-view.vala | 36 ++++++++++++++++++++++++-------
2 files changed, 29 insertions(+), 9 deletions(-)
---
diff --git a/src/tracker-needle/tracker-needle.vala b/src/tracker-needle/tracker-needle.vala
index 340aea0..f891981 100644
--- a/src/tracker-needle/tracker-needle.vala
+++ b/src/tracker-needle/tracker-needle.vala
@@ -95,7 +95,7 @@ public class Tracker.Needle {
"nie:url(?urn)",
"tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))",
"tracker:coalesce(nco:fullname(?creator), nco:fullname(?publisher))",
- "fn:concat(nfo:pageCount(?urn), \" Pages\")",
+ "nfo:pageCount(?urn)",
"nie:url(?urn)");
categories_model.add_query (Tracker.Query.Type.MAIL,
"?urn",
diff --git a/src/tracker-needle/tracker-view.vala b/src/tracker-needle/tracker-view.vala
index 720542f..41c5ee2 100644
--- a/src/tracker-needle/tracker-view.vala
+++ b/src/tracker-needle/tracker-view.vala
@@ -245,7 +245,7 @@ public class Tracker.View : ScrolledWindow {
col.set_min_width (80);
col.set_sizing (TreeViewColumnSizing.FIXED);
col.pack_start (renderer4, true);
- col.set_cell_data_func (renderer4, detail_renderer_func);
+ col.set_cell_data_func (renderer4, category_detail_renderer_func);
tv.append_column (col);
break;
@@ -316,20 +316,40 @@ public class Tracker.View : ScrolledWindow {
cell.set ("markup", markup);
}
- private void detail_renderer_func (CellLayout cell_layout,
- CellRenderer cell,
- TreeModel tree_model,
- TreeIter iter) {
+ private void category_detail_renderer_func (CellLayout cell_layout,
+ CellRenderer cell,
+ TreeModel tree_model,
+ TreeIter iter) {
+ Tracker.Query.Type category;
string markup = null;
string detail;
renderer_background_func (cell_layout, cell, tree_model, iter);
- tree_model.get (iter, 4, out detail, -1);
+ tree_model.get (iter, 4, out detail, 7, out category, -1);
- if (detail != null) {
- markup = "<span color='grey'><small>%s</small></span>".printf (Markup.escape_text (detail));
+ if (detail == null) {
+ cell.set ("markup", null);
+ return;
}
+ switch (category) {
+ case Tracker.Query.Type.FOLDERS:
+ case Tracker.Query.Type.MAIL:
+ detail = tracker_time_format_from_iso8601 (detail);
+ break;
+ case Tracker.Query.Type.MUSIC:
+ case Tracker.Query.Type.VIDEOS:
+ detail = tracker_time_format_from_seconds (detail);
+ break;
+ case Tracker.Query.Type.DOCUMENTS:
+ detail = detail + " " + _("Pages");
+ break;
+ case Tracker.Query.Type.IMAGES:
+ detail = GLib.format_size_for_display (detail.to_int());
+ break;
+ }
+
+ markup = "<span color='grey'><small>%s</small></span>".printf (Markup.escape_text (detail));
cell.set ("markup", markup);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]