[rygel/wip/create-container: 5/5] wip



commit 0dee4d1d934799072235ab5aae364b09f3ba04c8
Author: Jens Georg <jensg openismus com>
Date:   Sat Feb 23 15:06:02 2013 +0100

    wip

 src/librygel-server/rygel-item-creator.vala    |   12 +++---
 src/librygel-server/rygel-media-container.vala |   54 ++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 6 deletions(-)
---
diff --git a/src/librygel-server/rygel-item-creator.vala b/src/librygel-server/rygel-item-creator.vala
index c589566..00c6fd8 100644
--- a/src/librygel-server/rygel-item-creator.vala
+++ b/src/librygel-server/rygel-item-creator.vala
@@ -37,7 +37,7 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
     private string elements;
 
     private DIDLLiteObject didl_item;
-    private MediaItem item;
+    private MediaObject item;
 
     private ContentDirectory content_dir;
     private ServiceAction action;
@@ -434,10 +434,10 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
         this.item.date = this.didl_item.date + "T00:00:00";
     }
 
-    private MediaItem create_item (string            id,
-                                   WritableContainer parent,
-                                   string            title,
-                                   string            upnp_class) throws Error {
+    private MediaObject create_item (string            id,
+                                     WritableContainer parent,
+                                     string            title,
+                                     string            upnp_class) throws Error {
         switch (upnp_class) {
         case ImageItem.UPNP_CLASS:
             return new ImageItem (id, parent, title);
@@ -452,7 +452,7 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
         case PlaylistItem.UPNP_CLASS:
             return new PlaylistItem (id, parent, title);
         case MediaContainer.STORAGE_FOLDER:
-            return new MediaContainer (id, parent, title);
+            return new BaseMediaContainer (id, parent, title, 0);
         default:
             throw new ContentDirectoryError.BAD_METADATA
                                         ("Creation of item of class '%s' " +
diff --git a/src/librygel-server/rygel-media-container.vala b/src/librygel-server/rygel-media-container.vala
index 99094da..eefbb38 100644
--- a/src/librygel-server/rygel-media-container.vala
+++ b/src/librygel-server/rygel-media-container.vala
@@ -33,6 +33,60 @@ public enum Rygel.ObjectEventType {
     DELETED = 2
 }
 
+public class Rygel.BaseMediaContainer : MediaContainer {
+    /**
+     * Create a media container with the specified details.
+     *
+     * @param id See the id property of the #RygelMediaObject class.
+     * @param parent The parent container, if any.
+     * @param title See the title property of the #RygelMediaObject class.
+     * @param child_count The initially-known number of child items.
+     */
+    public BaseMediaContainer (string          id,
+                           MediaContainer? parent,
+                           string          title,
+                           int             child_count) {
+        Object (id : id,
+                parent : parent,
+                title : title,
+                child_count : child_count);
+    }
+
+    /**
+     * Fetches the list of media objects directly under this container.
+     *
+     * @param offset zero-based index of the first item to return
+     * @param max_count maximum number of objects to return
+     * @param sort_criteria sorting order of objects to return
+     * @param cancellable optional cancellable for this operation
+     *
+     * @return A list of media objects.
+     */
+    public override async MediaObjects? get_children (uint         offset,
+                                                      uint         max_count,
+                                                      string       sort_criteria,
+                                                      Cancellable? cancellable)
+                                                      throws Error
+                                                      {
+                                                          return null;
+                                                      }
+
+    /**
+     * Recursively searches this container for a media object with the given ID.
+     *
+     * @param id ID of the media object to search for
+     * @param cancellable optional cancellable for this operation
+     *
+     * @return the found media object.
+     */
+    public override async MediaObject? find_object (string       id,
+                                                    Cancellable? cancellable)
+                                                    throws Error {
+                                                        return null;
+                                                    }
+
+}
+
 /**
  * This is a container (folder) for media items and child containers.
  *


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