[grilo-plugins/0.1.x] tracker: Make showing documents a default option
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins/0.1.x] tracker: Make showing documents a default option
- Date: Fri, 9 Dec 2011 12:19:56 +0000 (UTC)
commit fc4665d87b4e15636ca70451c89e383892379fe1
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Fri Dec 9 12:08:16 2011 +0000
tracker: Make showing documents a default option
Add a new option "show-documents" that makes Tracker to expose documents as valid multimedia content.
Turned off by default.
Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>
src/media/tracker/grl-tracker-media-api.c | 27 ++++++++++++++++++---------
src/media/tracker/grl-tracker-media-priv.h | 1 +
src/media/tracker/grl-tracker.c | 3 +++
3 files changed, 22 insertions(+), 9 deletions(-)
---
diff --git a/src/media/tracker/grl-tracker-media-api.c b/src/media/tracker/grl-tracker-media-api.c
index 59be6f9..390e870 100644
--- a/src/media/tracker/grl-tracker-media-api.c
+++ b/src/media/tracker/grl-tracker-media-api.c
@@ -87,6 +87,9 @@ GRL_LOG_DOMAIN_STATIC(tracker_media_result_log_domain);
"OFFSET %i " \
"LIMIT %i"
+#define TRACKER_BROWSE_SHOW_DOCUMENTS \
+ "{ ?urn a nfo:Document } UNION"
+
#define TRACKER_BROWSE_CATEGORY_REQUEST \
"SELECT rdf:type(?urn) %s " \
"WHERE " \
@@ -103,9 +106,9 @@ GRL_LOG_DOMAIN_STATIC(tracker_media_result_log_domain);
"SELECT DISTINCT rdf:type(?urn) %s " \
"WHERE " \
"{ " \
+ "%s " \
"{ ?urn a nfo:Folder } UNION " \
"{ ?urn a nfo:Audio } UNION " \
- "{ ?urn a nfo:Document } UNION " \
"{ ?urn a nmm:Photo } UNION " \
"{ ?urn a nmm:Video } . " \
"%s " \
@@ -119,9 +122,9 @@ GRL_LOG_DOMAIN_STATIC(tracker_media_result_log_domain);
"SELECT DISTINCT rdf:type(?urn) %s " \
"WHERE " \
"{ " \
+ "%s " \
"{ ?urn a nfo:Folder } UNION " \
"{ ?urn a nfo:Audio } UNION " \
- "{ ?urn a nfo:Document } UNION " \
"{ ?urn a nmm:Photo } UNION " \
"{ ?urn a nmm:Video } . " \
"%s " \
@@ -615,7 +618,9 @@ grl_tracker_media_metadata (GrlMediaSource *source,
constraint = grl_tracker_media_get_device_constraint (priv);
sparql_select = grl_tracker_media_get_select_string (ms->keys);
sparql_final = g_strdup_printf (TRACKER_BROWSE_FILESYSTEM_ROOT_REQUEST,
- sparql_select, constraint, 0, 1);
+ sparql_select,
+ grl_tracker_show_documents? TRACKER_BROWSE_SHOW_DOCUMENTS: "",
+ constraint, 0, 1);
} else {
ms->callback (ms->source, ms->metadata_id, ms->media, ms->user_data, NULL);
return;
@@ -731,12 +736,14 @@ grl_tracker_media_browse_category (GrlMediaSource *source,
!grl_data_has_key (GRL_DATA (bs->container),
grl_metadata_key_tracker_category)) {
/* Hardcoded categories */
- media = grl_media_box_new ();
- grl_media_set_title (media, "Documents");
- grl_data_set_string (GRL_DATA (media),
- grl_metadata_key_tracker_category,
- "nfo:Document");
- bs->callback (bs->source, bs->browse_id, media, 3, bs->user_data, NULL);
+ if (grl_tracker_show_documents) {
+ media = grl_media_box_new ();
+ grl_media_set_title (media, "Documents");
+ grl_data_set_string (GRL_DATA (media),
+ grl_metadata_key_tracker_category,
+ "nfo:Document");
+ bs->callback (bs->source, bs->browse_id, media, 3, bs->user_data, NULL);
+ }
media = grl_media_box_new ();
grl_media_set_title (media, "Music");
@@ -807,12 +814,14 @@ grl_tracker_media_browse_filesystem (GrlMediaSource *source,
!grl_media_get_id (bs->container)) {
sparql_final = g_strdup_printf (TRACKER_BROWSE_FILESYSTEM_ROOT_REQUEST,
sparql_select,
+ grl_tracker_show_documents? TRACKER_BROWSE_SHOW_DOCUMENTS: "",
constraint,
bs->skip, bs->count);
} else {
sparql_final = g_strdup_printf (TRACKER_BROWSE_FILESYSTEM_REQUEST,
sparql_select,
+ grl_tracker_show_documents? TRACKER_BROWSE_SHOW_DOCUMENTS: "",
constraint,
grl_media_get_id (bs->container),
bs->skip, bs->count);
diff --git a/src/media/tracker/grl-tracker-media-priv.h b/src/media/tracker/grl-tracker-media-priv.h
index 6d6d13b..5b4cffd 100644
--- a/src/media/tracker/grl-tracker-media-priv.h
+++ b/src/media/tracker/grl-tracker-media-priv.h
@@ -80,5 +80,6 @@ extern gboolean grl_tracker_upnp_present;
/* tracker plugin config */
extern gboolean grl_tracker_per_device_source;
extern gboolean grl_tracker_browse_filesystem;
+extern gboolean grl_tracker_show_documents;
#endif /* _GRL_TRACKER_MEDIA_PRIV_H_ */
diff --git a/src/media/tracker/grl-tracker.c b/src/media/tracker/grl-tracker.c
index bcaede7..eb9653f 100644
--- a/src/media/tracker/grl-tracker.c
+++ b/src/media/tracker/grl-tracker.c
@@ -82,6 +82,7 @@ GrlTrackerQueue *grl_tracker_queue = NULL;
/* tracker plugin config */
gboolean grl_tracker_per_device_source = FALSE;
gboolean grl_tracker_browse_filesystem = FALSE;
+gboolean grl_tracker_show_documents = FALSE;
/* =================== Tracker Plugin =============== */
@@ -238,6 +239,8 @@ grl_tracker_plugin_init (GrlPluginRegistry *registry,
grl_config_get_boolean (config, "per-device-source");
grl_tracker_browse_filesystem =
grl_config_get_boolean (config, "browse-filesystem");
+ grl_tracker_show_documents =
+ grl_config_get_boolean (config, "show-documents");
}
tracker_sparql_connection_get_async (NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]