I keep assuming when giving examples of how to use TpQt4 that, given a ready Tp::AccountManager, you can get a list of Tp::Accounts corresponding to ValidAccounts, all of which are ready. But currently, you have to iterate am->validAccounts, constructing a Tp::Account for each one, wait for them all to become ready, and only then do whatever you wanted to do in the first place. You need to make sure you cope correctly with an account being deleted while you wait. While it's not rocket science, it's something people will get wrong, and this is something the binding should do for us. Potential API for this would need a way to say what features you want to be ready on the list of Tp::Accounts. I guess this is why it's non-trivial. I can think of two ways the API could work off-hand: • Add a Feature to Tp::AM saying that you want it to keep the Tp::Accounts ready for you, and an extra argument to becomeReady to say which features you want ready on those Tp::Accounts. Then, make am->validAccounts() and friends on a Tp::AM with FeatureReadyAccounts enabled always give you ready accounts back. • Add am->prepareValidAccounts(AccountFeatures f), an asynchronous operation. I think the former would make life easier for the programmer. Compare: mAM = Tp::AccountManager::create(); connect(mAM->becomeReady(Tp::AccountManager::FeatureReadyAccounts, Tp::Account::FeatureProtocolInfo), SIGNAL(finished(Tp::PendingOperation *)), SLOT(onAMReady(Tp::PendingOperation *))); void onAMReady(...) { QList<AccountPtr> accounts = mAM->validAccounts(); // do whatever you wanted to do } to: mAM = Tp::AccountManager::create(); connect(mAM->becomeReady(), SIGNAL(finished(Tp::PendingOperation *)), SLOT(onAMReady(Tp::PendingOperation *))); void onAMReady(...) { connect(mAM->prepareValidAccounts(), SIGNAL(finished(Tp::PendingOperation *)), SLOT(onAccountsReady(Tp::PendingOperation *))); } void onAccountsReady(...) { // do whatever you wanted to do }
Hey, let's re-purpose this bug for André's account-improvements branch, which makes the AM only ever return ready accounts.
This was merged, and will be in 0.3.6!
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.