rygel r158 - in trunk: . src/media-providers/tracker src/media-server



Author: zeeshanak
Date: Tue Oct 28 21:01:47 2008
New Revision: 158
URL: http://svn.gnome.org/viewvc/rygel?rev=158&view=rev

Log:
Create the root container in the contructor of the media providers.

Modified:
   trunk/ChangeLog
   trunk/src/media-providers/tracker/gupnp-media-tracker.vala
   trunk/src/media-server/gupnp-media-manager.vala

Modified: trunk/src/media-providers/tracker/gupnp-media-tracker.vala
==============================================================================
--- trunk/src/media-providers/tracker/gupnp-media-tracker.vala	(original)
+++ trunk/src/media-providers/tracker/gupnp-media-tracker.vala	Tue Oct 28 21:01:47 2008
@@ -55,6 +55,8 @@
 
     public static const int MAX_REQUESTED_COUNT = 128;
 
+    private MediaContainer root_container;
+
     /* FIXME: Make this a static if you know how to initize it */
     private List<Tracker.Container> containers;
 
@@ -65,6 +67,11 @@
     private SearchCriteriaParser search_parser;
 
     construct {
+        this.root_container = new MediaContainer (this.root_id,
+                                                  this.root_parent_id,
+                                                  this.title,
+                                                  this.containers.length ());
+
         this.containers = new List<Tracker.Container> ();
         this.containers.append
                         (new Tracker.Container (this.root_id + ":" + "16",
@@ -163,7 +170,7 @@
         bool found = false;
 
         if (object_id == this.root_id) {
-            add_root_container (didl_writer);
+            this.root_container.serialize (didl_writer);
 
             found = true;
         } else {
@@ -477,14 +484,6 @@
         return true;
     }
 
-    private void add_root_container (DIDLLiteWriter didl_writer) {
-        var container = new MediaContainer (this.root_id,
-                                            this.root_parent_id,
-                                            this.title,
-                                            this.containers.length ());
-        container.serialize (didl_writer);
-    }
-
     private Tracker.Container? get_item_parent (string uri) {
         Tracker.Container container = null;
         string category;

Modified: trunk/src/media-server/gupnp-media-manager.vala
==============================================================================
--- trunk/src/media-server/gupnp-media-manager.vala	(original)
+++ trunk/src/media-server/gupnp-media-manager.vala	Tue Oct 28 21:01:47 2008
@@ -37,6 +37,8 @@
     /* We need to keep the modules somewhere */
     List<Module> modules;
 
+    private MediaContainer root_container;
+
     private delegate MediaProvider RegisterMediaProviderFunc
                                     (string        root_id,
                                      string        root_parent_id,
@@ -50,6 +52,11 @@
 
         this.system_update_id = 0;
 
+        this.root_container = new MediaContainer (this.root_id,
+                                                  "-1",
+                                                  this.title,
+                                                  this.providers.size ());
+
         this.register_media_providers ();
     }
 
@@ -111,8 +118,9 @@
         string root_id = this.get_root_id_from_id (object_id);
 
         if (root_id == this.root_id) {
-            this.add_root_container_metadata (didl_writer,
-                                              out update_id);
+            this.root_container.serialize (didl_writer);
+
+            update_id = this.system_update_id;
         } else {
             weak MediaProvider provider = this.providers.lookup (root_id);
             if (provider != null) {
@@ -158,17 +166,6 @@
         update_id = this.system_update_id;
     }
 
-    private void add_root_container_metadata (DIDLLiteWriter didl_writer,
-                                              out uint       update_id) {
-        var container = new MediaContainer (this.root_id,
-                                            "-1",
-                                            this.title,
-                                            this.providers.size ());
-        container.serialize (didl_writer);
-
-        update_id = this.system_update_id;
-    }
-
     string get_root_id_from_id (string id) {
         string[] tokens;
 



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