[rygel] core: Allow overriding MediaContainer.find_object



commit 9ea03fdd4e44c992460c355ca3c6c52756b0242b
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Jun 16 16:08:15 2010 +0300

    core: Allow overriding MediaContainer.find_object
    
    Some backends might not be able to provide a full search implementation
    but they still might be able to provide an efficient implementation of
    search for a particular object by its ID.

 src/rygel/rygel-media-container.vala |   61 +++++++++++++++++----------------
 1 files changed, 31 insertions(+), 30 deletions(-)
---
diff --git a/src/rygel/rygel-media-container.vala b/src/rygel/rygel-media-container.vala
index 3e0c873..56e5a7e 100644
--- a/src/rygel/rygel-media-container.vala
+++ b/src/rygel/rygel-media-container.vala
@@ -159,6 +159,37 @@ public abstract class Rygel.MediaContainer : MediaObject {
     }
 
     /**
+     * Recursively searches for media object with the given id in this
+     * container.
+     *
+     * @param id ID of the media object to search for
+     * @param cancellable optional cancellable for this operation
+     * @param callback function to call when result is ready
+     *
+     * return the found media object.
+     */
+    public virtual async MediaObject? find_object (string       id,
+                                                   Cancellable? cancellable)
+                                                   throws Error {
+        var expression = new RelationalExpression ();
+        expression.op = SearchCriteriaOp.EQ;
+        expression.operand1 = "@id";
+        expression.operand2 = id;
+
+        uint total_matches;
+        var results = yield this.search (expression,
+                                         0,
+                                         1,
+                                         out total_matches,
+                                         cancellable);
+        if (results.size > 0) {
+            return results[0];
+        } else {
+            return null;
+        }
+    }
+
+    /**
      * Add a new item directly under this container.
      *
      * @param didl_item The item to add to this container.
@@ -204,36 +235,6 @@ public abstract class Rygel.MediaContainer : MediaObject {
         this.container_updated (this);
     }
 
-   /**
-    * Recursively searches for media object with the given id in this container.
-    *
-    * @param id ID of the media object to search for
-    * @param cancellable optional cancellable for this operation
-    * @param callback function to call when result is ready
-    *
-    * return the found media object.
-    */
-    internal async MediaObject? find_object (string       id,
-                                             Cancellable? cancellable)
-                                             throws Error {
-        var expression = new RelationalExpression ();
-        expression.op = SearchCriteriaOp.EQ;
-        expression.operand1 = "@id";
-        expression.operand2 = id;
-
-        uint total_matches;
-        var results = yield this.search (expression,
-                                         0,
-                                         1,
-                                         out total_matches,
-                                         cancellable);
-        if (results.size > 0) {
-            return results[0];
-        } else {
-            return null;
-        }
-    }
-
     private async Gee.List<MediaObject> search_in_children (
                                         SearchExpression      expression,
                                         Gee.List<MediaObject> children,



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