rygel r487 - trunk/src/plugins/tracker
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r487 - trunk/src/plugins/tracker
- Date: Wed, 28 Jan 2009 12:32:43 +0000 (UTC)
Author: zeeshanak
Date: Wed Jan 28 12:32:43 2009
New Revision: 487
URL: http://svn.gnome.org/viewvc/rygel?rev=487&view=rev
Log:
Separate out search and serialization of root container in MediaTracker.
Modified:
trunk/src/plugins/tracker/rygel-media-tracker.vala
Modified: trunk/src/plugins/tracker/rygel-media-tracker.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-media-tracker.vala (original)
+++ trunk/src/plugins/tracker/rygel-media-tracker.vala Wed Jan 28 12:32:43 2009
@@ -118,10 +118,14 @@
public override void add_root_children_metadata (DIDLLiteWriter didl_writer,
BrowseArgs args)
throws GLib.Error {
- foreach (TrackerContainer container in this.containers)
- container.serialize (didl_writer);
+ var children = get_root_children (args.index,
+ args.requested_count,
+ out args.total_matches);
+ foreach (var child in children) {
+ child.serialize (didl_writer);
+ }
- args.total_matches = args.number_returned = this.containers.size;
+ args.number_returned = children.size;
args.update_id = uint32.MAX;
}
@@ -208,5 +212,34 @@
return media_object;
}
+
+ private ArrayList<MediaObject> get_root_children (uint offset,
+ uint max_count,
+ out uint child_count)
+ throws GLib.Error {
+ child_count = this.containers.size;
+
+ ArrayList<MediaObject> children;
+
+ if (max_count == 0 && offset == 0) {
+ children = this.containers;
+ } else if (offset >= child_count) {
+ throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
+ } else {
+ // Make sure we don't go beyond the limits
+ max_count %= (child_count - offset);
+
+ if (max_count == 0) {
+ max_count = child_count - offset;
+ }
+
+ children = new ArrayList<MediaObject> ();
+ for (int i = 0; i < max_count; i++) {
+ children.add (this.containers.get (i + (int) offset));
+ }
+ }
+
+ return children;
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]