[rygel] core: Also remove children becoming empty



commit 610d1ffa85d440de0f97907e7b28bf173f59f82a
Author: Jens Georg <mail jensge org>
Date:   Thu Jul 21 12:51:54 2011 +0200

    core: Also remove children becoming empty
    
    With this change, SimpleContainer now also removes child containers
    that no longer have any content available to them.

 src/rygel/rygel-simple-container.vala |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/src/rygel/rygel-simple-container.vala b/src/rygel/rygel-simple-container.vala
index 640af42..1030882 100644
--- a/src/rygel/rygel-simple-container.vala
+++ b/src/rygel/rygel-simple-container.vala
@@ -175,13 +175,12 @@ public class Rygel.SimpleContainer : Rygel.MediaContainer,
 
     private void on_container_updated (MediaContainer source,
                                        MediaContainer updated) {
-        if (!(updated in this.empty_children)) {
-            return;
-        }
-
         if (updated.child_count > 0) {
+            if (!(updated in this.empty_children)) {
+                return;
+            }
+
             this.empty_children.remove (updated);
-            updated.container_updated.disconnect (this.on_container_updated);
 
             this.add_child (updated);
 
@@ -189,6 +188,18 @@ public class Rygel.SimpleContainer : Rygel.MediaContainer,
 
             debug ("Container '%s' now non-empty, added it to hierarchy now.",
                    updated.id);
+        } else {
+            if (!(updated in this.children)) {
+                return;
+            }
+
+            this.remove_child (updated);
+            this.empty_children.add (updated);
+
+            this.updated ();
+
+            debug ("Container '%s' now empty, removing it from hierarchy now.",
+                   updated.id);
         }
     }
 }



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