[rygel] core: Accept & handle wildcard as SearchCriteria



commit 4477458755633e254f2131218b48bce52c314985
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Nov 9 20:30:15 2009 +0200

    core: Accept & handle wildcard as SearchCriteria

 src/rygel/rygel-media-container.vala        |    4 ++--
 src/rygel/rygel-search-criteria-parser.vala |    5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/rygel/rygel-media-container.vala b/src/rygel/rygel-media-container.vala
index 85686ae..f5ba685 100644
--- a/src/rygel/rygel-media-container.vala
+++ b/src/rygel/rygel-media-container.vala
@@ -92,7 +92,7 @@ public abstract class Rygel.MediaContainer : MediaObject {
      * Recursively searches for all media objects the satisfy the given search
      * expression in this container.
      *
-     * @param expression the search expression
+     * @param expression the search expression or `null` for wildcard
      * @param offet zero-based index of the first object to return
      * @param max_count maximum number of objects to return
      * @param total_matches sets it to the actual number of objects that satisfy
@@ -141,7 +141,7 @@ public abstract class Rygel.MediaContainer : MediaObject {
             }
 
             // Then check if child itself satisfies search criteria
-            if (expression.satisfied_by (child)) {
+            if (expression == null || expression.satisfied_by (child)) {
                 result.add (child);
             }
 
diff --git a/src/rygel/rygel-search-criteria-parser.vala b/src/rygel/rygel-search-criteria-parser.vala
index 825ecf3..3dc16f9 100644
--- a/src/rygel/rygel-search-criteria-parser.vala
+++ b/src/rygel/rygel-search-criteria-parser.vala
@@ -43,6 +43,11 @@ internal class Rygel.SearchCriteriaParser : Object, StateMachine {
 
     // This implementation is not really async
     public async void run () {
+        if (this.str == "*") {
+            // Wildcard
+            this.completed ();
+        }
+
         var parser = new GUPnP.SearchCriteriaParser ();
 
         parser.expression.connect (this.on_expression);



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