[rygel] tracker: get_children() now based on search()



commit bab5408235121f4e6be6b348e6a703af97370405
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Nov 16 20:15:39 2009 +0200

    tracker: get_children() now based on search()
    
    TrackerSearchContainer.get_children() now based on search() and therefore
    much simpler.

 .../tracker/rygel-tracker-search-container.vala    |   45 ++++---------------
 1 files changed, 10 insertions(+), 35 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-search-container.vala b/src/plugins/tracker/rygel-tracker-search-container.vala
index 88ff573..7221f3d 100644
--- a/src/plugins/tracker/rygel-tracker-search-container.vala
+++ b/src/plugins/tracker/rygel-tracker-search-container.vala
@@ -111,43 +111,18 @@ public class Rygel.TrackerSearchContainer : Rygel.MediaContainer {
                                         uint         max_count,
                                         Cancellable? cancellable)
                                         throws GLib.Error {
-        string[] keys = TrackerItem.get_metadata_keys ();
-
-        string query;
-
-        if (this.query_condition != "") {
-            query = "<rdfq:Condition>\n" +
-                        this.query_condition +
-                    "</rdfq:Condition>";
-        } else {
-            query = "";
-        }
-
-        var search_result = yield this.search_proxy.query (
-                                        0,
-                                        this.service,
-                                        keys,
-                                        "",
-                                        this.keywords,
-                                        query,
-                                        false,
-                                        new string[0],
-                                        false,
-                                        (int) offset,
-                                        (int) max_count);
-
-        var children = new ArrayList<MediaObject> ();
-        /* Iterate through all items */
-        for (uint i = 0; i < search_result.length[0]; i++) {
-            string path = search_result[i, 0];
-            string service = search_result[i, 1];
-            string[] metadata = this.slice_strvv_tail (search_result, i, 2);
+        var expression = new RelationalExpression ();
+        expression.op = SearchCriteriaOp.EQ;
+        expression.operand1 = "@parentID";
+        expression.operand2 = this.id;
 
-            var item = this.create_item (service, path, metadata);
-            children.add (item);
-        }
+        uint total_matches;
 
-        return children;
+        return yield this.search (expression,
+                                  offset,
+                                  max_count,
+                                  out total_matches,
+                                  cancellable);
     }
 
     public override async Gee.List<MediaObject>? search (



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