Basic skeleton for "ContainerUpdateIDs" state-variable.
authorZeeshan Ali (Khattak) <zeeshanak@src.gnome.org>
Mon, 16 Feb 2009 17:33:11 +0000 (17:33 +0000)
committerZeeshan Ali (Khattak) <zeeshanak@src.gnome.org>
Mon, 16 Feb 2009 17:33:11 +0000 (17:33 +0000)
svn path=/trunk/; revision=609

data/xml/ContentDirectory.xml
src/rygel/rygel-content-directory.vala

index 46174e8..fa001bb 100644 (file)
@@ -33,6 +33,13 @@ feature provided by your editor.
                </stateVariable>
 
                <stateVariable>
+                       <Optional/>
+                       <name>ContainerUpdateIDs</name>
+                       <sendEventsAttribute>yes</sendEventsAttribute>
+                       <dataType>string</dataType>
+               </stateVariable>
+
+               <stateVariable>
                        <name>FeatureList</name>
                        <sendEventsAttribute>no</sendEventsAttribute>
                        <dataType>string</dataType>
@@ -107,13 +114,6 @@ feature provided by your editor.
 
                <stateVariable>
                        <Optional/>
-                       <name>ContainerUpdateIDs</name>
-                       <sendEventsAttribute>yes</sendEventsAttribute>
-                       <dataType>string</dataType>
-               </stateVariable>
-
-               <stateVariable>
-                       <Optional/>
                        <name>TransferIDs</name>
                        <sendEventsAttribute>yes</sendEventsAttribute>
                        <dataType>string</dataType>
index e120ead..7dad825 100644 (file)
@@ -51,6 +51,7 @@ public class Rygel.ContentDirectory: Service {
     protected HTTPServer http_server;
 
     public MediaContainer root_container;
+    private ArrayList<MediaContainer> updated_containers;
 
     private ArrayList<Browse> browses;
     public uint32 system_update_id;
@@ -65,6 +66,7 @@ public class Rygel.ContentDirectory: Service {
         this.http_server = new HTTPServer (this, this.get_type ().name ());
 
         this.browses = new ArrayList<Browse> ();
+        this.updated_containers =  new ArrayList<MediaContainer> ();
 
         this.feature_list =
             "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
@@ -82,6 +84,8 @@ public class Rygel.ContentDirectory: Service {
         this.action_invoked["GetSystemUpdateID"] +=
                                                 this.get_system_update_id_cb;
         this.query_variable["SystemUpdateID"] += this.query_system_update_id;
+        this.query_variable["ContainerUpdateIDs"] +=
+                                                this.query_container_update_ids;
 
         /* Connect SearchCapabilities related signals */
         this.action_invoked["GetSearchCapabilities"] +=
@@ -133,6 +137,17 @@ public class Rygel.ContentDirectory: Service {
         value.set_uint (this.system_update_id);
     }
 
+    /* Query ContainerUpdateIDs */
+    private void query_container_update_ids (ContentDirectory content_dir,
+                                             string           variable,
+                                             ref GLib.Value   value) {
+        var update_ids = this.create_container_update_ids ();
+
+        /* Set action return arguments */
+        value.init (typeof (string));
+        value.set_string (update_ids);
+    }
+
     /* action GetSearchCapabilities implementation */
     private void get_search_capabilities_cb (ContentDirectory    content_dir,
                                              owned ServiceAction action) {
@@ -190,5 +205,16 @@ public class Rygel.ContentDirectory: Service {
     private void on_browse_completed (Browse browse) {
         this.browses.remove (browse);
     }
+
+    private string create_container_update_ids () {
+        var update_ids = "";
+
+        foreach (var container in this.updated_containers) {
+            update_ids += "," + container.id + "," +
+                          container.update_id.to_string ();
+        }
+
+        return update_ids;
+    }
 }