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



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

Log:
MediaContainer.get_children is now nullable.

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-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:34:56 2009
@@ -62,10 +62,10 @@
         this.fetch_channels ();
     }
 
-    public override Gee.List<MediaObject> get_children (uint     offset,
-                                                        uint     max_count,
-                                                        out uint child_count)
-                                                        throws GLib.Error {
+    public override Gee.List<MediaObject>? get_children (uint     offset,
+                                                         uint     max_count,
+                                                         out uint child_count)
+                                                         throws GLib.Error {
         child_count = this.channels.size;
 
         if (max_count == 0) {

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:34:56 2009
@@ -98,14 +98,12 @@
         }
     }
 
-    public override Gee.List<MediaObject> get_children (uint     offset,
-                                                        uint     max_count,
-                                                        out uint child_count)
-                                                        throws GLib.Error {
+    public override Gee.List<MediaObject>? get_children (uint     offset,
+                                                         uint     max_count,
+                                                         out uint child_count)
+                                                         throws GLib.Error {
         child_count = this.groups.size;
 
-        Gee.List<MediaObject> children = null;
-
         if (max_count == 0) {
             max_count = child_count;
         }
@@ -113,9 +111,7 @@
         uint stop = offset + max_count;
 
         stop = stop.clamp (0, child_count);
-        children = this.groups.slice ((int) offset, (int) stop);
-
-        return children;
+        return this.groups.slice ((int) offset, (int) stop);
     }
 
     public override MediaObject? find_object_by_id (string id)

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:34:56 2009
@@ -56,14 +56,12 @@
         this.child_count = this.items.size;
     }
 
-    public override Gee.List<MediaObject> get_children (uint     offset,
-                                                        uint     max_count,
-                                                        out uint child_count)
-                                                        throws GLib.Error {
+    public override Gee.List<MediaObject>? get_children (uint     offset,
+                                                         uint     max_count,
+                                                         out uint child_count)
+                                                         throws GLib.Error {
         child_count = this.items.size;
 
-        Gee.List<MediaObject> children = null;
-
         if (max_count == 0) {
             max_count = child_count;
         }
@@ -71,13 +69,7 @@
         uint stop = offset + max_count;
 
         stop = stop.clamp (0, child_count);
-        children = this.items.slice ((int) offset, (int) stop);
-
-        if (children == null) {
-            throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
-        }
-
-        return children;
+        return this.items.slice ((int) offset, (int) stop);
     }
 
     public override MediaObject? find_object_by_id (string id)

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:34:56 2009
@@ -114,7 +114,7 @@
         return count;
     }
 
-    public override Gee.List<MediaObject> get_children (uint     offset,
+    public override Gee.List<MediaObject>? get_children (uint     offset,
                                                          uint     max_count,
                                                          out uint child_count)
                                                          throws GLib.Error {

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:34:56 2009
@@ -64,14 +64,12 @@
         this.child_count = this.containers.size;
     }
 
-    public override Gee.List<MediaObject> get_children (uint     offset,
-                                                        uint     max_count,
-                                                        out uint child_count)
-                                                        throws GLib.Error {
+    public override Gee.List<MediaObject>? get_children (uint     offset,
+                                                         uint     max_count,
+                                                         out uint child_count)
+                                                         throws GLib.Error {
         child_count = this.containers.size;
 
-        Gee.List<MediaObject> children = null;
-
         if (max_count == 0) {
             max_count = child_count;
         }
@@ -79,13 +77,7 @@
         uint stop = offset + max_count;
 
         stop = stop.clamp (0, child_count);
-        children = this.containers.slice ((int) offset, (int) stop);
-
-        if (children == null) {
-            throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
-        }
-
-        return children;
+        return this.containers.slice ((int) offset, (int) stop);
     }
 
     public override MediaObject? find_object_by_id (string id)

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:34:56 2009
@@ -83,10 +83,10 @@
      *
      * return A list of media objects.
      */
-    public virtual Gee.List<MediaObject> get_children (uint     offset,
-                                                       uint     max_count,
-                                                       out uint child_count)
-                                                       throws Error {
+    public virtual Gee.List<MediaObject>? get_children (uint     offset,
+                                                        uint     max_count,
+                                                        out uint child_count)
+                                                        throws Error {
         return null;
     }
 



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