[tracker] tracker-needle: Add support for bookmarks



commit c59e6dbb246929a93912ffd0f0886589e1a08f94
Author: Adrien Bustany <abustany gnome org>
Date:   Mon Apr 11 23:11:57 2011 +0300

    tracker-needle: Add support for bookmarks

 src/tracker-needle/tracker-needle.vala       |    8 ++++++++
 src/tracker-needle/tracker-query.vala        |   10 +++++++++-
 src/tracker-needle/tracker-result-store.vala |    3 +++
 src/tracker-needle/tracker-view.vala         |    4 ++++
 4 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/src/tracker-needle/tracker-needle.vala b/src/tracker-needle/tracker-needle.vala
index 712c7bd..a78b62a 100644
--- a/src/tracker-needle/tracker-needle.vala
+++ b/src/tracker-needle/tracker-needle.vala
@@ -122,6 +122,14 @@ public class Tracker.Needle {
 		                            "nie:url(?parent)",
 		                            "nfo:fileLastModified(?urn)",
 		                            "?tooltip");
+		categories_model.add_query (Tracker.Query.Type.BOOKMARKS,
+		                            Tracker.Query.Match.FTS,
+		                            "?urn",
+		                            "nie:url(?urn)",
+		                            "tracker:coalesce(nie:title(?urn), nie:url(?urn))",
+		                            "nie:url(?urn)",
+		                            "nie:contentLastModified(?urn)",
+		                            "?tooltip");
 
 		// Files model
 		files_model = new ResultStore (7);
diff --git a/src/tracker-needle/tracker-query.vala b/src/tracker-needle/tracker-query.vala
index 3259396..fd7ccfc 100644
--- a/src/tracker-needle/tracker-query.vala
+++ b/src/tracker-needle/tracker-query.vala
@@ -30,7 +30,8 @@ public class Tracker.Query {
 		DOCUMENTS,
 		MAIL,
 		CALENDAR,
-		FOLDERS
+		FOLDERS,
+		BOOKMARKS
 	}
 
 	public enum Match {
@@ -146,6 +147,13 @@ public class Tracker.Query {
 		  OPTIONAL {
 		    ?urn nfo:belongsToContainer ?parent .
 		  }
+		}",
+
+		// BOOKMARKS
+		"WHERE {
+		  ?urn a nfo:Bookmark ;
+		       nie:url ?tooltip .
+		  %s
 		}"
 	};
 
diff --git a/src/tracker-needle/tracker-result-store.vala b/src/tracker-needle/tracker-result-store.vala
index 480bba3..e1f4b13 100644
--- a/src/tracker-needle/tracker-result-store.vala
+++ b/src/tracker-needle/tracker-result-store.vala
@@ -559,6 +559,9 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
 					case Tracker.Query.Type.FOLDERS:
 						pixbuf = tracker_pixbuf_new_from_name (theme, "folder", size);
 						break;
+					case Tracker.Query.Type.BOOKMARKS:
+						pixbuf = tracker_pixbuf_new_from_name (theme, "web-browser", size);
+						break;
 					}
 				}
 
diff --git a/src/tracker-needle/tracker-view.vala b/src/tracker-needle/tracker-view.vala
index 1309640..4718599 100644
--- a/src/tracker-needle/tracker-view.vala
+++ b/src/tracker-needle/tracker-view.vala
@@ -343,6 +343,9 @@ public class Tracker.View : ScrolledWindow {
 			case Tracker.Query.Type.FOLDERS:
 				cat = _("Folders");
 				break;
+			case Tracker.Query.Type.BOOKMARKS:
+				cat = _("Bookmarks");
+				break;
 			}
 
 			markup = "<b><big>%s</big></b> <small>(%d %s)</small>".printf (cat, n_children, _("Items"));
@@ -415,6 +418,7 @@ public class Tracker.View : ScrolledWindow {
 		switch (category) {
 		case Tracker.Query.Type.FOLDERS:
 		case Tracker.Query.Type.MAIL:
+		case Tracker.Query.Type.BOOKMARKS:
 			detail = tracker_time_format_from_iso8601 (detail);
 			break;
 		case Tracker.Query.Type.MUSIC:



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