[Telepathy-commits] [telepathy-gabble/master] GabbleTubesChannel: expose interfaces as GObject property
Simon McVittie
simon.mcvittie at collabora.co.uk
Tue Aug 19 10:53:08 PDT 2008
20080606102103-53eee-7fbab6bb06b034637522e614a206876cd1d27f36.gz
---
src/tubes-channel.c | 40 ++++++++++++++++++++++++++++++++++------
1 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/src/tubes-channel.c b/src/tubes-channel.c
index 635df6c..71cdd97 100644
--- a/src/tubes-channel.c
+++ b/src/tubes-channel.c
@@ -80,6 +80,15 @@ G_DEFINE_TYPE_WITH_CODE (GabbleTubesChannel, gabble_tubes_channel,
tp_external_group_mixin_iface_init);
G_IMPLEMENT_INTERFACE (TP_TYPE_CHANNEL_IFACE, NULL));
+static const gchar *gabble_tubes_channel_interfaces[] = {
+ TP_IFACE_CHANNEL_INTERFACE_GROUP,
+ /* If more interfaces are added, either keep Group as the first, or change
+ * the implementations of gabble_tubes_channel_get_interfaces () and
+ * gabble_tubes_channel_get_property () too */
+ NULL
+};
+
+
enum
{
PROP_OBJECT_PATH = 1,
@@ -87,6 +96,7 @@ enum
PROP_HANDLE_TYPE,
PROP_HANDLE,
PROP_CONNECTION,
+ PROP_INTERFACES,
PROP_MUC,
LAST_PROPERTY,
};
@@ -205,6 +215,18 @@ gabble_tubes_channel_get_property (GObject *object,
case PROP_CONNECTION:
g_value_set_object (value, priv->conn);
break;
+ case PROP_INTERFACES:
+ if (chan->muc)
+ {
+ /* MUC tubes */
+ g_value_set_boxed (value, gabble_tubes_channel_interfaces);
+ }
+ else
+ {
+ /* 1-1 tubes - omit the Group interface */
+ g_value_set_boxed (value, gabble_tubes_channel_interfaces + 1);
+ }
+ break;
case PROP_MUC:
g_value_set_object (value, chan->muc);
break;
@@ -2350,19 +2372,18 @@ static void
gabble_tubes_channel_get_interfaces (TpSvcChannel *iface,
DBusGMethodInvocation *context)
{
- const char *interfaces[] = {
- TP_IFACE_CHANNEL_INTERFACE_GROUP,
- NULL };
GabbleTubesChannel *self = GABBLE_TUBES_CHANNEL (iface);
if (self->muc)
{
- tp_svc_channel_return_from_get_interfaces (context, interfaces);
+ tp_svc_channel_return_from_get_interfaces (context,
+ gabble_tubes_channel_interfaces);
}
else
{
- /* only show the NULL */
- tp_svc_channel_return_from_get_interfaces (context, interfaces + 1);
+ /* omit the Group interface */
+ tp_svc_channel_return_from_get_interfaces (context,
+ gabble_tubes_channel_interfaces + 1);
}
}
@@ -2407,6 +2428,13 @@ gabble_tubes_channel_class_init (
G_PARAM_STATIC_BLURB);
g_object_class_install_property (object_class, PROP_CONNECTION, param_spec);
+ param_spec = g_param_spec_boxed ("interfaces", "Extra D-Bus interfaces",
+ "Additional Channel.Interface.* interfaces",
+ G_TYPE_STRV,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_STATIC_NAME);
+ g_object_class_install_property (object_class, PROP_INTERFACES, param_spec);
+
param_spec = g_param_spec_object (
"muc",
"GabbleMucChannel object",
--
1.5.6.3
More information about the Telepathy-commits
mailing list