Add get_root_children_count() to MediaProvider interface.
authorZeeshan Ali (Khattak) <zeeshanak@src.gnome.org>
Tue, 5 Aug 2008 15:50:56 +0000 (15:50 +0000)
committerZeeshan Ali (Khattak) <zeeshanak@src.gnome.org>
Tue, 5 Aug 2008 15:50:56 +0000 (15:50 +0000)
svn path=/trunk/; revision=237

ChangeLog
src/gupnp-media-manager.vala
src/gupnp-media-provider.vala
src/gupnp-media-tracker.vala

index f4f2e49..20b29a6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,7 +4,8 @@
        * src/gupnp-media-provider.vala:
        * src/gupnp-media-tracker.vala:
 
-       Add "title" prop to MediaProvider interface.
+       - Add "title" prop to MediaProvider interface.
+       - Add get_root_children_count() to MediaProvider interface.
 
 2008-08-03  Zeeshan Ali Khattak  <zeenix@gmail.com>
 
index 76eeb6c..81ebd48 100644 (file)
@@ -128,6 +128,10 @@ public class GUPnP.MediaManager : GLib.Object, MediaProvider {
         return didl;
     }
 
+    public uint get_root_children_count () {
+        return this.providers.size ();
+    }
+
     /* Private methods */
     private string browse_root_container (out uint number_returned,
                                           out uint total_matches,
@@ -141,10 +145,10 @@ public class GUPnP.MediaManager : GLib.Object, MediaProvider {
             add_container ((string) key,
                            this.root_id,
                            provider.title,
-                           -1);           /* FIXME */
+                           provider.get_root_children_count ());
             });
 
-        number_returned = total_matches = this.providers.size ();
+        number_returned = total_matches = this.get_root_children_count ();
 
         /* End DIDL-Lite fragment */
         this.didl_writer.end_didl_lite ();
@@ -167,7 +171,7 @@ public class GUPnP.MediaManager : GLib.Object, MediaProvider {
         add_container (this.root_id,
                        "-1",         /* FIXME */
                        this.title,
-                       this.providers.size ());
+                       this.get_root_children_count ());
 
         /* End DIDL-Lite fragment */
         this.didl_writer.end_didl_lite ();
index 2f3f19c..e22e464 100644 (file)
@@ -42,5 +42,7 @@ public interface MediaProvider : GLib.Object {
                                          string  filter,
                                          string  sort_criteria,
                                          out uint update_id);
+
+    public abstract uint get_root_children_count ();
 }
 
index 23a6b3e..765718a 100644 (file)
@@ -230,12 +230,16 @@ public class GUPnP.MediaTracker : GLib.Object, MediaProvider {
         return didl;
     }
 
+    public uint get_root_children_count () {
+        return this.containers.length ();
+    }
+
     /* Private methods */
     private uint add_root_container_children () {
         foreach (Tracker.Container container in this.containers)
             this.add_container_from_db (container, this.root_id);
 
-        return this.containers.length ();
+        return this.get_root_children_count ();
     }
 
     private void add_container_from_db (Tracker.Container container,
@@ -676,7 +680,7 @@ public class GUPnP.MediaTracker : GLib.Object, MediaProvider {
         add_container (this.root_id,
                        this.root_parent_id,
                        this.title,
-                       this.containers.length ());
+                       this.get_root_children_count ());
     }
 
     private Tracker.Container? get_item_parent (string uri) {