[rygel] core: Search inside child before checking it



commit bae7e8addc8ff3e5675d19752d6dc2efdecb8f9d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Nov 5 17:25:55 2009 +0200

    core: Search inside child before checking it
    
    Search inside child before checking if it satisfies the search criteria
    itself.

 src/rygel/rygel-media-container.vala |   31 +++++++++++++++----------------
 1 files changed, 15 insertions(+), 16 deletions(-)
---
diff --git a/src/rygel/rygel-media-container.vala b/src/rygel/rygel-media-container.vala
index 713a31c..0d1691f 100644
--- a/src/rygel/rygel-media-container.vala
+++ b/src/rygel/rygel-media-container.vala
@@ -112,25 +112,24 @@ public abstract class Rygel.MediaContainer : MediaObject {
 
         var children = yield this.get_children (0, uint.MAX, cancellable);
         foreach (var child in children) {
-            if (expression.satisfied_by (child)) {
-                result.add (child);
+            if (child is MediaContainer) {
+                // First search inside the child container
+                var container = child as MediaContainer;
+                uint tmp;
+
+                var child_result = yield container.search (expression,
+                                                           0,
+                                                           0,
+                                                           out tmp,
+                                                           cancellable);
+
+                result.add_all (child_result);
             }
 
-            if (!(child is MediaContainer)) {
-                continue;
+            // Then check if child itself satisfies search criteria
+            if (expression.satisfied_by (child)) {
+                result.add (child);
             }
-
-            // Now continue the search inside the child container
-            var container = child as MediaContainer;
-            uint tmp;
-
-            var child_result = yield container.search (expression,
-                                                       0,
-                                                       0,
-                                                       out tmp,
-                                                       cancellable);
-
-            result.add_all (child_result);
         }
 
         total_matches = result.size;



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