[grilo-plugins/wip/trackernotifier: 5/6] tracker: Remove per-device-source configuration
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins/wip/trackernotifier: 5/6] tracker: Remove per-device-source configuration
- Date: Tue, 12 Feb 2019 01:28:56 +0000 (UTC)
commit e67057068e49b52bee5185aeb474cfe5ddd86972
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Nov 25 15:13:11 2016 +0100
tracker: Remove per-device-source configuration
This is not entirely right, and could yield errors similar to commit
73c1aa1e7, where events go undetected because the deletion time of
properties is not guaranteed to be atomic, so there might be missed
events where files no longer qualify for certain notifications.
Given this is a configuration toggle meant for plugins/integrators,
it seems we can do without it.
Closes: #14
src/tracker/grl-tracker-source-api.c | 15 +----
src/tracker/grl-tracker-source-notif.c | 9 +--
src/tracker/grl-tracker-source-priv.h | 1 -
src/tracker/grl-tracker-source.c | 104 ++-------------------------------
src/tracker/grl-tracker.c | 3 -
5 files changed, 10 insertions(+), 122 deletions(-)
---
diff --git a/src/tracker/grl-tracker-source-api.c b/src/tracker/grl-tracker-source-api.c
index be7fa4b..0bd8147 100644
--- a/src/tracker/grl-tracker-source-api.c
+++ b/src/tracker/grl-tracker-source-api.c
@@ -868,19 +868,8 @@ grl_tracker_source_resolve (GrlSource *source,
/* Check if the media comes from this source or another */
if (g_strcmp0 (priv->tracker_datasource, grl_source_get_id (rs->source)) == 0) {
if (grl_media_get_id (rs->media) == NULL) {
- if (grl_tracker_per_device_source) {
- constraint = grl_tracker_source_get_device_constraint (priv);
- sparql_select = grl_tracker_source_get_select_string (rs->keys);
- sparql_type_filter = get_sparql_type_filter (rs->options, TRUE);
- sparql_final = g_strdup_printf (TRACKER_BROWSE_FILESYSTEM_ROOT_REQUEST,
- sparql_select,
- grl_tracker_show_documents? TRACKER_BROWSE_SHOW_DOCUMENTS: "",
- sparql_type_filter,
- constraint, 0, 1);
- } else {
- rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, NULL);
- return;
- }
+ rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, NULL);
+ return;
} else {
sparql_select = grl_tracker_source_get_select_string (rs->keys);
sparql_final = g_strdup_printf (TRACKER_RESOLVE_REQUEST, sparql_select,
diff --git a/src/tracker/grl-tracker-source-notif.c b/src/tracker/grl-tracker-source-notif.c
index 240a753..cca2071 100644
--- a/src/tracker/grl-tracker-source-notif.c
+++ b/src/tracker/grl-tracker-source-notif.c
@@ -110,14 +110,9 @@ notify_change (GrlTrackerSourceNotify *self,
if (info == NULL)
goto out;
- if (!grl_tracker_per_device_source)
- source = grl_tracker_source_find ("");
+ source = grl_tracker_source_find ("");
- if (!source && info->datasource)
- source = grl_tracker_source_find (info->datasource);
-
- if (!source || !GRL_IS_TRACKER_SOURCE (source) ||
- !grl_tracker_source_can_notify (source))
+ if (!source || !grl_tracker_source_can_notify (source))
goto out;
id_str = g_strdup_printf ("%i", id);
diff --git a/src/tracker/grl-tracker-source-priv.h b/src/tracker/grl-tracker-source-priv.h
index 36c2937..fbb7afd 100644
--- a/src/tracker/grl-tracker-source-priv.h
+++ b/src/tracker/grl-tracker-source-priv.h
@@ -81,7 +81,6 @@ extern GrlTrackerCache *grl_tracker_item_cache;
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;
diff --git a/src/tracker/grl-tracker-source.c b/src/tracker/grl-tracker-source.c
index e1e4cf4..112f728 100644
--- a/src/tracker/grl-tracker-source.c
+++ b/src/tracker/grl-tracker-source.c
@@ -290,86 +290,6 @@ grl_tracker_source_find_source (const gchar *id)
return source;
}
-static void
-tracker_get_datasource_cb (GObject *object,
- GAsyncResult *result,
- TrackerSparqlCursor *cursor)
-{
- const gchar *type, *datasource, *datasource_name, *uri;
- gboolean source_available = FALSE;
- GError *error = NULL;
- GrlTrackerSource *source;
-
- GRL_DEBUG ("%s", __FUNCTION__);
-
- if (!tracker_sparql_cursor_next_finish (cursor, result, &error)) {
- if (error == NULL) {
- GRL_DEBUG ("\tEnd of parsing of devices");
- } else {
- GRL_WARNING ("\tError while parsing devices: %s", error->message);
- g_error_free (error);
- }
- g_object_unref (G_OBJECT (cursor));
- return;
- }
-
- type = tracker_sparql_cursor_get_string (cursor, 0, NULL);
- datasource = tracker_sparql_cursor_get_string (cursor, 1, NULL);
- datasource_name = tracker_sparql_cursor_get_string (cursor, 2, NULL);
- uri = tracker_sparql_cursor_get_string (cursor, 3, NULL);
- if (tracker_sparql_cursor_is_bound (cursor, 4))
- source_available = tracker_sparql_cursor_get_boolean (cursor, 4);
-
- source = grl_tracker_source_find (datasource);
-
- if ((source == NULL) && source_available) {
- gchar *source_name = grl_tracker_get_source_name (type, uri, datasource,
- datasource_name);
- if (source_name) {
- GRL_DEBUG ("\tnew datasource: urn=%s name=%s uri=%s => name=%s\n",
- datasource, datasource_name, uri, source_name);
- source = g_object_new (GRL_TRACKER_SOURCE_TYPE,
- "source-id", datasource,
- "source-name", source_name,
- "source-desc", GRL_TRACKER_SOURCE_DESC,
- "tracker-connection", grl_tracker_connection,
- "tracker-datasource", datasource,
- NULL);
- grl_tracker_add_source (source);
- g_object_unref (source);
- g_free (source_name);
- }
- }
-
- tracker_sparql_cursor_next_async (cursor, NULL,
- (GAsyncReadyCallback) tracker_get_datasource_cb,
- cursor);
-}
-
-static void
-tracker_get_datasources_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_WARNING ("Cannot handle datasource request : %s", error->message);
- g_error_free (error);
- return;
- }
-
- tracker_sparql_cursor_next_async (cursor, NULL,
- (GAsyncReadyCallback) tracker_get_datasource_cb,
- cursor);
-}
-
void
grl_tracker_source_sources_init (void)
{
@@ -384,25 +304,13 @@ grl_tracker_source_sources_init (void)
NULL, g_object_unref);
if (grl_tracker_connection != NULL) {
+ GrlTrackerSource *source;
+
grl_tracker_source_dbus_start_watch ();
- if (grl_tracker_per_device_source == TRUE) {
- /* Let's discover available data sources. */
- GRL_DEBUG ("\tper device source mode request: '"
- TRACKER_DATASOURCES_REQUEST "'");
-
- tracker_sparql_connection_query_async (grl_tracker_connection,
- TRACKER_DATASOURCES_REQUEST,
- NULL,
- (GAsyncReadyCallback) tracker_get_datasources_cb,
- NULL);
- } else {
- GrlTrackerSource *source;
-
- /* One source to rule them all. */
- source = grl_tracker_source_new (grl_tracker_connection);
- grl_tracker_add_source (source);
- g_object_unref (source);
- }
+ /* One source to rule them all. */
+ source = grl_tracker_source_new (grl_tracker_connection);
+ grl_tracker_add_source (source);
+ g_object_unref (source);
}
}
diff --git a/src/tracker/grl-tracker.c b/src/tracker/grl-tracker.c
index 40e0e2f..96527d1 100644
--- a/src/tracker/grl-tracker.c
+++ b/src/tracker/grl-tracker.c
@@ -80,7 +80,6 @@ gboolean grl_tracker_upnp_present = FALSE;
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;
@@ -242,8 +241,6 @@ grl_tracker_plugin_init (GrlRegistry *registry,
config = GRL_CONFIG (configs->data);
- grl_tracker_per_device_source =
- grl_config_get_boolean (config, "per-device-source");
grl_tracker_browse_filesystem =
grl_config_get_boolean (config, "browse-filesystem");
grl_tracker_show_documents =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]