[rygel/gnome-2-32] core: Don't set description if already set



commit 36471a62c0e776269880944f0220b676f191986d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Sep 15 03:03:08 2010 +0300

    core: Don't set description if already set

 src/rygel/rygel-root-device-factory.vala |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/rygel/rygel-root-device-factory.vala b/src/rygel/rygel-root-device-factory.vala
index 36c1e94..94bf6ca 100644
--- a/src/rygel/rygel-root-device-factory.vala
+++ b/src/rygel/rygel-root-device-factory.vala
@@ -120,9 +120,7 @@ internal class Rygel.RootDeviceFactory {
                                         plugin.title);
 
         if (plugin.description != null) {
-            device_element->new_child (null,
-                                       "modelDescription",
-                                       plugin.description);
+            this.set_description (device_element, plugin.description);
         }
 
         /* Then list each icon */
@@ -179,6 +177,18 @@ internal class Rygel.RootDeviceFactory {
         }
     }
 
+    private void set_description (Xml.Node *device_element,
+                                  string    description) {
+        Xml.Node *element = XMLUtils.get_element (device_element,
+                                                  "modelDescription",
+                                                  null);
+        if (element == null) {
+            device_element->new_child (null, "modelDescription", description);
+        }
+
+        element->set_content (description);
+    }
+
     private void add_services_to_desc (Xml.Node *device_element,
                                        Plugin    plugin) {
         Xml.Node *service_list_node = XMLUtils.get_element (device_element,



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