From: Zeeshan Ali (Khattak) Date: Thu, 5 Nov 2009 15:25:55 +0000 (+0200) Subject: core: Search inside child before checking it X-Git-Tag: RYGEL_0_4_6~42 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bae7e8addc8ff3e5675d19752d6dc2efdecb8f9d;p=profile%2Fivi%2Frygel.git core: Search inside child before checking it Search inside child before checking if it satisfies the search criteria itself. --- 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;