MediaTracker serializes the children rather than TrackerContainer.
authorZeeshan Ali (Khattak) <zeeshanak@src.gnome.org>
Wed, 28 Jan 2009 12:32:34 +0000 (12:32 +0000)
committerZeeshan Ali (Khattak) <zeeshanak@src.gnome.org>
Wed, 28 Jan 2009 12:32:34 +0000 (12:32 +0000)
svn path=/trunk/; revision=485

src/plugins/tracker/rygel-media-tracker.vala
src/plugins/tracker/rygel-tracker-container.vala

index f0a4fe8..7a90e90 100644 (file)
@@ -85,11 +85,19 @@ public class Rygel.MediaTracker : ContentDirectory {
         if (container == null)
             args.number_returned = 0;
         else {
-            args.number_returned =
-                container.add_children_from_db (didl_writer,
-                                                args.index,
-                                                args.requested_count,
-                                                out args.total_matches);
+            ArrayList<MediaItem> children;
+
+            children = this.get_children (args.object_id,
+                                          args.index,
+                                          args.requested_count,
+                                          out args.total_matches);
+
+            /* Iterate through all items */
+            for (int i = 0; i < children.size; i++) {
+                children[i].serialize (didl_writer);
+            }
+
+            args.number_returned = children.size;
         }
 
         if (args.number_returned > 0) {
@@ -187,5 +195,20 @@ public class Rygel.MediaTracker : ContentDirectory {
         if (container != null)
             item = container.get_item_from_db (item_id);
     }
+
+    private ArrayList<MediaObject> get_children (string   container_id,
+                                                 uint     offset,
+                                                 uint     max_count,
+                                                 out uint child_count)
+                                                 throws GLib.Error {
+        var container = this.find_container_by_id (container_id);
+        if (container == null) {
+            throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
+        }
+
+        return container.get_children_from_db (offset,
+                                               max_count,
+                                               out child_count);
+    }
 }
 
index cd16661..113c5ea 100644 (file)
@@ -114,26 +114,7 @@ public class Rygel.TrackerContainer : MediaContainer {
         return count;
     }
 
-    public uint add_children_from_db (DIDLLiteWriter didl_writer,
-                                       uint           offset,
-                                       uint           max_count,
-                                       out uint       child_count)
-                                       throws GLib.Error {
-        ArrayList<MediaItem> children;
-
-        children = this.get_children_from_db (offset,
-                                              max_count,
-                                              out child_count);
-
-        /* Iterate through all items */
-        for (int i = 0; i < children.size; i++) {
-            children[i].serialize (didl_writer);
-        }
-
-        return children.size;
-    }
-
-    private ArrayList<MediaItem> get_children_from_db (
+    public ArrayList<MediaItem> get_children_from_db (
                                             uint     offset,
                                             uint     max_count,
                                             out uint child_count)