[Bug 29417] New: Add API to get a TpAccount from a TpContact and/or TpConnection
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Fri Aug 6 10:33:31 CEST 2010
https://bugs.freedesktop.org/show_bug.cgi?id=29417
Summary: Add API to get a TpAccount from a TpContact and/or
TpConnection
Product: Telepathy
Version: git master
Platform: Other
OS/Version: All
Status: NEW
Severity: normal
Priority: medium
Component: tp-glib
AssignedTo: telepathy-bugs at lists.freedesktop.org
ReportedBy: xclaesse at gmail.com
QAContact: telepathy-bugs at lists.freedesktop.org
It is a common case to need to get the TpAccount object from a TpContact. The
work flow is usually:
You have an object 'self' which needs to work with contacts:
1) Get a TpAccount
2) Gets its TpConnection, and wait for it to be ready. You have only one
user_data so you give self
3) Get some TpContact from the connection
4) ... You need the TpAccount of that contact, but since the only user_data you
had for step 2 is self, you "lost" the account pointer.
The usual solutions for that is to use g_object_set_data(connection, "account",
account); or create a struct{self, account}; to pass as user_data. It is ugly
and complex for a very common flow IMO.
So I suggest adding a TpConnection:account construct-only property. When
TpAccount creates its own TpConnection object, that property is set. If the
TpConnection is created manually, that property is defined as NULL. Like that
we are sure to keep a 1:1 mapping TpAccount<>TpConnection.
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the telepathy-bugs
mailing list