[Telepathy-commits] [telepathy-salut/master] SalutMucChannel: Implement channel DBus properties

Sjoerd Simons sjoerd.simons at collabora.co.uk
Mon Aug 11 04:18:05 PDT 2008


---
 src/salut-muc-channel.c |   27 +++++++++++++++++++++++++--
 src/salut-muc-channel.h |    1 +
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/src/salut-muc-channel.c b/src/salut-muc-channel.c
index f3f682b..7dab70f 100644
--- a/src/salut-muc-channel.c
+++ b/src/salut-muc-channel.c
@@ -37,6 +37,7 @@
 
 #include <telepathy-glib/channel-iface.h>
 #include <telepathy-glib/interfaces.h>
+#include <telepathy-glib/svc-generic.h>
 #include <telepathy-glib/dbus.h>
 #include <telepathy-glib/errors.h>
 #include <telepathy-glib/util.h>
@@ -54,6 +55,8 @@ static void channel_iface_init (gpointer g_iface, gpointer iface_data);
 static void text_iface_init (gpointer g_iface, gpointer iface_data);
 
 G_DEFINE_TYPE_WITH_CODE(SalutMucChannel, salut_muc_channel, G_TYPE_OBJECT,
+    G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_DBUS_PROPERTIES,
+      tp_dbus_properties_mixin_iface_init);
     G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CHANNEL, channel_iface_init);
     G_IMPLEMENT_INTERFACE(TP_TYPE_CHANNEL_IFACE, NULL);
     G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_GROUP,
@@ -672,8 +675,24 @@ static void
 salut_muc_channel_class_init (SalutMucChannelClass *salut_muc_channel_class) {
   GObjectClass *object_class = G_OBJECT_CLASS (salut_muc_channel_class);
   GParamSpec *param_spec;
-
-  g_type_class_add_private (salut_muc_channel_class, sizeof (SalutMucChannelPrivate));
+  static TpDBusPropertiesMixinPropImpl channel_props[] = {
+      { "TargetHandleType", "handle-type", NULL },
+      { "TargetHandle", "handle", NULL },
+      { "ChannelType", "channel-type", NULL },
+      { "Interfaces", "interfaces", NULL },
+      { NULL }
+  };
+  static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = {
+      { TP_IFACE_CHANNEL,
+        tp_dbus_properties_mixin_getter_gobject_properties,
+        NULL,
+        channel_props,
+      },
+      { NULL }
+  };
+
+  g_type_class_add_private (salut_muc_channel_class,
+      sizeof (SalutMucChannelPrivate));
 
   object_class->dispose = salut_muc_channel_dispose;
   object_class->finalize = salut_muc_channel_finalize;
@@ -773,6 +792,10 @@ salut_muc_channel_class_init (SalutMucChannelClass *salut_muc_channel_class) {
         g_cclosure_marshal_VOID__POINTER,
         G_TYPE_NONE, 1, G_TYPE_POINTER);
 
+  salut_muc_channel_class->dbus_props_class.interfaces = prop_interfaces;
+  tp_dbus_properties_mixin_class_init (object_class,
+      G_STRUCT_OFFSET (SalutMucChannelClass, dbus_props_class));
+
   tp_text_mixin_class_init (object_class,
       G_STRUCT_OFFSET(SalutMucChannelClass, text_class));
 
diff --git a/src/salut-muc-channel.h b/src/salut-muc-channel.h
index 451efe1..72b27df 100644
--- a/src/salut-muc-channel.h
+++ b/src/salut-muc-channel.h
@@ -40,6 +40,7 @@ struct _SalutMucChannelClass {
   GObjectClass parent_class;
   TpGroupMixinClass group_class;
   TpTextMixinClass text_class;
+  TpDBusPropertiesMixinClass dbus_props_class;
 
   /* Virtual method */
   gboolean (*publish_service) (SalutMucChannel *self,
-- 
1.5.6.3




More information about the Telepathy-commits mailing list