core: Accept & handle wildcard as SearchCriteria
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 9 Nov 2009 18:30:15 +0000 (20:30 +0200)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 9 Nov 2009 18:30:15 +0000 (20:30 +0200)
src/rygel/rygel-media-container.vala
src/rygel/rygel-search-criteria-parser.vala

index 85686ae..f5ba685 100644 (file)
@@ -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);
             }
 
index 825ecf3..3dc16f9 100644 (file)
@@ -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);