[rygel] core: Don't set description if already set



commit 206f01926d3293d4885c69d090467270f28a36c3
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]