[tracker/wip/carlosg/domain-ontologies: 5/5] tracker-extract: If there is a domain, set watch on it



commit d3ffb81d50315214075de4df9d4bd60801c13489
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jun 21 21:45:26 2017 +0200

    tracker-extract: If there is a domain, set watch on it
    
    And exit as soon as the name vanishes. It may safely continue
    its operations on the next startup.

 src/tracker-extract/tracker-main.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker-extract/tracker-main.c b/src/tracker-extract/tracker-main.c
index 2bcfad4..3fd801b 100644
--- a/src/tracker-extract/tracker-main.c
+++ b/src/tracker-extract/tracker-main.c
@@ -300,6 +300,15 @@ run_standalone (TrackerConfig *config)
        return EXIT_SUCCESS;
 }
 
+static void
+on_domain_vanished (GDBusConnection *connection,
+                    const gchar     *name,
+                    gpointer         user_data)
+{
+       GMainLoop *loop = user_data;
+       g_main_loop_quit (loop);
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -441,6 +450,13 @@ main (int argc, char *argv[])
        /* Main loop */
        main_loop = g_main_loop_new (NULL, FALSE);
 
+       if (domain_ontology && domain_ontology_name) {
+               g_bus_watch_name_on_connection (connection, domain_ontology_name,
+                                               G_BUS_NAME_WATCHER_FLAGS_NONE,
+                                               NULL, on_domain_vanished,
+                                               main_loop, NULL);
+       }
+
        initialize_signal_handler ();
 
        g_main_loop_run (main_loop);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]