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



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

Log:
Always slice the browse results.

Modified:
   trunk/src/plugins/dvb/rygel-dvb-content-dir.vala
   trunk/src/plugins/test/rygel-test-content-dir.vala
   trunk/src/plugins/tracker/rygel-media-tracker.vala

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:24 2009
@@ -131,15 +131,15 @@
         var channels = group.get_channels (offset,
                                            max_count,
                                            out child_count);
-        if (max_count == 0 && offset == 0) {
-            children = channels;
-        } else {
-            uint stop = offset + max_count;
-
-            stop = stop.clamp (0, child_count);
-            children = channels.slice ((int) offset, (int) stop);
+        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) {
             throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
         }
@@ -156,15 +156,15 @@
 
         Gee.List<MediaObject> children = null;
 
-        if (max_count == 0 && offset == 0) {
-            children = this.groups;
-        } else {
-            uint stop = offset + max_count;
-
-            stop = stop.clamp (0, child_count);
-            children = this.groups.slice ((int) offset, (int) stop);
+        if (max_count == 0) {
+            max_count = child_count;
         }
 
+        uint stop = offset + max_count;
+
+        stop = stop.clamp (0, child_count);
+        children = this.groups.slice ((int) offset, (int) stop);
+
         if (children == null) {
             throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
         }

Modified: trunk/src/plugins/test/rygel-test-content-dir.vala
==============================================================================
--- trunk/src/plugins/test/rygel-test-content-dir.vala	(original)
+++ trunk/src/plugins/test/rygel-test-content-dir.vala	Wed Jan 28 12:33:24 2009
@@ -63,15 +63,15 @@
 
         Gee.List<MediaObject> children = null;
 
-        if (max_count == 0 && offset == 0) {
-            children = this.items;
-        } else {
-            uint stop = offset + max_count;
-
-            stop = stop.clamp (0, child_count);
-            children = this.items.slice ((int) offset, (int) stop);
+        if (max_count == 0) {
+            max_count = child_count;
         }
 
+        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");
         }

Modified: trunk/src/plugins/tracker/rygel-media-tracker.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-media-tracker.vala	(original)
+++ trunk/src/plugins/tracker/rygel-media-tracker.vala	Wed Jan 28 12:33:24 2009
@@ -114,15 +114,15 @@
 
         Gee.List<MediaObject> children = null;
 
-        if (max_count == 0 && offset == 0) {
-            children = this.containers;
-        } else {
-            uint stop = offset + max_count;
-
-            stop = stop.clamp (0, child_count);
-            children = this.containers.slice ((int) offset, (int) stop);
+        if (max_count == 0) {
+            max_count = child_count;
         }
 
+        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");
         }



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