telepathy-qt: contacts-conn CM: sync client-types interface support from tp-glib
Dario Freddi
drf at kemper.freedesktop.org
Thu Jul 5 06:06:01 PDT 2012
Module: telepathy-qt
Branch: master
Commit: 0d9bd907813a913c380cbd9d478375d96ffffbbc
URL: http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=0d9bd907813a913c380cbd9d478375d96ffffbbc
Author: George Kiagiadakis <george.kiagiadakis at collabora.com>
Date: Wed Jul 4 18:48:19 2012 +0300
contacts-conn CM: sync client-types interface support from tp-glib
---
tests/lib/glib/contacts-conn.c | 23 +++++++++++++++++++++++
tests/lib/glib/contacts-conn.h | 2 ++
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/tests/lib/glib/contacts-conn.c b/tests/lib/glib/contacts-conn.c
index 8991da3..47d0b03 100644
--- a/tests/lib/glib/contacts-conn.c
+++ b/tests/lib/glib/contacts-conn.c
@@ -53,6 +53,8 @@ G_DEFINE_TYPE_WITH_CODE (TpTestsContactsConnection,
tp_base_contact_list_mixin_list_iface_init);
G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_GROUPS,
tp_base_contact_list_mixin_groups_iface_init);
+ G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CLIENT_TYPES,
+ NULL);
);
/* type definition stuff */
@@ -343,6 +345,23 @@ conn_contact_info_properties_getter (GObject *object,
}
static void
+client_types_fill_contact_attributes (
+ GObject *object,
+ const GArray *contacts,
+ GHashTable *attributes)
+{
+ TpTestsContactsConnectionClass *klass =
+ TP_TESTS_CONTACTS_CONNECTION_GET_CLASS (object);
+
+ if (klass->fill_client_types != NULL)
+ klass->fill_client_types (object, contacts, attributes);
+ /* â¦else do nothing: a no-op implementation is valid, relatively speaking.
+ * The spec sez the /client-types attribute should be âomitted from the
+ * result if the contact's client types are not known.â
+ */
+}
+
+static void
constructed (GObject *object)
{
TpBaseConnection *base = TP_BASE_CONNECTION (object);
@@ -371,6 +390,9 @@ constructed (GObject *object)
tp_contacts_mixin_add_contact_attributes_iface (object,
TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO,
contact_info_fill_contact_attributes);
+ tp_contacts_mixin_add_contact_attributes_iface (object,
+ TP_IFACE_CONNECTION_INTERFACE_CLIENT_TYPES,
+ client_types_fill_contact_attributes);
tp_presence_mixin_init (object,
G_STRUCT_OFFSET (TpTestsContactsConnection, presence_mixin));
@@ -503,6 +525,7 @@ tp_tests_contacts_connection_class_init (TpTestsContactsConnectionClass *klass)
TP_IFACE_CONNECTION_INTERFACE_PRESENCE,
TP_IFACE_CONNECTION_INTERFACE_SIMPLE_PRESENCE,
TP_IFACE_CONNECTION_INTERFACE_LOCATION,
+ TP_IFACE_CONNECTION_INTERFACE_CLIENT_TYPES,
TP_IFACE_CONNECTION_INTERFACE_CONTACT_CAPABILITIES,
TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO,
TP_IFACE_CONNECTION_INTERFACE_REQUESTS,
diff --git a/tests/lib/glib/contacts-conn.h b/tests/lib/glib/contacts-conn.h
index 9cf1114..58674d4 100644
--- a/tests/lib/glib/contacts-conn.h
+++ b/tests/lib/glib/contacts-conn.h
@@ -32,6 +32,8 @@ struct _TpTestsContactsConnectionClass {
TpPresenceMixinClass presence_mixin;
TpContactsMixinClass contacts_mixin;
TpDBusPropertiesMixinClass properties_class;
+
+ TpContactsMixinFillContactAttributesFunc fill_client_types;
};
struct _TpTestsContactsConnection {
More information about the telepathy-commits
mailing list