[tracker/wip/carlosg/domain-ontologies: 91/116] tracker-miner-apps: Add --domain-ontology switch
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/domain-ontologies: 91/116] tracker-miner-apps: Add --domain-ontology switch
- Date: Sun, 25 Jun 2017 13:12:48 +0000 (UTC)
commit ffeb2ff00cbc1c23bb91a7e7563b637e85a048f1
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Jun 19 20:57:46 2017 +0200
tracker-miner-apps: Add --domain-ontology switch
This allows tracker-miner-apps to dump data on other domain
ontologies than the default one.
src/miners/apps/tracker-main.c | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/src/miners/apps/tracker-main.c b/src/miners/apps/tracker-main.c
index 394a189..0d46cd0 100644
--- a/src/miners/apps/tracker-main.c
+++ b/src/miners/apps/tracker-main.c
@@ -44,7 +44,7 @@
"\n" \
" http://www.gnu.org/licenses/gpl.txt\n"
-#define DBUS_NAME "org.freedesktop.Tracker1.Miner.Applications"
+#define DBUS_NAME_SUFFIX "Miner.Applications"
#define DBUS_PATH "/org/freedesktop/Tracker1/Miner/Applications"
static GMainLoop *main_loop;
@@ -52,6 +52,7 @@ static GMainLoop *main_loop;
static gint verbosity = -1;
static gboolean no_daemon;
static gboolean version;
+static gchar *domain_ontology_name = NULL;
static GOptionEntry entries[] = {
{ "verbosity", 'v', 0,
@@ -63,6 +64,10 @@ static GOptionEntry entries[] = {
G_OPTION_ARG_NONE, &no_daemon,
N_("Runs until all applications are indexed and then exits"),
NULL },
+ { "domain-ontology", 'd', 0,
+ G_OPTION_ARG_STRING, &domain_ontology_name,
+ N_("Runs for an specific domain ontology"),
+ NULL },
{ "version", 'V', 0,
G_OPTION_ARG_NONE, &version,
N_("Displays version information"),
@@ -171,6 +176,8 @@ main (gint argc, gchar *argv[])
gchar *log_filename = NULL;
GDBusConnection *connection;
TrackerMinerProxy *proxy;
+ TrackerDomainOntology *domain_ontology;
+ gchar *dbus_name;
main_loop = NULL;
@@ -203,6 +210,16 @@ main (gint argc, gchar *argv[])
return EXIT_SUCCESS;
}
+ tracker_sparql_connection_set_domain (domain_ontology_name);
+
+ domain_ontology = tracker_domain_ontology_new (domain_ontology_name, NULL, &error);
+ if (error) {
+ g_critical ("Could not load domain ontology '%s': %s",
+ domain_ontology_name, error->message);
+ g_error_free (error);
+ return EXIT_FAILURE;
+ }
+
connection = g_bus_get_sync (TRACKER_IPC_BUS, NULL, &error);
if (error) {
g_critical ("Could not create DBus connection: %s\n",
@@ -211,13 +228,18 @@ main (gint argc, gchar *argv[])
return EXIT_FAILURE;
}
- if (!tracker_dbus_request_name (connection, DBUS_NAME, &error)) {
+ dbus_name = tracker_domain_ontology_get_domain (domain_ontology, DBUS_NAME_SUFFIX);
+
+ if (!tracker_dbus_request_name (connection, dbus_name, &error)) {
g_critical ("Could not request DBus name '%s': %s",
- DBUS_NAME, error->message);
+ dbus_name, error->message);
g_error_free (error);
+ g_free (dbus_name);
return EXIT_FAILURE;
}
+ g_free (dbus_name);
+
tracker_log_init (verbosity, &log_filename);
if (log_filename) {
g_message ("Using log file:'%s'", log_filename);
@@ -261,6 +283,7 @@ main (gint argc, gchar *argv[])
g_object_unref (G_OBJECT (miner_applications));
g_object_unref (connection);
g_object_unref (proxy);
+ g_object_unref (domain_ontology);
tracker_log_shutdown ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]