[rygel] tracker: Make sure ID's of children are unique



commit 4387ab5338c3cd9182660cb0d1329c49d798c1e0
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Dec 4 19:02:11 2009 +0200

    tracker: Make sure ID's of children are unique
    
    Make sure children of MetadataValues have unique IDs.

 .../tracker/rygel-tracker-metadata-values.vala     |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-metadata-values.vala b/src/plugins/tracker/rygel-tracker-metadata-values.vala
index 3b666a6..7c9d4f9 100644
--- a/src/plugins/tracker/rygel-tracker-metadata-values.vala
+++ b/src/plugins/tracker/rygel-tracker-metadata-values.vala
@@ -144,6 +144,10 @@ public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
             }
 
             var id = this.id_func (value);
+            if (!this.is_child_id_unique (id)) {
+                continue;
+            }
+
             var title = this.title_func (value);
 
             // The child container can use the same mandatory triplets we used
@@ -183,5 +187,19 @@ public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
                                                 RESOURCES_PATH)
                                                 as TrackerResourcesIface;
     }
+
+    private bool is_child_id_unique (string child_id) {
+        var unique = true;
+
+        foreach (var child in this.children) {
+            if (child.id == child_id) {
+                unique = false;
+
+                break;
+            }
+        }
+
+        return unique;
+    }
 }
 



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