public abstract class Rygel.Tracker.CategoryContainer : Rygel.SimpleContainer {
public ItemFactory item_factory;
- private MediaObjects empty_children;
-
public CategoryContainer (string id,
MediaContainer parent,
string title,
base (id, parent, title);
this.item_factory = item_factory;
- this.empty_children = new MediaObjects ();
this.add_child_container (new CategoryAllContainer (this));
this.add_child_container (new Tags (this, item_factory));
this.add_child_container (new Titles (this, this.item_factory));
this.add_child_container (new New (this, this.item_factory));
}
-
- protected void add_child_container (MediaContainer child) {
- if (child.child_count > 0) {
- this.add_child (child);
- } else {
- this.empty_children.add (child);
- child.container_updated.connect (this.on_container_updated);
- }
- }
-
- private void on_container_updated (MediaContainer source,
- MediaContainer updated) {
- if (!(updated in this.empty_children)) {
- return;
- }
-
- if (updated.child_count > 0) {
- this.empty_children.remove (updated);
- updated.container_updated.disconnect (this.on_container_updated);
-
- this.add_child (updated);
-
- this.updated ();
- }
- }
}
Rygel.SearchableContainer {
public MediaObjects children;
+ private MediaObjects empty_children;
+
public SimpleContainer (string id,
MediaContainer? parent,
string title) {
base (id, parent, title, 0);
this.children = new MediaObjects ();
+ this.empty_children = new MediaObjects ();
}
public SimpleContainer.root (string title) {
this.child_count++;
}
+ public void add_child_container (MediaContainer child) {
+ if (child.child_count > 0) {
+ this.add_child (child);
+ } else {
+ this.empty_children.add (child);
+ child.container_updated.connect (this.on_container_updated);
+ }
+ }
+
public void remove_child (MediaObject child) {
this.children.remove (child);
out total_matches,
cancellable);
}
+
+ private void on_container_updated (MediaContainer source,
+ MediaContainer updated) {
+ if (!(updated in this.empty_children)) {
+ return;
+ }
+
+ if (updated.child_count > 0) {
+ this.empty_children.remove (updated);
+ updated.container_updated.disconnect (this.on_container_updated);
+
+ this.add_child (updated);
+
+ this.updated ();
+ }
+ }
}