[grilo-plugins] tracker: Do not advertise browse support for the Tracker extractor
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] tracker: Do not advertise browse support for the Tracker extractor
- Date: Mon, 20 Apr 2015 11:50:32 +0000 (UTC)
commit 1b1c0d31bdd3f6e1c9c11d7d03a2f9610cc44525
Author: Philip Withnall <philip withnall collabora co uk>
Date: Mon Apr 20 10:16:09 2015 +0100
tracker: Do not advertise browse support for the Tracker extractor
The Tracker extractor data source (which appears when using the
per-device-source option) does not support browsing, only resolving.
Override the supported_operations vfunc to ensure that GRL_OP_BROWSE is
not advertised for that source.
This fixes clients which want to browse a single Tracker source (e.g. a
single removable drive) and are checking for browsability using
grl_source_supported_operations().
https://bugzilla.gnome.org/show_bug.cgi?id=748173
src/tracker/grl-tracker-source-api.c | 22 ++++++++++++++++++++++
src/tracker/grl-tracker-source-api.h | 2 ++
src/tracker/grl-tracker-source.c | 1 +
3 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker/grl-tracker-source-api.c b/src/tracker/grl-tracker-source-api.c
index 65a8a7a..746ed13 100644
--- a/src/tracker/grl-tracker-source-api.c
+++ b/src/tracker/grl-tracker-source-api.c
@@ -1293,6 +1293,28 @@ grl_tracker_source_get_caps (GrlSource *source,
return caps;
}
+GrlSupportedOps
+grl_tracker_source_supported_operations (GrlSource *source)
+{
+ gboolean is_extractor;
+ GrlSupportedOps ops;
+
+ /* Always supported operations. */
+ ops = GRL_OP_RESOLVE | GRL_OP_MEDIA_FROM_URI | GRL_OP_SEARCH | GRL_OP_QUERY |
+ GRL_OP_STORE_METADATA | GRL_OP_NOTIFY_CHANGE;
+
+ /* The extractor doesn’t support browsing; only resolving. */
+ is_extractor = g_str_has_prefix (grl_source_get_id (source),
+ "http://www.tracker-project.org"
+ "/ontologies/tracker"
+ "#extractor-data-source,");
+ if (!is_extractor) {
+ ops |= GRL_OP_BROWSE;
+ }
+
+ return ops;
+}
+
gboolean
grl_tracker_source_test_media_from_uri (GrlSource *source,
const gchar *uri)
diff --git a/src/tracker/grl-tracker-source-api.h b/src/tracker/grl-tracker-source-api.h
index ef51090..f452e75 100644
--- a/src/tracker/grl-tracker-source-api.h
+++ b/src/tracker/grl-tracker-source-api.h
@@ -66,6 +66,8 @@ gboolean grl_tracker_source_change_stop (GrlSource *source,
GrlCaps *grl_tracker_source_get_caps (GrlSource *source,
GrlSupportedOps operation);
+GrlSupportedOps grl_tracker_source_supported_operations (GrlSource *source);
+
gboolean grl_tracker_source_test_media_from_uri (GrlSource *source,
const gchar *uri);
diff --git a/src/tracker/grl-tracker-source.c b/src/tracker/grl-tracker-source.c
index 53021c1..858565b 100644
--- a/src/tracker/grl-tracker-source.c
+++ b/src/tracker/grl-tracker-source.c
@@ -110,6 +110,7 @@ grl_tracker_source_class_init (GrlTrackerSourceClass * klass)
source_class->browse = grl_tracker_source_browse;
source_class->notify_change_start = grl_tracker_source_change_start;
source_class->notify_change_stop = grl_tracker_source_change_stop;
+ source_class->supported_operations = grl_tracker_source_supported_operations;
source_class->get_caps = grl_tracker_source_get_caps;
source_class->test_media_from_uri = grl_tracker_source_test_media_from_uri;
source_class->media_from_uri = grl_tracker_source_get_media_from_uri;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]