Commit 34253e00 authored by Carlos Garnacho's avatar Carlos Garnacho

miners: Request DBus name after creating miner objects

Fixes those not seeming to autostart properly through the
"tracker daemon -s" CLI command, because it calls for a method
in an object that's not yet created at the time the DBus name
is visible.
parent bbcfd475
......@@ -237,18 +237,6 @@ main (gint argc, gchar *argv[])
return EXIT_FAILURE;
}
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);
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);
......@@ -293,6 +281,19 @@ main (gint argc, gchar *argv[])
G_CALLBACK (miner_finished_cb),
NULL);
/* Request DBus name */
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);
g_error_free (error);
g_free (dbus_name);
return EXIT_FAILURE;
}
g_free (dbus_name);
initialize_signal_handler ();
/* Go, go, go! */
......
......@@ -754,18 +754,6 @@ main (gint argc, gchar *argv[])
return EXIT_FAILURE;
}
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);
g_error_free (error);
g_free (dbus_name);
return EXIT_FAILURE;
}
g_free (dbus_name);
/* Initialize logging */
config = tracker_config_new ();
......@@ -847,6 +835,19 @@ main (gint argc, gchar *argv[])
return EXIT_FAILURE;
}
/* Request DBus name */
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);
g_error_free (error);
g_free (dbus_name);
return EXIT_FAILURE;
}
g_free (dbus_name);
/* Check if we should crawl and if we should force mtime
* checking based on the config.
*/
......
......@@ -188,18 +188,6 @@ main (int argc, char **argv)
return EXIT_FAILURE;
}
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);
g_error_free (error);
g_free (dbus_name);
return EXIT_FAILURE;
}
g_free (dbus_name);
miner = tracker_miner_rss_new (&error);
if (!miner) {
g_critical ("Could not create new RSS miner: '%s', exiting...\n",
......@@ -215,6 +203,18 @@ main (int argc, char **argv)
return EXIT_FAILURE;
}
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);
g_error_free (error);
g_free (dbus_name);
return EXIT_FAILURE;
}
g_free (dbus_name);
loop = g_main_loop_new (NULL, FALSE);
if (domain_ontology && domain_ontology_name) {
......
......@@ -378,18 +378,6 @@ main (int argc, char *argv[])
return EXIT_FAILURE;
}
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);
g_error_free (error);
g_free (dbus_name);
return EXIT_FAILURE;
}
g_free (dbus_name);
config = tracker_config_new ();
/* Extractor command line arguments */
......@@ -455,6 +443,19 @@ main (int argc, char *argv[])
controller = tracker_extract_controller_new (decorator, connection);
tracker_miner_start (TRACKER_MINER (decorator));
/* Request DBus name */
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);
g_error_free (error);
g_free (dbus_name);
return EXIT_FAILURE;
}
g_free (dbus_name);
/* Main loop */
main_loop = g_main_loop_new (NULL, FALSE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment