diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2019-12-20 18:15:34 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2020-02-17 18:57:45 +0100 |
commit | 260dc86276b360df0ebc2833580830899e2d2690 (patch) | |
tree | c1758637ce29599d03bc194d202f9398d189f66c /src/libtracker-sparql | |
parent | 337334432dca53abbfceefbafe60db1972daba13 (diff) | |
download | tracker-260dc86276b360df0ebc2833580830899e2d2690.tar.gz |
libtracker-sparql: Export TrackerNotifierEventCache for implementations
This API is private, expected to be used across implementations of
TrackerSparqlConnection/TrackerNotifier.
Diffstat (limited to 'src/libtracker-sparql')
-rw-r--r-- | src/libtracker-sparql/tracker-notifier-private.h | 43 | ||||
-rw-r--r-- | src/libtracker-sparql/tracker-notifier.c | 43 |
2 files changed, 70 insertions, 16 deletions
diff --git a/src/libtracker-sparql/tracker-notifier-private.h b/src/libtracker-sparql/tracker-notifier-private.h new file mode 100644 index 000000000..9d019f6ca --- /dev/null +++ b/src/libtracker-sparql/tracker-notifier-private.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2019 Red Hat Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * Author: Carlos Garnacho <carlosg@gnome.org> + */ + +#ifndef __TRACKER_NOTIFIER_PRIVATE_H__ +#define __TRACKER_NOTIFIER_PRIVATE_H__ + +#include "tracker-notifier.h" + +typedef struct _TrackerNotifierEventCache TrackerNotifierEventCache; + +TrackerNotifierEventCache * _tracker_notifier_event_cache_new (TrackerNotifier *notifier, + const gchar *service, + const gchar *graph); +void _tracker_notifier_event_cache_free (TrackerNotifierEventCache *event_cache); + +gpointer _tracker_notifier_get_connection (TrackerNotifier *notifier); + +void +_tracker_notifier_event_cache_push_event (TrackerNotifierEventCache *cache, + gint64 id, + TrackerNotifierEventType event_type); + +void _tracker_notifier_event_cache_flush_events (TrackerNotifierEventCache *cache); + +#endif /* __TRACKER_NOTIFIER_PRIVATE_H__ */ diff --git a/src/libtracker-sparql/tracker-notifier.c b/src/libtracker-sparql/tracker-notifier.c index a532275a5..2ee9e2d63 100644 --- a/src/libtracker-sparql/tracker-notifier.c +++ b/src/libtracker-sparql/tracker-notifier.c @@ -66,6 +66,7 @@ #include "config.h" #include "tracker-notifier.h" +#include "tracker-notifier-private.h" #include "tracker-sparql-enum-types.h" #include "tracker-generated-no-checks.h" #include <libtracker-common/tracker-common.h> @@ -175,10 +176,10 @@ compare_event_cb (gconstpointer a, return event1->id - event2->id; } -static TrackerNotifierEventCache * -tracker_notifier_event_cache_new (TrackerNotifier *notifier, - const gchar *service, - const gchar *graph) +TrackerNotifierEventCache * +_tracker_notifier_event_cache_new (TrackerNotifier *notifier, + const gchar *service, + const gchar *graph) { TrackerNotifierEventCache *event_cache; @@ -191,8 +192,8 @@ tracker_notifier_event_cache_new (TrackerNotifier *notifier, return event_cache; } -static void -tracker_notifier_event_cache_free (TrackerNotifierEventCache *event_cache) +void +_tracker_notifier_event_cache_free (TrackerNotifierEventCache *event_cache) { g_sequence_free (event_cache->sequence); g_object_unref (event_cache->notifier); @@ -230,10 +231,10 @@ tracker_notifier_event_cache_get_event (TrackerNotifierEventCache *cache, return event; } -static void -tracker_notifier_event_cache_push_event (TrackerNotifierEventCache *cache, - gint64 id, - TrackerNotifierEventType event_type) +void +_tracker_notifier_event_cache_push_event (TrackerNotifierEventCache *cache, + gint64 id, + TrackerNotifierEventType event_type) { TrackerNotifierEvent *event; @@ -251,7 +252,7 @@ handle_events (TrackerNotifier *notifier, gint32 type, resource; while (g_variant_iter_loop (iter, "(ii)", &type, &resource)) - tracker_notifier_event_cache_push_event (cache, resource, type); + _tracker_notifier_event_cache_push_event (cache, resource, type); } static GPtrArray * @@ -390,8 +391,8 @@ tracker_notifier_query_extra_info (TrackerNotifier *notifier, g_object_unref (cursor); } -static void -tracker_notifier_event_cache_flush_events (TrackerNotifierEventCache *cache) +void +_tracker_notifier_event_cache_flush_events (TrackerNotifierEventCache *cache) { TrackerNotifier *notifier = cache->notifier; TrackerNotifierPrivate *priv = tracker_notifier_get_instance_private (notifier); @@ -426,14 +427,14 @@ graph_updated_cb (GDBusConnection *connection, g_variant_get (parameters, "(&sa(ii))", &graph, &events); service = g_strdup_printf ("dbus:%s", sender_name); - cache = tracker_notifier_event_cache_new (notifier, sender_name, graph); + cache = _tracker_notifier_event_cache_new (notifier, sender_name, graph); g_free (service); handle_events (notifier, cache, events); g_variant_iter_free (events); - tracker_notifier_event_cache_flush_events (cache); - tracker_notifier_event_cache_free (cache); + _tracker_notifier_event_cache_flush_events (cache); + _tracker_notifier_event_cache_free (cache); } static void @@ -613,6 +614,16 @@ tracker_notifier_signal_unsubscribe (TrackerNotifier *notifier, g_hash_table_remove (priv->subscriptions, GUINT_TO_POINTER (handler_id)); } +gpointer +_tracker_notifier_get_connection (TrackerNotifier *notifier) +{ + TrackerNotifierPrivate *priv; + + priv = tracker_notifier_get_instance_private (notifier); + + return priv->connection; +} + /** * tracker_notifier_event_get_event_type: * @event: A #TrackerNotifierEvent |