[rygel] external: Sort results
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] external: Sort results
- Date: Sun, 12 Aug 2012 17:54:12 +0000 (UTC)
commit 9ced1d1c014a4bc4d34575a31e06ccbf08975097
Author: Jens Georg <mail jensge org>
Date: Sun Aug 12 17:08:07 2012 +0200
external: Sort results
src/librygel-server/rygel-media-objects.vala | 2 +-
src/plugins/external/rygel-external-container.vala | 12 ++++++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/librygel-server/rygel-media-objects.vala b/src/librygel-server/rygel-media-objects.vala
index e91316c..f61d333 100644
--- a/src/librygel-server/rygel-media-objects.vala
+++ b/src/librygel-server/rygel-media-objects.vala
@@ -40,7 +40,7 @@ public class Rygel.MediaObjects : ArrayList<MediaObject> {
return ret;
}
- internal void sort_by_criteria (string sort_criteria) {
+ public void sort_by_criteria (string sort_criteria) {
var sort_props = sort_criteria.split (",");
if (sort_props.length == 0) {
return;
diff --git a/src/plugins/external/rygel-external-container.vala b/src/plugins/external/rygel-external-container.vala
index a7648a6..e1e183d 100644
--- a/src/plugins/external/rygel-external-container.vala
+++ b/src/plugins/external/rygel-external-container.vala
@@ -97,7 +97,10 @@ public class Rygel.External.Container : Rygel.MediaContainer,
var children_props = yield this.actual_container.list_children
(offset, max_count, filter);
- return yield this.create_media_objects (children_props, this);
+ var result = yield this.create_media_objects (children_props, this);
+ result.sort_by_criteria (sort_criteria);
+
+ return result;
}
public async MediaObjects? search (SearchExpression? expression,
@@ -138,7 +141,12 @@ public class Rygel.External.Container : Rygel.MediaContainer,
filter);
total_matches = result.length;
- return yield this.create_media_objects (result);
+ var objects = yield this.create_media_objects (result);
+
+ // FIXME: Delegate sorting to remote peer
+ objects.sort_by_criteria (sort_criteria);
+
+ return objects;
}
public override async MediaObject? find_object (string id,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]