[tracker] libtracker-data: Add tracker_data_manager_get_namespaces()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-data: Add tracker_data_manager_get_namespaces()
- Date: Tue, 11 Jul 2017 22:27:35 +0000 (UTC)
commit cce1b90bd893d8f0db8a8ad62e3f04305903604a
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Jul 11 00:01:07 2017 +0200
libtracker-data: Add tracker_data_manager_get_namespaces()
This will be used to fill in TrackerNamespaceManager objects that are
specific to a TrackerSparqlConnection.
src/libtracker-data/libtracker-data.vapi | 1 +
src/libtracker-data/tracker-data-manager.c | 19 +++++++++++++++++++
src/libtracker-data/tracker-data-manager.h | 2 ++
3 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/libtracker-data.vapi b/src/libtracker-data/libtracker-data.vapi
index 294b735..b2582c8 100644
--- a/src/libtracker-data/libtracker-data.vapi
+++ b/src/libtracker-data/libtracker-data.vapi
@@ -241,6 +241,7 @@ namespace Tracker {
public unowned DBInterface get_wal_db_interface ();
public unowned Data.Update get_data ();
public void shutdown ();
+ public GLib.HashTable<string,string> get_namespaces ();
}
[CCode (cheader_filename = "libtracker-data/tracker-db-interface-sqlite.h")]
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index d38b90a..737b2f8 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -4672,3 +4672,22 @@ tracker_data_manager_shutdown (TrackerDataManager *manager)
{
g_object_run_dispose (G_OBJECT (manager));
}
+
+GHashTable *
+tracker_data_manager_get_namespaces (TrackerDataManager *manager)
+{
+ TrackerNamespace **namespaces;
+ guint i, n_namespaces;
+ GHashTable *ht;
+
+ ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+ namespaces = tracker_ontologies_get_namespaces (manager->ontologies,
+ &n_namespaces);
+ for (i = 0; i < n_namespaces; i++) {
+ g_hash_table_insert (ht,
+ g_strdup (tracker_namespace_get_prefix (namespaces[i])),
+ g_strdup (tracker_namespace_get_uri (namespaces[i])));
+ }
+
+ return ht;
+}
diff --git a/src/libtracker-data/tracker-data-manager.h b/src/libtracker-data/tracker-data-manager.h
index 828d078..cc9aa3b 100644
--- a/src/libtracker-data/tracker-data-manager.h
+++ b/src/libtracker-data/tracker-data-manager.h
@@ -86,6 +86,8 @@ TrackerData * tracker_data_manager_get_data (TrackerDataManage
gboolean tracker_data_manager_init_fts (TrackerDBInterface *interface,
gboolean create);
+GHashTable * tracker_data_manager_get_namespaces (TrackerDataManager *manager);
+
G_END_DECLS
#endif /* __LIBTRACKER_DATA_MANAGER_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]