rygel r522 - in trunk/src: plugins/dvb plugins/test plugins/tracker rygel



Author: zeeshanak
Date: Wed Jan 28 12:35:04 2009
New Revision: 522
URL: http://svn.gnome.org/viewvc/rygel?rev=522&view=rev

Log:
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.

Modified:
   trunk/src/plugins/dvb/rygel-dvb-channel-group.vala
   trunk/src/plugins/dvb/rygel-dvb-root-container.vala
   trunk/src/plugins/test/rygel-test-root-container.vala
   trunk/src/plugins/tracker/rygel-tracker-container.vala
   trunk/src/plugins/tracker/rygel-tracker-root-container.vala
   trunk/src/rygel/rygel-content-directory.vala
   trunk/src/rygel/rygel-media-container.vala

Modified: trunk/src/plugins/dvb/rygel-dvb-channel-group.vala
==============================================================================
--- trunk/src/plugins/dvb/rygel-dvb-channel-group.vala	(original)
+++ trunk/src/plugins/dvb/rygel-dvb-channel-group.vala	Wed Jan 28 12:35:04 2009
@@ -62,18 +62,15 @@
         this.fetch_channels ();
     }
 
-    public override Gee.List<MediaObject>? get_children (uint     offset,
-                                                         uint     max_count,
-                                                         out uint child_count)
+    public override Gee.List<MediaObject>? 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);
     }

Modified: trunk/src/plugins/dvb/rygel-dvb-root-container.vala
==============================================================================
--- trunk/src/plugins/dvb/rygel-dvb-root-container.vala	(original)
+++ trunk/src/plugins/dvb/rygel-dvb-root-container.vala	Wed Jan 28 12:35:04 2009
@@ -100,19 +100,16 @@
         this.child_count = this.groups.size;
     }
 
-    public override Gee.List<MediaObject>? get_children (uint     offset,
-                                                         uint     max_count,
-                                                         out uint child_count)
+    public override Gee.List<MediaObject>? 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);
     }
 

Modified: trunk/src/plugins/test/rygel-test-root-container.vala
==============================================================================
--- trunk/src/plugins/test/rygel-test-root-container.vala	(original)
+++ trunk/src/plugins/test/rygel-test-root-container.vala	Wed Jan 28 12:35:04 2009
@@ -56,19 +56,16 @@
         this.child_count = this.items.size;
     }
 
-    public override Gee.List<MediaObject>? get_children (uint     offset,
-                                                         uint     max_count,
-                                                         out uint child_count)
+    public override Gee.List<MediaObject>? 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);
     }
 

Modified: trunk/src/plugins/tracker/rygel-tracker-container.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-container.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-container.vala	Wed Jan 28 12:35:04 2009
@@ -111,12 +111,10 @@
         return count;
     }
 
-    public override Gee.List<MediaObject>? get_children (uint     offset,
-                                                         uint     max_count,
-                                                         out uint child_count)
+    public override Gee.List<MediaObject>? get_children (uint offset,
+                                                         uint max_count)
                                                          throws GLib.Error {
         ArrayList<MediaObject> children = new ArrayList<MediaObject> ();
-        child_count = this.get_children_count ();
 
         string[] child_paths =
                 TrackerContainer.files.GetByServiceType (0,

Modified: trunk/src/plugins/tracker/rygel-tracker-root-container.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-root-container.vala	(original)
+++ trunk/src/plugins/tracker/rygel-tracker-root-container.vala	Wed Jan 28 12:35:04 2009
@@ -64,19 +64,16 @@
         this.child_count = this.containers.size;
     }
 
-    public override Gee.List<MediaObject>? get_children (uint     offset,
-                                                         uint     max_count,
-                                                         out uint child_count)
+    public override Gee.List<MediaObject>? 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);
     }
 

Modified: trunk/src/rygel/rygel-content-directory.vala
==============================================================================
--- trunk/src/rygel/rygel-content-directory.vala	(original)
+++ trunk/src/rygel/rygel-content-directory.vala	Wed Jan 28 12:35:04 2009
@@ -361,9 +361,8 @@
         }
 
         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 @@
                                                      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");
         }

Modified: trunk/src/rygel/rygel-media-container.vala
==============================================================================
--- trunk/src/rygel/rygel-media-container.vala	(original)
+++ trunk/src/rygel/rygel-media-container.vala	Wed Jan 28 12:35:04 2009
@@ -78,14 +78,11 @@
      *
      * @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<MediaObject>? get_children (uint     offset,
-                                                        uint     max_count,
-                                                        out uint child_count)
+    public virtual Gee.List<MediaObject>? get_children (uint offset,
+                                                        uint max_count)
                                                         throws Error {
         return null;
     }



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