rygel r501 - trunk/src/plugins/dvb



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

Log:
DVBChannelGroup:get_channels does the slicing.

DVBChannelGroup:get_channels does the slicing rather than DVBContentDir.

Modified:
   trunk/src/plugins/dvb/rygel-dvb-channel-group.vala
   trunk/src/plugins/dvb/rygel-dvb-content-dir.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:33:41 2009
@@ -62,13 +62,20 @@
         this.fetch_channels ();
     }
 
-    public ArrayList<DVBChannel> get_channels (uint     offset,
-                                               uint     max_count,
-                                               out uint child_count)
-                                               throws GLib.Error {
+    public Gee.List<DVBChannel> get_channels (uint     offset,
+                                              uint     max_count,
+                                              out uint child_count)
+                                              throws GLib.Error {
         child_count = this.channels.size;
 
-        return this.channels;
+        if (max_count == 0) {
+            max_count = child_count;
+        }
+
+        uint stop = offset + max_count;
+        stop = stop.clamp (0, child_count);
+
+        return this.channels.slice ((int) offset, (int) stop);
     }
 
     public DVBChannel find_channel (string id) {

Modified: trunk/src/plugins/dvb/rygel-dvb-content-dir.vala
==============================================================================
--- trunk/src/plugins/dvb/rygel-dvb-content-dir.vala	(original)
+++ trunk/src/plugins/dvb/rygel-dvb-content-dir.vala	Wed Jan 28 12:33:41 2009
@@ -126,25 +126,14 @@
             throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
         }
 
-        Gee.List<MediaObject> children = null;
-
         var channels = group.get_channels (offset,
                                            max_count,
                                            out child_count);
-        if (max_count == 0) {
-            max_count = child_count;
-        }
-
-        uint stop = offset + max_count;
-
-        stop = stop.clamp (0, child_count);
-        children = channels.slice ((int) offset, (int) stop);
-
-        if (children == null) {
+        if (channels == null) {
             throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
         }
 
-        return children;
+        return channels;
     }
 
     public override Gee.List<MediaObject> get_root_children (



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