Root container is now created by ContentDir implementations.
authorZeeshan Ali (Khattak) <zeeshanak@src.gnome.org>
Wed, 28 Jan 2009 12:34:01 +0000 (12:34 +0000)
committerZeeshan Ali (Khattak) <zeeshanak@src.gnome.org>
Wed, 28 Jan 2009 12:34:01 +0000 (12:34 +0000)
svn path=/trunk/; revision=506

src/plugins/dvb/rygel-dvb-content-dir.vala
src/plugins/test/rygel-test-content-dir.vala
src/plugins/tracker/rygel-media-tracker.vala
src/rygel/rygel-content-directory.vala

index 296f561..1b6cadd 100644 (file)
@@ -161,6 +161,11 @@ public class Rygel.DVBContentDir : ContentDirectory {
         return children;
     }
 
+    public override MediaContainer? create_root_container () {
+        string friendly_name = this.root_device.get_friendly_name ();
+        return new MediaContainer.root (friendly_name, 0);
+    }
+
     // Private methods
     private DVBChannelGroup? find_group_by_id (string id) {
         DVBChannelGroup group = null;
index 23fbee6..5df09c4 100644 (file)
@@ -98,6 +98,11 @@ public class Rygel.TestContentDir : ContentDirectory {
         return item;
     }
 
+    public override MediaContainer? create_root_container () {
+        string friendly_name = this.root_device.get_friendly_name ();
+        return new MediaContainer.root (friendly_name, 0);
+    }
+
     /* Private methods */
     private void on_need_stream_source (HTTPServer  http_server,
                                         MediaItem   item,
index 6024e57..de22ba8 100644 (file)
@@ -130,6 +130,11 @@ public class Rygel.MediaTracker : ContentDirectory {
         return children;
     }
 
+    public override MediaContainer? create_root_container () {
+        string friendly_name = this.root_device.get_friendly_name ();
+        return new MediaContainer.root (friendly_name, 0);
+    }
+
     /* Private methods */
     private TrackerContainer? find_container_by_id (string container_id) {
         TrackerContainer container;
index 1d6a578..06422e6 100644 (file)
@@ -95,9 +95,13 @@ public class Rygel.ContentDirectory: Service {
         throw new ServerError.NOT_IMPLEMENTED ("Not Implemented\n");
     }
 
+    public virtual MediaContainer? create_root_container () {
+       return null;
+    }
+
     public override void constructed () {
         this.didl_writer = new DIDLLiteWriter ();
-        this.setup_root_container ();
+        this.root_container = this.create_root_container ();
         this.http_server = new HTTPServer (context, this.get_type ().name ());
 
         this.http_server.item_requested += this.on_item_requested;
@@ -251,11 +255,6 @@ public class Rygel.ContentDirectory: Service {
         value.set_string (this.feature_list);
     }
 
-    private void setup_root_container () {
-        string friendly_name = this.root_device.get_friendly_name ();
-        this.root_container = new MediaContainer.root (friendly_name, 0);
-    }
-
     private void browse_metadata (BrowseArgs args) throws Error {
         if (args.object_id == this.root_container.id) {
             this.root_container.serialize (didl_writer);