[rygel] tracker: Honor 'nmm:uPnPShared' property
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] tracker: Honor 'nmm:uPnPShared' property
- Date: Wed, 13 Oct 2010 17:31:23 +0000 (UTC)
commit af4e79d938ee9a65098c5d3f303868c337852fa7
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Oct 13 20:15:13 2010 +0300
tracker: Honor 'nmm:uPnPShared' property
Make sure we only expose items that are either explicity marked to be shared
over UPnP network or not marked at all.
.../tracker/rygel-tracker-selection-query.vala | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-selection-query.vala b/src/plugins/tracker/rygel-tracker-selection-query.vala
index 3f740b3..71e6cf7 100644
--- a/src/plugins/tracker/rygel-tracker-selection-query.vala
+++ b/src/plugins/tracker/rygel-tracker-selection-query.vala
@@ -27,6 +27,11 @@ using Gee;
*/
public class Rygel.Tracker.SelectionQuery : Query {
public const string ITEM_VARIABLE = "?item";
+ private const string SHARED_FILTER = "(!BOUND(nmm:uPnPShared(" +
+ ITEM_VARIABLE + ")) ||" +
+ " nmm:uPnPShared(" +
+ ITEM_VARIABLE +
+ ") = true)";
public ArrayList<string> variables;
public ArrayList<string> filters;
@@ -84,12 +89,17 @@ public class Rygel.Tracker.SelectionQuery : Query {
query += " WHERE { " + base.to_string ();
- if (this.filters.size > 0) {
+ var filters = new ArrayList<string> ();
+ filters.add_all (this.filters);
+ // Make sure we don't expose items that are marked not to be shared
+ filters.add (SHARED_FILTER);
+
+ if (filters.size > 0) {
query += " FILTER (";
- for (var i = 0; i < this.filters.size; i++) {
- query += this.filters[i];
+ for (var i = 0; i < filters.size; i++) {
+ query += filters[i];
- if (i < this.filters.size - 1) {
+ if (i < filters.size - 1) {
query += " && ";
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]