From ae5969237294c159edca85fcdae6d05464087af2 Mon Sep 17 00:00:00 2001 From: "Zeeshan Ali (Khattak)" Date: Wed, 28 Jan 2009 12:35:04 +0000 Subject: [PATCH] Remove child_count param of Container.get_children(). The user of this API already have access to the container and therefore it's child_count field. svn path=/trunk/; revision=522 --- src/plugins/dvb/rygel-dvb-channel-group.vala | 11 ++++------- src/plugins/dvb/rygel-dvb-root-container.vala | 11 ++++------- src/plugins/test/rygel-test-root-container.vala | 11 ++++------- src/plugins/tracker/rygel-tracker-container.vala | 6 ++---- src/plugins/tracker/rygel-tracker-root-container.vala | 11 ++++------- src/rygel/rygel-content-directory.vala | 10 ++++------ src/rygel/rygel-media-container.vala | 7 ++----- 7 files changed, 24 insertions(+), 43 deletions(-) diff --git a/src/plugins/dvb/rygel-dvb-channel-group.vala b/src/plugins/dvb/rygel-dvb-channel-group.vala index c5346ac..d2cd500 100644 --- a/src/plugins/dvb/rygel-dvb-channel-group.vala +++ b/src/plugins/dvb/rygel-dvb-channel-group.vala @@ -62,18 +62,15 @@ public class Rygel.DVBChannelGroup : MediaContainer { this.fetch_channels (); } - public override Gee.List? get_children (uint offset, - uint max_count, - out uint child_count) + public override Gee.List? get_children (uint offset, + uint max_count) throws GLib.Error { - child_count = this.channels.size; - if (max_count == 0) { - max_count = child_count; + max_count = this.child_count; } uint stop = offset + max_count; - stop = stop.clamp (0, child_count); + stop = stop.clamp (0, this.child_count); return this.channels.slice ((int) offset, (int) stop); } diff --git a/src/plugins/dvb/rygel-dvb-root-container.vala b/src/plugins/dvb/rygel-dvb-root-container.vala index a4cfbd9..d3fc2db 100644 --- a/src/plugins/dvb/rygel-dvb-root-container.vala +++ b/src/plugins/dvb/rygel-dvb-root-container.vala @@ -100,19 +100,16 @@ public class Rygel.DVBRootContainer : MediaContainer { this.child_count = this.groups.size; } - public override Gee.List? get_children (uint offset, - uint max_count, - out uint child_count) + public override Gee.List? get_children (uint offset, + uint max_count) throws GLib.Error { - child_count = this.groups.size; - if (max_count == 0) { - max_count = child_count; + max_count = this.child_count; } uint stop = offset + max_count; - stop = stop.clamp (0, child_count); + stop = stop.clamp (0, this.child_count); return this.groups.slice ((int) offset, (int) stop); } diff --git a/src/plugins/test/rygel-test-root-container.vala b/src/plugins/test/rygel-test-root-container.vala index b640e48..102147c 100644 --- a/src/plugins/test/rygel-test-root-container.vala +++ b/src/plugins/test/rygel-test-root-container.vala @@ -56,19 +56,16 @@ public class Rygel.TestRootContainer : MediaContainer { this.child_count = this.items.size; } - public override Gee.List? get_children (uint offset, - uint max_count, - out uint child_count) + public override Gee.List? get_children (uint offset, + uint max_count) throws GLib.Error { - child_count = this.items.size; - if (max_count == 0) { - max_count = child_count; + max_count = this.child_count; } uint stop = offset + max_count; - stop = stop.clamp (0, child_count); + stop = stop.clamp (0, this.child_count); return this.items.slice ((int) offset, (int) stop); } diff --git a/src/plugins/tracker/rygel-tracker-container.vala b/src/plugins/tracker/rygel-tracker-container.vala index d215f03..25ae575 100644 --- a/src/plugins/tracker/rygel-tracker-container.vala +++ b/src/plugins/tracker/rygel-tracker-container.vala @@ -111,12 +111,10 @@ public class Rygel.TrackerContainer : MediaContainer { return count; } - public override Gee.List? get_children (uint offset, - uint max_count, - out uint child_count) + public override Gee.List? get_children (uint offset, + uint max_count) throws GLib.Error { ArrayList children = new ArrayList (); - child_count = this.get_children_count (); string[] child_paths = TrackerContainer.files.GetByServiceType (0, diff --git a/src/plugins/tracker/rygel-tracker-root-container.vala b/src/plugins/tracker/rygel-tracker-root-container.vala index cb9bd95..36c9837 100644 --- a/src/plugins/tracker/rygel-tracker-root-container.vala +++ b/src/plugins/tracker/rygel-tracker-root-container.vala @@ -64,19 +64,16 @@ public class Rygel.TrackerRootContainer : MediaContainer { this.child_count = this.containers.size; } - public override Gee.List? get_children (uint offset, - uint max_count, - out uint child_count) + public override Gee.List? get_children (uint offset, + uint max_count) throws GLib.Error { - child_count = this.containers.size; - if (max_count == 0) { - max_count = child_count; + max_count = this.child_count; } uint stop = offset + max_count; - stop = stop.clamp (0, child_count); + stop = stop.clamp (0, this.child_count); return this.containers.slice ((int) offset, (int) stop); } diff --git a/src/rygel/rygel-content-directory.vala b/src/rygel/rygel-content-directory.vala index ef8ce55..32b6646 100644 --- a/src/rygel/rygel-content-directory.vala +++ b/src/rygel/rygel-content-directory.vala @@ -361,9 +361,8 @@ public class Rygel.ContentDirectory: Service { } var container = (MediaContainer) media_object; - var children = container.get_children (offset, - max_count, - out child_count); + child_count = container.child_count; + var children = container.get_children (offset, max_count); if (children == null) { throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object"); } @@ -384,9 +383,8 @@ public class Rygel.ContentDirectory: Service { uint max_count, out uint child_count) throws GLib.Error { - var children = this.root_container.get_children (offset, - max_count, - out child_count); + child_count = this.root_container.child_count; + var children = this.root_container.get_children (offset, max_count); if (children == null) { throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object"); } diff --git a/src/rygel/rygel-media-container.vala b/src/rygel/rygel-media-container.vala index 2ce5310..0dea776 100644 --- a/src/rygel/rygel-media-container.vala +++ b/src/rygel/rygel-media-container.vala @@ -78,14 +78,11 @@ public class Rygel.MediaContainer : MediaObject { * * @param offet zero-based index of the first item to return * @param max_count maximum number of objects to return - * @param child_count placeholder for actual number of objects directly - * under this container * * return A list of media objects. */ - public virtual Gee.List? get_children (uint offset, - uint max_count, - out uint child_count) + public virtual Gee.List? get_children (uint offset, + uint max_count) throws Error { return null; } -- 2.7.4