[rygel] media-export: NullContainer: Add explanatory root() constructor.



commit 932c286ba81c0733e4dfa2c384b18e7ce683a01a
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Jan 17 14:27:51 2013 +0100

    media-export: NullContainer: Add explanatory root() constructor.

 .../rygel-media-export-media-cache.vala            |    3 +--
 .../rygel-media-export-null-container.vala         |   10 ++++++++--
 .../rygel-media-export-root-container.vala         |    7 ++-----
 3 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-media-cache.vala b/src/plugins/media-export/rygel-media-export-media-cache.vala
index 4a12ae0..aaa57a2 100644
--- a/src/plugins/media-export/rygel-media-export-media-cache.vala
+++ b/src/plugins/media-export/rygel-media-export-media-cache.vala
@@ -355,8 +355,7 @@ public class Rygel.MediaExport.MediaCache : Object {
             unowned string parent_id = statement.column_text (DetailColumn.PARENT);
 
             if (parent == null || parent_id != parent.id) {
-                parent = new NullContainer ();
-                parent.id = parent_id;
+                parent = new NullContainer (parent_id, null, "MediaExport");
             }
 
             if (parent != null) {
diff --git a/src/plugins/media-export/rygel-media-export-null-container.vala b/src/plugins/media-export/rygel-media-export-null-container.vala
index 6309fbc..522f9fe 100644
--- a/src/plugins/media-export/rygel-media-export-null-container.vala
+++ b/src/plugins/media-export/rygel-media-export-null-container.vala
@@ -26,8 +26,14 @@ using Gee;
  * created
  */
 internal class Rygel.NullContainer : MediaContainer {
-    public NullContainer () {
-        base.root ("MediaExport", 0);
+    public NullContainer (string          id,
+                          MediaContainer? parent,
+                          string          title) {
+        base(id, parent, title, 0);
+    }
+
+    public NullContainer.root () {
+        base.root("MediaExport", 0);
     }
 
     public override async MediaObjects? get_children (
diff --git a/src/plugins/media-export/rygel-media-export-root-container.vala b/src/plugins/media-export/rygel-media-export-root-container.vala
index 4665e69..c800354 100644
--- a/src/plugins/media-export/rygel-media-export-root-container.vala
+++ b/src/plugins/media-export/rygel-media-export-root-container.vala
@@ -63,7 +63,7 @@ public class Rygel.MediaExport.RootContainer : TrackableDbContainer {
                 RootContainer.instance = new RootContainer ();
             } catch (Error error) {
                 // cache error for further calls and create Null container
-                RootContainer.instance = new NullContainer ();
+                RootContainer.instance = new NullContainer.root ();
                 RootContainer.creation_error = error;
             }
         } else {
@@ -451,10 +451,7 @@ public class Rygel.MediaExport.RootContainer : TrackableDbContainer {
                                          string              item_class,
                                          FolderDefinition[]? definitions = null)
                                          throws Error {
-        var container = new NullContainer ();
-        container.parent = this;
-        container.title = parent;
-        container.id = "virtual-parent:" + item_class;
+        var container = new NullContainer ("virtual-parent:" + item_class, this, parent);
         this.media_db.save_container (container);
 
         foreach (var definition in VIRTUAL_FOLDERS_DEFAULT) {



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