[rygel] core: Make use of new OCM flags API in gupnp-av



commit 1c312b7243006b0e104d4ff81807c48379520ccb
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Nov 4 17:43:45 2010 +0200

    core: Make use of new OCM flags API in gupnp-av
    
    Make use of new DLNA OCM flags API in gupnp-av for access-writes.

 src/rygel/rygel-item-creator.vala    |    2 +-
 src/rygel/rygel-item-destroyer.vala  |    2 +-
 src/rygel/rygel-media-container.vala |   18 +++++++++---------
 src/rygel/rygel-media-item.vala      |    7 ++++---
 src/rygel/rygel-media-object.vala    |    2 +-
 5 files changed, 16 insertions(+), 15 deletions(-)
---
diff --git a/src/rygel/rygel-item-creator.vala b/src/rygel/rygel-item-creator.vala
index 83caa0c..2abb400 100644
--- a/src/rygel/rygel-item-creator.vala
+++ b/src/rygel/rygel-item-creator.vala
@@ -182,7 +182,7 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
             throw new ContentDirectoryError.NO_SUCH_OBJECT (
                                         _("No such object"));
         } else if (!(media_object is MediaContainer) ||
-                   !(media_object as MediaContainer).expandable) {
+                   !(OCMFlags.UPLOAD in media_object.ocm_flags)) {
             throw new ContentDirectoryError.RESTRICTED_PARENT (
                                         _("Object creation in %s not allowed"),
                                         media_object.id);
diff --git a/src/rygel/rygel-item-destroyer.vala b/src/rygel/rygel-item-destroyer.vala
index 1d46939..d29be0c 100644
--- a/src/rygel/rygel-item-destroyer.vala
+++ b/src/rygel/rygel-item-destroyer.vala
@@ -98,7 +98,7 @@ internal class Rygel.ItemDestroyer: GLib.Object, Rygel.StateMachine {
         if (media_object == null) {
             throw new ContentDirectoryError.NO_SUCH_OBJECT (
                                         _("No such object"));
-        } else if (!media_object.removable) {
+        } else if (!(OCMFlags.DESTROYABLE in media_object.ocm_flags)) {
             throw new ContentDirectoryError.RESTRICTED_OBJECT (
                                         _("Removal of object %s not allowed"),
                                         media_object.id);
diff --git a/src/rygel/rygel-media-container.vala b/src/rygel/rygel-media-container.vala
index 9f689cb..9e48371 100644
--- a/src/rygel/rygel-media-container.vala
+++ b/src/rygel/rygel-media-container.vala
@@ -46,21 +46,21 @@ public abstract class Rygel.MediaContainer : MediaObject {
     public int child_count;
     public uint32 update_id;
 
-    internal override bool removable {
+    internal override OCMFlags ocm_flags {
         get {
-            return this is WritableContainer && this.uris.size > 0;
+            if (this is WritableContainer && this.uris.size > 0) {
+                return OCMFlags.UPLOAD |
+                       OCMFlags.DESTROYABLE |
+                       OCMFlags.UPLOAD_DESTROYABLE;
+            } else {
+                return OCMFlags.NONE;
+            }
         }
     }
 
     internal override bool restricted {
         get {
-            return !this.removable && !this.expandable;
-        }
-    }
-
-    internal bool expandable {
-        get {
-            return this is WritableContainer && this.uris.size > 0;
+            return this.ocm_flags == OCMFlags.NONE;
         }
     }
 
diff --git a/src/rygel/rygel-media-item.vala b/src/rygel/rygel-media-item.vala
index deb41a1..3fbfb27 100644
--- a/src/rygel/rygel-media-item.vala
+++ b/src/rygel/rygel-media-item.vala
@@ -56,15 +56,16 @@ public abstract class Rygel.MediaItem : MediaObject {
     }   // Size in bytes
 
     internal bool place_holder { get; private set; default = false; }
-    internal override bool removable {
+
+    internal override OCMFlags ocm_flags {
         get {
-            return true;
+            return OCMFlags.DESTROYABLE;
         }
     }
 
     internal override bool restricted {
         get {
-            return !this.removable && !this.place_holder;
+            return this.ocm_flags == OCMFlags.NONE && !this.place_holder;
         }
     }
 
diff --git a/src/rygel/rygel-media-object.vala b/src/rygel/rygel-media-object.vala
index e86a57e..f7d131b 100644
--- a/src/rygel/rygel-media-object.vala
+++ b/src/rygel/rygel-media-object.vala
@@ -87,7 +87,7 @@ public abstract class Rygel.MediaObject : GLib.Object {
     }
 
     internal abstract bool restricted { get; }
-    internal abstract bool removable { get; }
+    internal abstract OCMFlags ocm_flags { get; }
 
     static construct {
         try {



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