[rygel] core, plugins: SimpleContainer.add_child() -> add_child_item()
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core, plugins: SimpleContainer.add_child() -> add_child_item()
- Date: Wed, 22 Dec 2010 13:56:32 +0000 (UTC)
commit de11280e8bf485d0782693e905d74591ce996c3e
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Dec 22 15:00:29 2010 +0200
core,plugins: SimpleContainer.add_child() -> add_child_item()
Replace add_child() method of SimpleContainer by a more specific method,
add_child_item() and hence making it compulsory to use the specific
addition methods. This also implies that SimpleContainer now always delays
addition of empty child containers until they remain empty.
.../rygel-gst-launch-root-container.vala | 20 ++++++++++----------
.../mediathek/rygel-mediathek-root-container.vala | 2 +-
.../mediathek/rygel-mediathek-rss-container.vala | 2 +-
src/plugins/test/rygel-test-root-container.vala | 4 ++--
.../tracker/rygel-tracker-metadata-values.vala | 2 +-
src/rygel/rygel-simple-container.vala | 16 ++++++++++------
6 files changed, 25 insertions(+), 21 deletions(-)
---
diff --git a/src/plugins/gst-launch/rygel-gst-launch-root-container.vala b/src/plugins/gst-launch/rygel-gst-launch-root-container.vala
index a433cf1..e032737 100644
--- a/src/plugins/gst-launch/rygel-gst-launch-root-container.vala
+++ b/src/plugins/gst-launch/rygel-gst-launch-root-container.vala
@@ -59,17 +59,17 @@ public class Rygel.GstLaunch.RootContainer : SimpleContainer {
"%s-launch".printf (name));
if (mime_type.has_prefix ("audio")) {
- this.add_child (new AudioItem (name,
- this,
- title,
- mime_type,
- launch_line));
+ this.add_child_item (new AudioItem (name,
+ this,
+ title,
+ mime_type,
+ launch_line));
} else {
- this.add_child (new VideoItem (name,
- this,
- title,
- mime_type,
- launch_line));
+ this.add_child_item (new VideoItem (name,
+ this,
+ title,
+ mime_type,
+ launch_line));
}
} catch (GLib.Error err) {
debug ("GstLaunch failed item '%s': %s", name, err.message);
diff --git a/src/plugins/mediathek/rygel-mediathek-root-container.vala b/src/plugins/mediathek/rygel-mediathek-root-container.vala
index 14276fe..7b33d3d 100644
--- a/src/plugins/mediathek/rygel-mediathek-root-container.vala
+++ b/src/plugins/mediathek/rygel-mediathek-root-container.vala
@@ -62,7 +62,7 @@ public class Rygel.Mediathek.RootContainer : Rygel.SimpleContainer {
}
foreach (int id in feeds) {
- this.add_child (new RssContainer (this, id));
+ this.add_child_container (new RssContainer (this, id));
}
GLib.Timeout.add_seconds (1800, on_schedule_update);
diff --git a/src/plugins/mediathek/rygel-mediathek-rss-container.vala b/src/plugins/mediathek/rygel-mediathek-rss-container.vala
index d069b15..983a356 100644
--- a/src/plugins/mediathek/rygel-mediathek-rss-container.vala
+++ b/src/plugins/mediathek/rygel-mediathek-rss-container.vala
@@ -70,7 +70,7 @@ public class Rygel.Mediathek.RssContainer : Rygel.SimpleContainer {
Xml.Node* node = xpo->nodesetval->item (i);
try {
var item = VideoItem.create_from_xml (this, node);
- this.add_child (item);
+ this.add_child_item (item);
ret = true;
}
catch (VideoItemError error) {
diff --git a/src/plugins/test/rygel-test-root-container.vala b/src/plugins/test/rygel-test-root-container.vala
index fb7bb58..abe878e 100644
--- a/src/plugins/test/rygel-test-root-container.vala
+++ b/src/plugins/test/rygel-test-root-container.vala
@@ -33,8 +33,8 @@ public class Rygel.Test.RootContainer : Rygel.SimpleContainer {
public RootContainer (string title) {
base.root (title);
- this.add_child (new AudioItem ("sinewave", this, "Sine Wave"));
- this.add_child (new VideoItem ("smtpe", this, "SMTPE"));
+ this.add_child_item (new AudioItem ("sinewave", this, "Sine Wave"));
+ this.add_child_item (new VideoItem ("smtpe", this, "SMTPE"));
}
}
diff --git a/src/plugins/tracker/rygel-tracker-metadata-values.vala b/src/plugins/tracker/rygel-tracker-metadata-values.vala
index 472b946..064fb58 100644
--- a/src/plugins/tracker/rygel-tracker-metadata-values.vala
+++ b/src/plugins/tracker/rygel-tracker-metadata-values.vala
@@ -153,7 +153,7 @@ public abstract class Rygel.Tracker.MetadataValues : Rygel.SimpleContainer {
container.upnp_class = child_class;
}
- this.add_child (container);
+ this.add_child_container (container);
}
this.updated ();
diff --git a/src/rygel/rygel-simple-container.vala b/src/rygel/rygel-simple-container.vala
index 01cafee..1abdb0c 100644
--- a/src/rygel/rygel-simple-container.vala
+++ b/src/rygel/rygel-simple-container.vala
@@ -48,15 +48,13 @@ public class Rygel.SimpleContainer : Rygel.MediaContainer,
this ("0", null, title);
}
- public void add_child (MediaObject child) {
- this.children.add (child);
-
- this.child_count++;
+ public void add_child_item (MediaItem child) {
+ this.add_child (child);
}
/**
- * Container-specific version of @add_child that only actually adds the
- * child container to the hierarchy until it has any children to offer.
+ * NOTE: This method only actually adds the child container to the hierarchy
+ * until it has any children to offer.
*/
public void add_child_container (MediaContainer child) {
if (child.child_count > 0) {
@@ -128,6 +126,12 @@ public class Rygel.SimpleContainer : Rygel.MediaContainer,
cancellable);
}
+ private void add_child (MediaObject child) {
+ this.children.add (child);
+
+ this.child_count++;
+ }
+
private void on_container_updated (MediaContainer source,
MediaContainer updated) {
if (!(updated in this.empty_children)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]