telepathy-glib API Reference Manual | ||||
---|---|---|---|---|
Top | Description |
Synopsis
#include <telepathy-glib/telepathy-glib.h> TpContactsMixin; struct TpContactsMixinClass; void tp_contacts_mixin_add_contact_attributes_iface (GObject *obj
,const gchar *interface
,TpContactsMixinFillContactAttributesFunc fill_contact_attributes
); void tp_contacts_mixin_class_init (GObjectClass *obj_cls
,glong offset
); void tp_contacts_mixin_finalize (GObject *obj
); void tp_contacts_mixin_iface_init (gpointer g_iface
,gpointer iface_data
); void tp_contacts_mixin_init (GObject *obj
,gsize offset
); void tp_contacts_mixin_set_contact_attribute (GHashTable *contact_attributes
,TpHandle handle
,const gchar *attribute
,GValue *value
); GHashTable * tp_contacts_mixin_get_contact_attributes (GObject *obj
,const GArray *handles
,const gchar **interfaces
,const gchar **assumed_interfaces
,const gchar *sender
); void (*TpContactsMixinFillContactAttributesFunc) (GObject *obj
,const GArray *contacts
,GHashTable *attributes_hash
);
Description
This mixin can be added to a TpBaseConnection subclass to implement the Contacts interface in a generic way.
To use the contacts mixin, include a TpContactsMixinClass somewhere in
your class structure and a TpContactsMixin somewhere in your instance
structure, and call tp_contacts_mixin_class_init()
from your class_init
function, tp_contacts_mixin_init()
from your init function or constructor,
and tp_contacts_mixin_finalize()
from your dispose or finalize function.
To use the contacts mixin as the implementation of TpSvcConnectionInterfaceContacts, in the function you pass to G_IMPLEMENT_INTERFACE, you should call tp_contacts_mixin_iface_init. TpContactsMixin implements all of the D-Bus methods and properties in the Contacts interface.
To add interfaces with contact attributes to this interface use tp_contacts_mixin_add_contact_attributes_iface:
Details
TpContactsMixin
typedef struct _TpContactsMixin TpContactsMixin;
Structure to be included in the instance structure of objects that
use this mixin. Initialize it with tp_contacts_mixin_init()
.
There are no public fields.
struct TpContactsMixinClass
struct TpContactsMixinClass { };
Structure to be included in the class structure of objects that
use this mixin. Initialize it with tp_contacts_mixin_class_init()
.
There are no public fields.
tp_contacts_mixin_add_contact_attributes_iface ()
void tp_contacts_mixin_add_contact_attributes_iface (GObject *obj
,const gchar *interface
,TpContactsMixinFillContactAttributesFunc fill_contact_attributes
);
Declare that the given interface has contact attributes which can be added to the attributes hash using the filler function. All the handles in the handle array passed to the filler function are guaranteed to be valid and referenced.
|
An instance of the implementation that uses this mixin |
|
Name of the interface that has ContactAttributes |
|
Contact attribute filler function |
Since 0.7.14
tp_contacts_mixin_class_init ()
void tp_contacts_mixin_class_init (GObjectClass *obj_cls
,glong offset
);
Initialize the contacts mixin. Should be called from the implementation's class_init function like so:
1 2 |
tp_contacts_mixin_class_init ((GObjectClass *) klass, G_STRUCT_OFFSET (SomeObjectClass, contacts_mixin)); |
|
The class of the implementation that uses this mixin |
|
The byte offset of the TpContactsMixinClass within the class structure |
Since 0.7.14
tp_contacts_mixin_finalize ()
void tp_contacts_mixin_finalize (GObject *obj
);
Free resources held by the contacts mixin.
|
An object with this mixin. |
Since 0.7.14
tp_contacts_mixin_iface_init ()
void tp_contacts_mixin_iface_init (gpointer g_iface
,gpointer iface_data
);
Fill in the vtable entries needed to implement the contacts interface using this mixin. This function should usually be called via G_IMPLEMENT_INTERFACE.
|
A pointer to the TpSvcConnectionInterfaceContacts in an object class |
|
Ignored |
Since 0.7.14
tp_contacts_mixin_init ()
void tp_contacts_mixin_init (GObject *obj
,gsize offset
);
Initialize the contacts mixin. Should be called from the implementation's instance init function like so:
1 2 |
tp_contacts_mixin_init ((GObject *) self, G_STRUCT_OFFSET (SomeObject, contacts_mixin)); |
|
An instance of the implementation that uses this mixin |
|
The byte offset of the TpContactsMixin within the object structure |
Since 0.7.14
tp_contacts_mixin_set_contact_attribute ()
void tp_contacts_mixin_set_contact_attribute (GHashTable *contact_attributes
,TpHandle handle
,const gchar *attribute
,GValue *value
);
Utility function to set attribute for handle to value in the attributes hash as passed to a TpContactsMixinFillContactAttributesFunc.
|
contacts attribute hash as passed to TpContactsMixinFillContactAttributesFunc |
|
Handle to set the attribute on |
|
attribute name |
|
slice allocated GValue containing the value of the attribute, for instance with tp_g_value_slice_new. Ownership of the GValue is taken over by the mixin |
Since 0.7.14
tp_contacts_mixin_get_contact_attributes ()
GHashTable * tp_contacts_mixin_get_contact_attributes (GObject *obj
,const GArray *handles
,const gchar **interfaces
,const gchar **assumed_interfaces
,const gchar *sender
);
Get contact attributes for the given contacts. Provide attributes for all requested interfaces. If contact attributes are not immediately known, the behaviour is defined by the interface; the attribute should either be omitted from the result or replaced with a default value.
|
A connection instance that uses this mixin. The connection must be connected. |
|
List of handles to retrieve contacts for. Any invalid handles will be dropped from the returned mapping. |
|
A list of interfaces to retrieve attributes from. |
|
A list of additional interfaces to retrieve attributes
from. This can be used for interfaces documented as automatically included,
like TP_IFACE_CONNECTION for GetContactAttributes,
or TP_IFACE_CONNECTION and TP_IFACE_CONNECTION_INTERFACE_CONTACT_LIST for
GetContactListAttributes. |
|
The DBus client's unique name. If this is not NULL, the requested handles will be held on behalf of this client. |
Returns : |
A dictionary mapping the contact handles to contact attributes. |
TpContactsMixinFillContactAttributesFunc ()
void (*TpContactsMixinFillContactAttributesFunc) (GObject *obj
,const GArray *contacts
,GHashTable *attributes_hash
);
This function is called to supply contact attributes pertaining to
a particular interface, for a list of contacts.
All the handles in contacts
are guaranteed to be valid and
referenced.
|
An object implementing the Contacts interface with this mixin |
|
The contact handles for which attributes are requested |
|
hash of handle => hash of attributes, containing all the contacts in the contacts array |