[tracker/wip/carlosg/domain-ontologies: 19/21] tracker-miner-fs: If there is a domain, set a watch on it



commit 1189ffcbeda027da4f77f38d64c3d1483334870c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Jun 21 21:42:19 2017 +0200

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

 src/miners/fs/tracker-main.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index 062734e..3b41e8f 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -674,6 +674,15 @@ miner_needs_check (TrackerMiner *miner,
        }
 }
 
+static void
+on_domain_vanished (GDBusConnection *connection,
+                    const gchar     *name,
+                    gpointer         user_data)
+{
+       GMainLoop *loop = user_data;
+       g_main_loop_quit (loop);
+}
+
 int
 main (gint argc, gchar *argv[])
 {
@@ -783,6 +792,13 @@ main (gint argc, gchar *argv[])
 
        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);
+       }
+
        g_message ("Checking if we're running as a daemon:");
        g_message ("  %s %s",
                   no_daemon ? "No" : "Yes",


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