[rygel/wip/g-i: 283/283] WIP



commit b8300254546a34f5c28ea88bff5e9edbdd53720b
Author: Jens Georg <jensg openismus com>
Date:   Sat Nov 2 11:07:36 2013 +0100

    WIP

 src/librygel-server/rygel-import-resource.vala |    2 +-
 src/librygel-server/rygel-media-item.vala      |    4 ----
 src/librygel-server/rygel-media-object.vala    |   18 ++++++++++++++++--
 3 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/src/librygel-server/rygel-import-resource.vala b/src/librygel-server/rygel-import-resource.vala
index 2ecdbc2..2069f92 100644
--- a/src/librygel-server/rygel-import-resource.vala
+++ b/src/librygel-server/rygel-import-resource.vala
@@ -136,7 +136,7 @@ internal class Rygel.ImportResource : GLib.Object, Rygel.StateMachine {
         queue.dequeue (this.item);
 
         try {
-            var source_file = File.new_for_uri (this.item.uris[0]);
+            var source_file = File.new_for_uri (this item uris  get (0));
             this.output_stream = yield source_file.replace_async (null,
                                                                   false,
                                                                   FileCreateFlags.PRIVATE,
diff --git a/src/librygel-server/rygel-media-item.vala b/src/librygel-server/rygel-media-item.vala
index f175c79..50bfa0f 100644
--- a/src/librygel-server/rygel-media-item.vala
+++ b/src/librygel-server/rygel-media-item.vala
@@ -137,10 +137,6 @@ public abstract class Rygel.MediaItem : MediaObject {
 
     public abstract bool streamable ();
 
-    public virtual void add_uri (string uri) {
-        this.uris.add (uri);
-    }
-
     internal int compare_transcoders (Transcoder transcoder1,
                                       Transcoder transcoder2) {
         return (int) transcoder1.get_distance (this) -
diff --git a/src/librygel-server/rygel-media-object.vala b/src/librygel-server/rygel-media-object.vala
index 36b9ba0..e24e840 100644
--- a/src/librygel-server/rygel-media-object.vala
+++ b/src/librygel-server/rygel-media-object.vala
@@ -47,7 +47,21 @@ public abstract class Rygel.MediaObject : GLib.Object {
     //TODO: { get; private set; } or, even better,
     // add virtual set_uri in Object and make add_uri() in Item into set_uri()
     // and make the uri property single-value.
-    public Gee.ArrayList<string> uris;
+    private Gee.ArrayList<string> _uris;
+
+    public virtual void add_uri (string uri) {
+        uris.add (uri);
+    }
+
+    public virtual void remove_uri (string uri) {
+        uris.remove (uri);
+    }
+
+    public BidirList<string> uris {
+        owned get {
+            return uris.read_only_view;
+        }
+    }
 
     // You can keep both an unowned and owned ref to parent of this MediaObject.
     // In most cases, one will only need to keep an unowned ref to avoid cyclic
@@ -146,7 +160,7 @@ public abstract class Rygel.MediaObject : GLib.Object {
     public override void constructed () {
         base.constructed ();
 
-        uris = new ArrayList<string> ();
+        _uris = new ArrayList<string> ();
     }
 
     /**


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