[tracker-miners/wip/carlosg/tracker-3.0-api-breaks: 26/57] libtracker-miner: Create TrackerNotifier the new way
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/tracker-3.0-api-breaks: 26/57] libtracker-miner: Create TrackerNotifier the new way
- Date: Wed, 12 Feb 2020 15:27:49 +0000 (UTC)
commit 1e623677eb56904b7cde1e2074ba52730afbe57c
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Dec 24 08:51:54 2019 +0100
libtracker-miner: Create TrackerNotifier the new way
It's no longer created from scratch, but retrieved from the
connection. Also drop the NOTIFY_UNEXTRACTED flag since that is
default.
src/libtracker-miner/tracker-decorator.c | 45 ++++++++++----------------------
1 file changed, 14 insertions(+), 31 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-decorator.c b/src/libtracker-miner/tracker-decorator.c
index dfb55ea8b..7bcf11242 100644
--- a/src/libtracker-miner/tracker-decorator.c
+++ b/src/libtracker-miner/tracker-decorator.c
@@ -121,6 +121,8 @@ static void decorator_cache_next_items (TrackerDecorator *decorator);
static gboolean decorator_check_commit (TrackerDecorator *decorator);
static void notifier_events_cb (TrackerDecorator *decorator,
+ const gchar *service,
+ const gchar *graph,
GPtrArray *events,
TrackerNotifier *notifier);
@@ -935,32 +937,6 @@ decorator_cache_next_items (TrackerDecorator *decorator)
}
}
-static void
-update_notifier (TrackerDecorator *decorator)
-{
- TrackerDecoratorPrivate *priv = decorator->priv;
-
- g_clear_object (&priv->notifier);
-
- if (priv->class_names) {
- GError *error = NULL;
-
- priv->notifier = tracker_notifier_new ((const gchar * const *) priv->class_names,
- TRACKER_NOTIFIER_FLAG_NOTIFY_UNEXTRACTED,
- NULL, &error);
-
- if (error) {
- g_warning ("Could not create notifier: %s\n",
- error->message);
- g_error_free (error);
- }
-
- g_signal_connect_swapped (priv->notifier, "events",
- G_CALLBACK (notifier_events_cb),
- decorator);
- }
-}
-
static void
tracker_decorator_get_property (GObject *object,
guint param_id,
@@ -1016,8 +992,6 @@ decorator_set_classes (TrackerDecorator *decorator,
for (i = 0; classes[i]; i++) {
decorator_add_class (decorator, classes[i]);
}
-
- update_notifier (decorator);
}
static void
@@ -1052,8 +1026,10 @@ tracker_decorator_set_property (GObject *object,
static void
notifier_events_cb (TrackerDecorator *decorator,
- GPtrArray *events,
- TrackerNotifier *notifier)
+ const gchar *service,
+ const gchar *graph,
+ GPtrArray *events,
+ TrackerNotifier *notifier)
{
gboolean check_added = FALSE;
gint64 id;
@@ -1090,16 +1066,23 @@ tracker_decorator_initable_init (GInitable *initable,
GError **error)
{
TrackerDecorator *decorator;
+ TrackerDecoratorPrivate *priv;
+ TrackerSparqlConnection *conn;
if (!parent_initable_iface->init (initable, cancellable, error))
return FALSE;
decorator = TRACKER_DECORATOR (initable);
+ priv = tracker_decorator_get_instance_private (decorator);
if (g_cancellable_is_cancelled (cancellable))
return FALSE;
- update_notifier (decorator);
+ conn = tracker_miner_get_connection (TRACKER_MINER (decorator));
+ priv->notifier = tracker_sparql_connection_create_notifier (conn, 0);
+ g_signal_connect_swapped (priv->notifier, "events",
+ G_CALLBACK (notifier_events_cb),
+ decorator);
decorator_update_state (decorator, "Idle", FALSE);
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]