folks: allow aggregator to be started multiple times

Only the first call has any effect. Matches the D-Bus API
description.
This commit is contained in:
Patrick Ohly 2012-09-05 11:14:58 +02:00
parent 3691f52ccf
commit d260b5e032
2 changed files with 11 additions and 4 deletions

View file

@ -143,10 +143,13 @@ static void logResult(const GError *gerror, const char *operation)
void IndividualAggregator::start()
{
SYNCEVO_GLIB_CALL_ASYNC(folks_individual_aggregator_prepare,
boost::bind(logResult, _1,
"folks_individual_aggregator_prepare"),
getFolks());
if (!m_started) {
m_started = true;
SYNCEVO_GLIB_CALL_ASYNC(folks_individual_aggregator_prepare,
boost::bind(logResult, _1,
"folks_individual_aggregator_prepare"),
getFolks());
}
}
#ifdef ENABLE_UNIT_TESTS

View file

@ -250,6 +250,7 @@ class IndividualAggregator
boost::shared_ptr<FullView> m_view;
boost::weak_ptr<IndividualAggregator> m_self;
FolksIndividualAggregatorCXX m_folks;
Bool m_started;
IndividualAggregator() {}
@ -273,6 +274,9 @@ class IndividualAggregator
/**
* Starts pulling and sorting of contacts.
* Populates m_view and all other, derived views.
* Can be called multiple times.
*
* See also org.01.pim.contacts.Manager.Start().
*/
void start();