PIM: fix initialization of folks backends
The FolksBackendStore must be prepared before disabling or enabling backends. Using the wrong order caused ERROR messages about using a NULL key file.
This commit is contained in:
parent
882ff26695
commit
84855750f9
2 changed files with 43 additions and 26 deletions
|
@ -149,32 +149,9 @@ void IndividualAggregator::init(boost::shared_ptr<IndividualAggregator> &self)
|
|||
LogRedirect::addIgnoreError("Error preparing Backend 'ofono'");
|
||||
LogRedirect::addIgnoreError("Error preparing Backend 'telepathy'");
|
||||
|
||||
// Have to hard-code the list of known backends that we don't want.
|
||||
SYNCEVO_GLIB_CALL_ASYNC(folks_backend_store_disable_backend,
|
||||
boost::bind(logResult, (const GError *)NULL,
|
||||
"folks_backend_store_disable_backend"),
|
||||
m_backendStore, "telepathy");
|
||||
SYNCEVO_GLIB_CALL_ASYNC(folks_backend_store_disable_backend,
|
||||
boost::bind(logResult, (const GError *)NULL,
|
||||
"folks_backend_store_disable_backend"),
|
||||
m_backendStore, "tracker");
|
||||
SYNCEVO_GLIB_CALL_ASYNC(folks_backend_store_disable_backend,
|
||||
boost::bind(logResult, (const GError *)NULL,
|
||||
"folks_backend_store_disable_backend"),
|
||||
m_backendStore, "key-file");
|
||||
SYNCEVO_GLIB_CALL_ASYNC(folks_backend_store_disable_backend,
|
||||
boost::bind(logResult, (const GError *)NULL,
|
||||
"folks_backend_store_disable_backend"),
|
||||
m_backendStore, "libsocialweb");
|
||||
// Explicitly enable EDS, just to be sure.
|
||||
SYNCEVO_GLIB_CALL_ASYNC(folks_backend_store_enable_backend,
|
||||
boost::bind(logResult, (const GError *)NULL,
|
||||
"folks_backend_store_enable_backend"),
|
||||
m_backendStore, "eds");
|
||||
|
||||
// Start loading backends right away.
|
||||
SYNCEVO_GLIB_CALL_ASYNC(folks_backend_store_load_backends,
|
||||
boost::bind(&IndividualAggregator::backendsLoaded, m_self),
|
||||
SYNCEVO_GLIB_CALL_ASYNC(folks_backend_store_prepare,
|
||||
boost::bind(&IndividualAggregator::storePrepared,
|
||||
m_self),
|
||||
m_backendStore);
|
||||
|
||||
m_folks =
|
||||
|
@ -201,6 +178,40 @@ std::string IndividualAggregator::dumpDatabases()
|
|||
return res;
|
||||
}
|
||||
|
||||
void IndividualAggregator::storePrepared()
|
||||
{
|
||||
SE_LOG_DEBUG(NULL, NULL, "backend store is prepared");
|
||||
|
||||
// Have to hard-code the list of known backends that we don't want.
|
||||
SYNCEVO_GLIB_CALL_ASYNC(folks_backend_store_disable_backend,
|
||||
boost::bind(logResult, (const GError *)NULL,
|
||||
"folks_backend_store_disable_backend"),
|
||||
m_backendStore, "telepathy");
|
||||
SYNCEVO_GLIB_CALL_ASYNC(folks_backend_store_disable_backend,
|
||||
boost::bind(logResult, (const GError *)NULL,
|
||||
"folks_backend_store_disable_backend"),
|
||||
m_backendStore, "tracker");
|
||||
SYNCEVO_GLIB_CALL_ASYNC(folks_backend_store_disable_backend,
|
||||
boost::bind(logResult, (const GError *)NULL,
|
||||
"folks_backend_store_disable_backend"),
|
||||
m_backendStore, "key-file");
|
||||
SYNCEVO_GLIB_CALL_ASYNC(folks_backend_store_disable_backend,
|
||||
boost::bind(logResult, (const GError *)NULL,
|
||||
"folks_backend_store_disable_backend"),
|
||||
m_backendStore, "libsocialweb");
|
||||
// Explicitly enable EDS, just to be sure.
|
||||
SYNCEVO_GLIB_CALL_ASYNC(folks_backend_store_enable_backend,
|
||||
boost::bind(logResult, (const GError *)NULL,
|
||||
"folks_backend_store_enable_backend"),
|
||||
m_backendStore, "eds");
|
||||
|
||||
// Start loading backends right away. Assumes that the
|
||||
// asynchronous operations above will be done first.
|
||||
SYNCEVO_GLIB_CALL_ASYNC(folks_backend_store_load_backends,
|
||||
boost::bind(&IndividualAggregator::backendsLoaded, m_self),
|
||||
m_backendStore);
|
||||
}
|
||||
|
||||
void IndividualAggregator::backendsLoaded()
|
||||
{
|
||||
SE_LOG_DEBUG(NULL, NULL, "backend store has loaded backends");
|
||||
|
|
|
@ -231,6 +231,12 @@ class IndividualAggregator
|
|||
IndividualAggregator(const boost::shared_ptr<LocaleFactory> &locale);
|
||||
void init(boost::shared_ptr<IndividualAggregator> &self);
|
||||
|
||||
/**
|
||||
* Called when backend store is prepared. At that point, backends
|
||||
* can be disabled or enabled and loading them can be kicked of.
|
||||
*/
|
||||
void storePrepared();
|
||||
|
||||
/**
|
||||
* Called when all Folks backends are loaded, before the
|
||||
* aggregator does its work. Now is the right time to initialize
|
||||
|
|
Loading…
Reference in a new issue