[rygel] core: Plugins be able to provide a model description



commit 69d7b348a265a8996e2b0e6246dd2fa6d2c50ad8
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Apr 16 19:48:39 2010 +0300

    core: Plugins be able to provide a model description

 src/rygel/rygel-plugin.vala              |   10 +++++++---
 src/rygel/rygel-root-device-factory.vala |   18 ++++++++++++++++++
 2 files changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/src/rygel/rygel-plugin.vala b/src/rygel/rygel-plugin.vala
index 0ec4e69..cfddd76 100644
--- a/src/rygel/rygel-plugin.vala
+++ b/src/rygel/rygel-plugin.vala
@@ -35,6 +35,7 @@ public class Rygel.Plugin : GUPnP.ResourceFactory {
 
     public string name;
     public string title;
+    public string description;
 
     // Path to description document
     public string desc_path;
@@ -46,10 +47,12 @@ public class Rygel.Plugin : GUPnP.ResourceFactory {
 
     public Plugin (string  desc_path,
                    string  name,
-                   string? title) {
+                   string? title,
+                   string? description = null) {
         this.desc_path = desc_path;
         this.name = name;
         this.title = title;
+        this.description = description;
 
         this.available = true;
 
@@ -63,8 +66,9 @@ public class Rygel.Plugin : GUPnP.ResourceFactory {
 
     public Plugin.MediaServer (string  name,
                                string? title,
-                               Type    content_dir_type) {
-        this (MEDIA_SERVER_DESC_PATH, name, title);
+                               Type    content_dir_type,
+                               string? description = null) {
+        this (MEDIA_SERVER_DESC_PATH, name, title, description);
 
         // MediaServer implementations must implement ContentDirectory service
         var resource_info = new ResourceInfo (ContentDirectory.UPNP_ID,
diff --git a/src/rygel/rygel-root-device-factory.vala b/src/rygel/rygel-root-device-factory.vala
index d676ea6..9f05079 100644
--- a/src/rygel/rygel-root-device-factory.vala
+++ b/src/rygel/rygel-root-device-factory.vala
@@ -109,6 +109,10 @@ internal class Rygel.RootDeviceFactory {
                                         plugin.name,
                                         plugin.title);
 
+        if (plugin.description != null) {
+            this.set_description (device_element, plugin.description);
+        }
+
         /* Then list each icon */
         this.add_icons_to_desc (device_element, plugin);
 
@@ -162,6 +166,20 @@ internal class Rygel.RootDeviceFactory {
         }
     }
 
+    private void set_description (Xml.Node *device_element,
+                                  string    description) {
+        Xml.Node *element = Utils.get_xml_element (device_element,
+                                                   "modelDescription",
+                                                   null);
+        if (element == null) {
+            warning ("Element /root/device/modelDescription not found.");
+
+            return;
+        }
+
+        element->set_content (description);
+    }
+
     private void add_services_to_desc (Xml.Node *device_element,
                                        Plugin    plugin) {
         Xml.Node *service_list_node = Utils.get_xml_element (device_element,



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