core: Don't set description if already set
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Wed, 15 Sep 2010 00:03:08 +0000 (03:03 +0300)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Wed, 15 Sep 2010 11:57:22 +0000 (14:57 +0300)
src/rygel/rygel-root-device-factory.vala

index 36c1e94..94bf6ca 100644 (file)
@@ -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,