[tracker] tracker-needle: List folders in first/initial view



commit 1457d8b6aaac071197d77db8cfa8f0c578b48a6d
Author: Martyn Russell <martyn lanedo com>
Date:   Sun Jan 16 15:19:18 2011 +0000

    tracker-needle: List folders in first/initial view
    
    Fixes GB#639556, Tracker does not find folders

 src/tracker-needle/tracker-needle.vala |    9 ++++++++-
 src/tracker-needle/tracker-query.vala  |   25 ++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/src/tracker-needle/tracker-needle.vala b/src/tracker-needle/tracker-needle.vala
index 1be7057..6b6f917 100644
--- a/src/tracker-needle/tracker-needle.vala
+++ b/src/tracker-needle/tracker-needle.vala
@@ -362,7 +362,8 @@ public class Tracker.Needle {
 			Tracker.Query.Type.VIDEOS,
 			Tracker.Query.Type.DOCUMENTS,
 			Tracker.Query.Type.MAIL,
-			Tracker.Query.Type.IMAGES
+			Tracker.Query.Type.IMAGES,
+			Tracker.Query.Type.FOLDERS
 		};
 		Tracker.Query query = new Tracker.Query ();
 
@@ -447,6 +448,12 @@ public class Tracker.Needle {
 						}
 						column2 = tracker_time_format_from_iso8601 (cursor.get_string (4));
 						break;
+					case Tracker.Query.Type.FOLDERS:
+						if (count == 0) {
+							pixbuf_small = tracker_pixbuf_new_from_name (theme, "folder", size_medium);
+						}
+						column2 = tracker_time_format_from_iso8601 (cursor.get_string (4));
+						break;
 
 					default:
 						break;
diff --git a/src/tracker-needle/tracker-query.vala b/src/tracker-needle/tracker-query.vala
index f270b97..cc9e23d 100644
--- a/src/tracker-needle/tracker-query.vala
+++ b/src/tracker-needle/tracker-query.vala
@@ -30,7 +30,8 @@ public class Tracker.Query {
 		VIDEOS,
 		DOCUMENTS,
 		MAIL,
-		CALENDAR
+		CALENDAR,
+		FOLDERS
 	}
 
 	public string criteria { get; set; }
@@ -212,6 +213,28 @@ public class Tracker.Query {
 			        ";
 			break;
 
+		case Type.FOLDERS:
+			query = @"
+			        SELECT
+			          ?urn
+			          nie:url(?urn)
+			          tracker:coalesce(nie:title(?urn), nfo:fileName(?urn), \"$unknown\")
+			          tracker:coalesce(nie:url(?parent), \"\")
+			          nfo:fileLastModified(?urn)
+			          ?tooltip
+			        WHERE {
+			          ?urn a nfo:Folder ;
+			          nie:url ?tooltip ;
+			          fts:match \"$criteria_escaped\" .
+			          OPTIONAL {
+			            ?urn nfo:belongsToContainer ?parent .
+			          }
+			        }
+			        ORDER BY DESC(fts:rank(?urn)) DESC(nie:title(?urn))
+			        OFFSET $offset LIMIT $limit
+			        ";
+			break;
+
 		default:
 			assert_not_reached ();
 		}



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