[grilo-plugins/wip/carlosg/tracker3: 4/40] tracker3: Drop browse-filesystem configuration option
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins/wip/carlosg/tracker3: 4/40] tracker3: Drop browse-filesystem configuration option
- Date: Sun, 21 Jun 2020 23:03:16 +0000 (UTC)
commit 2942c2007071c1d2cf01966a82a677bb8392ef69
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon May 11 12:39:59 2020 +0200
tracker3: Drop browse-filesystem configuration option
Besides allowing to browse folders as media containers, this option
makes change notifications work by enabling tracker:notify on nfo:Folder
type, so the grilo client (and everyone else, really ) may receive
TrackerNotifier notifications about folder additions/changes.
It's not in the hand of a client to do this, it ought not. Besides the
option seems completely unused according to codesearch.debian.net.
The Tracker plugin should not be intended for browsing as a filesystem
structure, and it is possible to create media containers specifically
for folders that do contain media. Drop this configuration option in
the tracker3 module.
src/tracker3/grl-tracker-source-api.c | 92 +---------------------------------
src/tracker3/grl-tracker-source-priv.h | 1 -
src/tracker3/grl-tracker.c | 82 +-----------------------------
3 files changed, 2 insertions(+), 173 deletions(-)
---
diff --git a/src/tracker3/grl-tracker-source-api.c b/src/tracker3/grl-tracker-source-api.c
index 5abf3a05..92958da5 100644
--- a/src/tracker3/grl-tracker-source-api.c
+++ b/src/tracker3/grl-tracker-source-api.c
@@ -113,32 +113,6 @@ GRL_LOG_DOMAIN_STATIC(tracker_source_result_log_domain);
"OFFSET %u " \
"LIMIT %u"
-#define TRACKER_BROWSE_FILESYSTEM_ROOT_REQUEST \
- "SELECT DISTINCT rdf:type(?urn) %s " \
- "WHERE " \
- "{ " \
- "%s " \
- "{ ?urn a nfo:Folder } %s " \
- "%s " \
- "FILTER (!bound(nfo:belongsToContainer(?urn))) " \
- "} " \
- "ORDER BY DESC(nfo:fileLastModified(?urn)) " \
- "OFFSET %u " \
- "LIMIT %u"
-
-#define TRACKER_BROWSE_FILESYSTEM_REQUEST \
- "SELECT DISTINCT rdf:type(?urn) %s " \
- "WHERE " \
- "{ " \
- "%s " \
- "{ ?urn a nfo:Folder } %s " \
- "%s " \
- "FILTER(tracker:id(nfo:belongsToContainer(?urn)) = %s) " \
- "} " \
- "ORDER BY DESC(nfo:fileLastModified(?urn)) " \
- "OFFSET %u " \
- "LIMIT %u"
-
#define TRACKER_RESOLVE_REQUEST \
"SELECT %s " \
"WHERE " \
@@ -1217,67 +1191,6 @@ grl_tracker_source_browse_category (GrlSource *source,
g_free (duration_constraint);
}
-static void
-grl_tracker_source_browse_filesystem (GrlSource *source,
- GrlSourceBrowseSpec *bs)
-{
- GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
- gchar *constraint;
- gchar *sparql_select;
- gchar *sparql_final;
- gchar *sparql_type_filter;
- GrlTrackerOp *os;
- gint count = grl_operation_options_get_count (bs->options);
- guint skip = grl_operation_options_get_skip (bs->options);
- int min_dur, max_dur;
- char *duration_constraint;
-
- GRL_IDEBUG ("%s: id=%u", __FUNCTION__, bs->operation_id);
-
- sparql_select = grl_tracker_source_get_select_string (bs->keys);
- constraint = grl_tracker_source_get_device_constraint (priv);
- sparql_type_filter = get_sparql_type_filter (bs->options, TRUE);
- grl_tracker_source_get_duration_min_max (bs->options, &min_dur, &max_dur);
- duration_constraint = grl_tracker_source_create_constraint (min_dur, max_dur);
-
- if (bs->container == NULL ||
- !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: "",
- sparql_type_filter,
- constraint,
- skip, count);
-
- } else {
- sparql_final = g_strdup_printf (TRACKER_BROWSE_FILESYSTEM_REQUEST,
- sparql_select,
- grl_tracker_show_documents? TRACKER_BROWSE_SHOW_DOCUMENTS: "",
- sparql_type_filter,
- constraint,
- grl_media_get_id (bs->container),
- skip, count);
- }
-
- GRL_IDEBUG ("\tselect: '%s'", sparql_final);
-
- os = grl_tracker_op_initiate_query (bs->operation_id,
- sparql_final,
- (GAsyncReadyCallback) tracker_browse_cb,
- bs);
- os->keys = bs->keys;
- os->skip = skip;
- os->count = count;
- os->type_filter = grl_operation_options_get_type_filter (bs->options);
-
- grl_tracker_queue_push (grl_tracker_queue, os);
-
- g_free (sparql_type_filter);
- g_free (constraint);
- g_free (sparql_select);
- g_free (duration_constraint);
-}
-
void
grl_tracker_source_browse (GrlSource *source,
GrlSourceBrowseSpec *bs)
@@ -1286,10 +1199,7 @@ grl_tracker_source_browse (GrlSource *source,
if (!g_list_find (bs->keys, GRLKEYID_TO_POINTER (GRL_METADATA_KEY_ID)))
bs->keys = g_list_prepend (bs->keys, GRLKEYID_TO_POINTER (GRL_METADATA_KEY_ID));
- if (grl_tracker_browse_filesystem)
- grl_tracker_source_browse_filesystem (source, bs);
- else
- grl_tracker_source_browse_category (source, bs);
+ grl_tracker_source_browse_category (source, bs);
}
void
diff --git a/src/tracker3/grl-tracker-source-priv.h b/src/tracker3/grl-tracker-source-priv.h
index f396ae1c..42e50b5b 100644
--- a/src/tracker3/grl-tracker-source-priv.h
+++ b/src/tracker3/grl-tracker-source-priv.h
@@ -80,7 +80,6 @@ extern GrlPlugin *grl_tracker_plugin;
extern GrlTrackerCache *grl_tracker_item_cache;
/* tracker plugin config */
-extern gboolean grl_tracker_browse_filesystem;
extern gboolean grl_tracker_show_documents;
#endif /* _GRL_TRACKER_SOURCE_PRIV_H_ */
diff --git a/src/tracker3/grl-tracker.c b/src/tracker3/grl-tracker.c
index 6b613f19..64d5e3ee 100644
--- a/src/tracker3/grl-tracker.c
+++ b/src/tracker3/grl-tracker.c
@@ -43,21 +43,6 @@
#define GRL_LOG_DOMAIN_DEFAULT tracker_general_log_domain
GRL_LOG_DOMAIN_STATIC(tracker_general_log_domain);
-/* ------- Definitions ------- */
-
-#define TRACKER_FOLDER_CLASS_REQUEST \
- "SELECT ?urn WHERE " \
- "{ " \
- "?urn a rdfs:Class . " \
- "FILTER(fn:ends-with(?urn,\"nfo#Folder\")) " \
- "}"
-
-#define TRACKER_NOTIFY_FOLDER_UPDATE \
- "INSERT " \
- "{ " \
- "<%s> tracker:notify true " \
- "}"
-
/* --- Other --- */
gboolean grl_tracker3_plugin_init (GrlRegistry *registry,
@@ -72,7 +57,6 @@ GCancellable *grl_tracker_plugin_init_cancel = NULL;
GrlTrackerQueue *grl_tracker_queue = NULL;
/* tracker plugin config */
-gboolean grl_tracker_browse_filesystem = FALSE;
gboolean grl_tracker_show_documents = FALSE;
/* =================== Tracker Plugin =============== */
@@ -91,59 +75,6 @@ init_sources (void)
}
}
-static void
-tracker_update_folder_class_cb (GObject *object,
- GAsyncResult *result,
- gpointer data)
-{
- init_sources ();
-}
-
-static void
-tracker_get_folder_class_cb (GObject *object,
- GAsyncResult *result,
- gpointer data)
-{
- GError *error = NULL;
- TrackerSparqlCursor *cursor;
-
- GRL_DEBUG ("%s", __FUNCTION__);
-
- cursor = tracker_sparql_connection_query_finish (grl_tracker_connection,
- result, &error);
-
- if (error) {
- GRL_INFO ("Could not execute sparql query for folder class: %s",
- error->message);
- g_error_free (error);
- }
-
- if (!cursor) {
- init_sources ();
- return;
- }
-
- if (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
- gchar *update = g_strdup_printf (TRACKER_NOTIFY_FOLDER_UPDATE,
- tracker_sparql_cursor_get_string (cursor,
- 0,
- NULL));
-
- GRL_DEBUG ("\tupdate query: '%s'", update);
-
- tracker_sparql_connection_update_async (grl_tracker_connection,
- update,
- G_PRIORITY_DEFAULT,
- NULL,
- tracker_update_folder_class_cb,
- NULL);
-
- g_free (update);
- }
-
- g_object_unref (cursor);
-}
-
static void
tracker_new_connection_cb (GObject *object,
GAsyncResult *res,
@@ -161,16 +92,7 @@ tracker_new_connection_cb (GObject *object,
return;
}
- GRL_DEBUG ("\trequest : '%s'", TRACKER_FOLDER_CLASS_REQUEST);
-
- if (grl_tracker_browse_filesystem)
- tracker_sparql_connection_query_async (grl_tracker_connection,
- TRACKER_FOLDER_CLASS_REQUEST,
- grl_tracker_plugin_init_cancel,
- tracker_get_folder_class_cb,
- NULL);
- else
- init_sources ();
+ init_sources ();
}
gboolean
@@ -202,8 +124,6 @@ grl_tracker3_plugin_init (GrlRegistry *registry,
config = GRL_CONFIG (configs->data);
- grl_tracker_browse_filesystem =
- grl_config_get_boolean (config, "browse-filesystem");
grl_tracker_show_documents =
grl_config_get_boolean (config, "show-documents");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]