[grilo-plugins/wip/carlosg/tracker3: 9/9] tracker3: Listen to notifications from tracker-miner-fs
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins/wip/carlosg/tracker3: 9/9] tracker3: Listen to notifications from tracker-miner-fs
- Date: Sun, 14 Jun 2020 17:50:23 +0000 (UTC)
commit 99750d3da40fb68a3408e97232cebf68e1c42975
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Jun 14 19:47:30 2020 +0200
tracker3: Listen to notifications from tracker-miner-fs
This should be added explicitly, just in case the connection is local
(and thus does not listen to events from tracker-miner-fs bus name by
default).
src/tracker3/grl-tracker-source-notif.c | 9 +++++++++
src/tracker3/grl-tracker-utils.c | 8 ++++++++
src/tracker3/grl-tracker.c | 3 ++-
3 files changed, 19 insertions(+), 1 deletion(-)
---
diff --git a/src/tracker3/grl-tracker-source-notif.c b/src/tracker3/grl-tracker-source-notif.c
index b025b7c7..c84dc82f 100644
--- a/src/tracker3/grl-tracker-source-notif.c
+++ b/src/tracker3/grl-tracker-source-notif.c
@@ -174,10 +174,19 @@ static void
grl_tracker_source_notify_constructed (GObject *object)
{
GrlTrackerSourceNotify *self = GRL_TRACKER_SOURCE_NOTIFY (object);
+ GDBusConnection *bus_connection;
self->notifier =
tracker_sparql_connection_create_notifier (self->connection,
TRACKER_NOTIFIER_FLAG_QUERY_URN);
+
+ bus_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+ tracker_notifier_signal_subscribe (self->notifier,
+ bus_connection,
+ "org.freedesktop.Tracker3.Miner.Files",
+ NULL);
+ g_object_unref (bus_connection);
+
self->events_signal_id =
g_signal_connect_swapped (self->notifier, "events",
G_CALLBACK (notifier_event_cb), object);
diff --git a/src/tracker3/grl-tracker-utils.c b/src/tracker3/grl-tracker-utils.c
index a90e79bf..ef9badb5 100644
--- a/src/tracker3/grl-tracker-utils.c
+++ b/src/tracker3/grl-tracker-utils.c
@@ -543,6 +543,14 @@ grl_tracker_build_resource_from_media (GrlMedia *media, GList *keys)
} else if (l->data == GRLKEYID_TO_POINTER (GRL_METADATA_KEY_EPISODE)) {
tracker_resource_set_int (resource, "nmm:episodeNumber",
grl_media_get_episode (media));
+ } else if (l->data == GRLKEYID_TO_POINTER (GRL_METADATA_KEY_CREATION_DATE)) {
+ GDateTime *creation;
+ gchar *date;
+
+ creation = grl_media_get_creation_date (media);
+ date = g_date_time_format_iso8601 (creation);
+ tracker_resource_set_string (resource, "nie:contentCreated", date);
+ g_free (date);
} else if (l->data == GRLKEYID_TO_POINTER (GRL_METADATA_KEY_ALBUM)) {
TrackerResource *album;
album = ensure_resource_for_property (resource, "nmm:musicAlbum", FALSE);
diff --git a/src/tracker3/grl-tracker.c b/src/tracker3/grl-tracker.c
index 3f20d4f4..059463ca 100644
--- a/src/tracker3/grl-tracker.c
+++ b/src/tracker3/grl-tracker.c
@@ -125,7 +125,7 @@ grl_tracker3_plugin_init (GrlRegistry *registry,
if (grl_tracker_store_path)
store = g_file_new_for_path (grl_tracker_store_path);
ontology = tracker_sparql_get_ontology_nepomuk ();
- tracker_sparql_connection_new_async (TRACKER_SPARQL_CONNECTION_FLAGS_NONE,
+ tracker_sparql_connection_new_async (TRACKER_SPARQL_CONNECTION_FLAGS_READONLY,
store,
ontology,
grl_tracker_plugin_init_cancel,
@@ -141,6 +141,7 @@ grl_tracker3_plugin_deinit (GrlPlugin *plugin)
{
g_cancellable_cancel (grl_tracker_plugin_init_cancel);
g_clear_object (&grl_tracker_plugin_init_cancel);
+ g_clear_object (&grl_tracker_connection);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]