syncevolution --status: statistics empty (MB #9097)

I just noticed that the statistics table had "0" for all cells, despite having
local changes and items.

This broke during the backend API migration towards Boost function pointers.
The implementation in TrackingSyncSource did not have enough parameters and did
not fill the SyncSourceReport passed in as parameter with the values.

I'm not sure why the old code compiled, I would have expected type errors
because boost::bind() with only "this" as parameter should not have matched
m_checkStatus. Anyway, now the item counts are copied into the report.
This commit is contained in:
Patrick Ohly 2010-01-15 17:04:03 +01:00
parent 723a37af1e
commit bf7b9252a8
2 changed files with 8 additions and 3 deletions

View file

@ -33,13 +33,18 @@ TrackingSyncSource::TrackingSyncSource(const SyncSourceParams &params,
m_trackingNode(new PrefixConfigNode("item-",
boost::shared_ptr<ConfigNode>(new SafeConfigNode(params.m_nodes.m_trackingNode))))
{
m_operations.m_checkStatus = boost::bind(&TrackingSyncSource::checkStatus, this);
m_operations.m_checkStatus = boost::bind(&TrackingSyncSource::checkStatus, this, _1);
SyncSourceRevisions::init(this, this, granularitySeconds, m_operations);
}
void TrackingSyncSource::checkStatus()
void TrackingSyncSource::checkStatus(SyncSourceReport &changes)
{
detectChanges(*m_trackingNode);
// copy our item counts into the report
changes.setItemStat(ITEM_LOCAL, ITEM_ADDED, ITEM_TOTAL, getNewItems().size());
changes.setItemStat(ITEM_LOCAL, ITEM_UPDATED, ITEM_TOTAL, getUpdatedItems().size());
changes.setItemStat(ITEM_LOCAL, ITEM_REMOVED, ITEM_TOTAL, getDeletedItems().size());
changes.setItemStat(ITEM_LOCAL, ITEM_ANY, ITEM_TOTAL, getAllItems().size());
}
void TrackingSyncSource::beginSync(const std::string &lastToken, const std::string &resumeToken)

View file

@ -183,7 +183,7 @@ class TrackingSyncSource : public TestingSyncSource, virtual public SyncSourceRe
using SyncSource::getName;
private:
void checkStatus();
void checkStatus(SyncSourceReport &changes);
/* implementations of SyncSource callbacks */
virtual void beginSync(const std::string &lastToken, const std::string &resumeToken);