[rygel] tracker: Means to create filter from variable & value
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] tracker: Means to create filter from variable & value
- Date: Sat, 5 Dec 2009 01:22:24 +0000 (UTC)
commit 294edfe4ff36f41d8cf1546824cb145e2af1b232
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Thu Dec 3 19:34:26 2009 +0200
tracker: Means to create filter from variable & value
Provide API for users of MetadataValues to be able to create filter
given variable and value.
.../tracker/rygel-tracker-metadata-values.vala | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-metadata-values.vala b/src/plugins/tracker/rygel-tracker-metadata-values.vala
index c3efc4e..88294a8 100644
--- a/src/plugins/tracker/rygel-tracker-metadata-values.vala
+++ b/src/plugins/tracker/rygel-tracker-metadata-values.vala
@@ -35,6 +35,7 @@ public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
private const string ITEM_VARIABLE = "?item";
public delegate string TitleFunc (string value);
+ public delegate string FilterFunc (string variable, string value);
private TrackerItemFactory item_factory;
@@ -43,6 +44,7 @@ public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
// nmm:Performer -> nmm:artistName
public string[] key_chain;
public TitleFunc title_func;
+ public FilterFunc filter_func;
private TrackerResourcesIface resources;
@@ -52,12 +54,15 @@ public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
TrackerItemFactory item_factory,
string[] key_chain,
TitleFunc? title_func =
- default_title_func) {
+ default_title_func,
+ FilterFunc? filter_func =
+ default_filter_func) {
base (id, parent, title);
this.item_factory = item_factory;
this.key_chain = key_chain;
this.title_func = title_func;
+ this.filter_func = filter_func;
try {
this.create_proxies ();
@@ -142,7 +147,7 @@ public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
// However we constrain the object of our last mandatory triplet.
var filters = new ArrayList<string> ();
- var filter = child_mandatory.last ().obj + " = \"" + value + "\"";
+ var filter = this.filter_func (child_mandatory.last ().obj, value);
filters.add (filter);
var container = new TrackerSearchContainer (value,
@@ -162,6 +167,10 @@ public class Rygel.TrackerMetadataValues : Rygel.SimpleContainer {
return value;
}
+ public static string default_filter_func (string variable, string value) {
+ return variable + " = \"" + value + "\"";
+ }
+
private void create_proxies () throws DBus.Error {
DBus.Connection connection = DBus.Bus.get (DBus.BusType.SESSION);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]