diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-03-05 18:14:52 +0000 |
---|---|---|
committer | Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk> | 2010-06-29 20:30:38 -0300 |
commit | 672137cc51cee0588bc3055df264dfc92cb58815 (patch) | |
tree | 00db62a17d065e1cbb9b6702b1729758cd1037ab /telepathy-glib/base-connection-manager.c | |
parent | 8f9fe6bc77532ab7a72ca653708f1c3c7bfa2d7d (diff) | |
download | telepathy-glib-672137cc51cee0588bc3055df264dfc92cb58815.tar.gz |
Add an internal _TpLegacyProtocol class, and make one for each protocol
Diffstat (limited to 'telepathy-glib/base-connection-manager.c')
-rw-r--r-- | telepathy-glib/base-connection-manager.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/telepathy-glib/base-connection-manager.c b/telepathy-glib/base-connection-manager.c index b57b16001..5324c38d1 100644 --- a/telepathy-glib/base-connection-manager.c +++ b/telepathy-glib/base-connection-manager.c @@ -70,6 +70,49 @@ * future version of telepathy-glib. */ +/* + * _TpLegacyProtocol: + * + * A limited implementation of TpProtocol, in terms of the ConnectionManager + * API from telepathy-spec 0.18. + */ +typedef struct { + TpBaseProtocol parent; + const TpCMProtocolSpec *protocol_spec; +} _TpLegacyProtocol; + +typedef struct { + TpBaseProtocolClass parent; +} _TpLegacyProtocolClass; + +#define _TP_TYPE_LEGACY_PROTOCOL (_tp_legacy_protocol_get_type ()) +GType _tp_legacy_protocol_get_type (void) G_GNUC_CONST; + +G_DEFINE_TYPE(_TpLegacyProtocol, + _tp_legacy_protocol, + TP_TYPE_BASE_PROTOCOL); + +static void +_tp_legacy_protocol_class_init (_TpLegacyProtocolClass *cls) +{ +} + +static void +_tp_legacy_protocol_init (_TpLegacyProtocol *self) +{ +} + +static TpBaseProtocol * +_tp_legacy_protocol_new (const TpCMProtocolSpec *protocol_spec) +{ + _TpLegacyProtocol *self = g_object_new (_TP_TYPE_LEGACY_PROTOCOL, + "name", protocol_spec->name, + NULL); + + self->protocol_spec = protocol_spec; + return (TpBaseProtocol *) self; +} + /** * TpBaseConnectionManager: * @@ -922,6 +965,7 @@ tp_base_connection_manager_register (TpBaseConnectionManager *self) GError *error = NULL; TpBaseConnectionManagerClass *cls; GString *string = NULL; + guint i; g_assert (TP_IS_BASE_CONNECTION_MANAGER (self)); cls = TP_BASE_CONNECTION_MANAGER_GET_CLASS (self); @@ -929,6 +973,12 @@ tp_base_connection_manager_register (TpBaseConnectionManager *self) if (!tp_base_connection_manager_ensure_dbus (self, &error)) goto except; + for (i = 0; cls->protocol_params[i].name != NULL; i++) + { + tp_base_connection_manager_add_protocol (self, + _tp_legacy_protocol_new (cls->protocol_params + i)); + } + g_assert (self->priv->dbus_daemon != NULL); string = g_string_new (TP_CM_BUS_NAME_BASE); |