[rygel] media-export: Use get_objects_by_search_expression



commit 9e374bd7dc51ea6be1ef3c6a2dc1685151041c3d
Author: Jens Georg <mail jensge org>
Date:   Sat Jan 30 21:54:48 2010 +0100

    media-export: Use get_objects_by_search_expression

 .../rygel-media-export-query-container.vala        |   33 +++++++++++--------
 1 files changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-query-container.vala b/src/plugins/media-export/rygel-media-export-query-container.vala
index 39bdd23..0d332d3 100644
--- a/src/plugins/media-export/rygel-media-export-query-container.vala
+++ b/src/plugins/media-export/rygel-media-export-query-container.vala
@@ -81,21 +81,26 @@ internal class Rygel.MediaExportQueryContainer : Rygel.MediaDBContainer {
                                         out uint         total_matches,
                                         Cancellable?     cancellable)
                                         throws GLib.Error {
-        var exp = new LogicalExpression ();
-        exp.operand1 = this.expression;
-        exp.op = LogicalOperator.AND;
-        exp.operand2 = expression;
-        Gee.List<MediaObject> list;
-        var old_id = this.id;
-        this.id = "0";
-        list = yield base.search (exp,
-                                  offset,
-                                  max_count,
-                                  out total_matches,
-                                  cancellable);
-        this.id = old_id;
-
-        return list;
+        var combined_expression = new LogicalExpression ();
+        combined_expression.operand1 = this.expression;
+        combined_expression.op = LogicalOperator.AND;
+        combined_expression.operand2 = expression;
+
+        var max_objects = max_count;
+        if (max_objects == 0) {
+            max_objects = -1;
+        }
+
+        var children = this.media_db.get_objects_by_search_expression (
+                                                          combined_expression,
+                                                          "0",
+                                                          offset,
+                                                          max_objects);
+
+        total_matches = children.size;
+
+        return children;
+
     }
 
     public override async Gee.List<MediaObject>? get_children (



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