[rygel/wip/track-changes: 6/6] WIP: Some more random changes in SimpleContainer.



commit b417b8e8cc9914b2d023f5fdb930e59966a859ec
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Thu Sep 13 14:01:45 2012 +0200

    WIP: Some more random changes in SimpleContainer.
    
    Unfinished, not working, interrupted in the middle.

 src/librygel-server/rygel-simple-container.vala |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/librygel-server/rygel-simple-container.vala b/src/librygel-server/rygel-simple-container.vala
index 9eef9d1..324dc41 100644
--- a/src/librygel-server/rygel-simple-container.vala
+++ b/src/librygel-server/rygel-simple-container.vala
@@ -53,6 +53,7 @@ public class Rygel.SimpleContainer : Rygel.MediaContainer,
 
     public void add_child_item (MediaItem child) {
         this.add_child (child);
+        this.updated (child, ObjectEventType.ADDED, false);
     }
 
     public MediaObjects get_all_children () {
@@ -75,6 +76,12 @@ public class Rygel.SimpleContainer : Rygel.MediaContainer,
 
         if (child.child_count > 0) {
             this.add_child (child);
+            this.updated (child, ObjectEventType.ADDED, false);
+            var grand_children = child.get_children (0, UINT_MAX, "", null);
+
+            foreach (var grand_child in grand_children) {
+                updated.updated (grand_child, ObjectEventType.ADDED, false);
+            }
         } else {
             debug ("Container '%s' empty, refusing to add to hierarchy " +
                    "until it has any children to offer.",
@@ -88,11 +95,21 @@ public class Rygel.SimpleContainer : Rygel.MediaContainer,
         this.children.remove (child);
 
         this.child_count--;
+        if (child is MediaContainer) {
+            var grand_children = child.get_children (0, UINT_MAX, "", null);
+
+            foreach (var grand_child in grand_children) {
+                updated.updated (grand_child, ObjectEventType.DELETED, false);
+            }
+        }
+        this.updated (child, ObjectEventType.DELETED, false);
+        this.updated (this, ObjectEventType.MODIFIED, false);
     }
 
     public void clear () {
         // TODO: this will have to emit sub-tree events of object being deleted.
         this.children.clear ();
+        foreach (var child
 
         this.child_count = 0;
     }



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