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



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

Log:
MediaContainer.find_item_by_id is now nullable.

This method should just return null if object is not found.

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:48 2009
@@ -78,8 +78,8 @@
         return this.channels.slice ((int) offset, (int) stop);
     }
 
-    public override MediaObject find_object_by_id (string id)
-                                                   throws GLib.Error {
+    public override MediaObject? find_object_by_id (string id)
+                                                    throws GLib.Error {
         MediaObject channel = null;
         foreach (var tmp in this.channels) {
             if (tmp.id == id) {

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:48 2009
@@ -118,8 +118,8 @@
         return children;
     }
 
-    public override MediaObject find_object_by_id (string id)
-                                                   throws GLib.Error {
+    public override MediaObject? find_object_by_id (string id)
+                                                    throws GLib.Error {
         // First try groups
         MediaObject media_object = find_group_by_id (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:48 2009
@@ -80,8 +80,8 @@
         return children;
     }
 
-    public override MediaObject find_object_by_id (string id)
-                                                   throws GLib.Error {
+    public override MediaObject? find_object_by_id (string id)
+                                                    throws GLib.Error {
         MediaItem item = null;
 
         foreach (MediaItem tmp in this.items) {
@@ -92,10 +92,6 @@
             }
         }
 
-        if (item == null) {
-            throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
-        }
-
         return item;
     }
 

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:48 2009
@@ -144,8 +144,8 @@
         return category;
     }
 
-    public override MediaObject find_object_by_id (string id)
-                                                   throws GLib.Error {
+    public override MediaObject? find_object_by_id (string id)
+                                                    throws GLib.Error {
         MediaObject item;
         string path = id;
 

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:48 2009
@@ -88,8 +88,8 @@
         return children;
     }
 
-    public override MediaObject find_object_by_id (string id)
-                                                   throws GLib.Error {
+    public override MediaObject? find_object_by_id (string id)
+                                                    throws GLib.Error {
         /* First try containers */
         MediaObject media_object = find_container_by_id (id);
 
@@ -101,10 +101,6 @@
                 media_object = container.find_object_by_id (id);
         }
 
-        if (media_object == null) {
-            throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
-        }
-
         return media_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:34:48 2009
@@ -98,7 +98,7 @@
      *
      * return the found media object.
      */
-    public virtual MediaObject find_object_by_id (string id) throws Error {
+    public virtual MediaObject? find_object_by_id (string id) throws Error {
         return null;
     }
 }



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