[Telepathy-commits] [telepathy-gabble/master] Implement Group properties on roster channels

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Aug 19 10:52:55 PDT 2008


20080526113803-53eee-3dadae1e38508bc3f86ad5b6fdff7d3733709874.gz
---
 src/gabble-roster-channel.c |   27 ++++++++++++++++++++++-----
 src/gabble-roster-channel.h |    2 ++
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/src/gabble-roster-channel.c b/src/gabble-roster-channel.c
index 1c3bc6a..f461be7 100644
--- a/src/gabble-roster-channel.c
+++ b/src/gabble-roster-channel.c
@@ -34,6 +34,7 @@
 #include <telepathy-glib/errors.h>
 #include <telepathy-glib/interfaces.h>
 #include <telepathy-glib/channel-iface.h>
+#include <telepathy-glib/svc-generic.h>
 #include <telepathy-glib/svc-channel.h>
 #include "util.h"
 
@@ -45,6 +46,8 @@ G_DEFINE_TYPE_WITH_CODE (GabbleRosterChannel, gabble_roster_channel,
     G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_GROUP,
       tp_group_mixin_iface_init);
     G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_CONTACT_LIST, NULL);
+    G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_DBUS_PROPERTIES,
+      tp_dbus_properties_mixin_iface_init);
     G_IMPLEMENT_INTERFACE (TP_TYPE_CHANNEL_IFACE, NULL));
 
 /* properties */
@@ -127,7 +130,8 @@ gabble_roster_channel_constructor (GType type, guint n_props,
     {
       tp_group_mixin_change_flags (obj,
           TP_CHANNEL_GROUP_FLAG_CAN_ADD |
-          TP_CHANNEL_GROUP_FLAG_CAN_REMOVE,
+          TP_CHANNEL_GROUP_FLAG_CAN_REMOVE |
+          TP_CHANNEL_GROUP_FLAG_PROPERTIES,
           0);
     }
   else if (handle_type != TP_HANDLE_TYPE_LIST)
@@ -140,7 +144,8 @@ gabble_roster_channel_constructor (GType type, guint n_props,
       tp_group_mixin_change_flags (obj,
           TP_CHANNEL_GROUP_FLAG_CAN_REMOVE |
           TP_CHANNEL_GROUP_FLAG_MESSAGE_ACCEPT |
-          TP_CHANNEL_GROUP_FLAG_MESSAGE_REMOVE,
+          TP_CHANNEL_GROUP_FLAG_MESSAGE_REMOVE |
+          TP_CHANNEL_GROUP_FLAG_PROPERTIES,
           0);
     }
   else if (GABBLE_LIST_HANDLE_SUBSCRIBE == priv->handle)
@@ -151,20 +156,23 @@ gabble_roster_channel_constructor (GType type, guint n_props,
           TP_CHANNEL_GROUP_FLAG_CAN_RESCIND |
           TP_CHANNEL_GROUP_FLAG_MESSAGE_ADD |
           TP_CHANNEL_GROUP_FLAG_MESSAGE_REMOVE |
-          TP_CHANNEL_GROUP_FLAG_MESSAGE_RESCIND,
+          TP_CHANNEL_GROUP_FLAG_MESSAGE_RESCIND |
+          TP_CHANNEL_GROUP_FLAG_PROPERTIES,
           0);
     }
   else if (GABBLE_LIST_HANDLE_KNOWN == priv->handle)
     {
       tp_group_mixin_change_flags (obj,
-          TP_CHANNEL_GROUP_FLAG_CAN_REMOVE,
+          TP_CHANNEL_GROUP_FLAG_CAN_REMOVE |
+          TP_CHANNEL_GROUP_FLAG_PROPERTIES,
           0);
     }
   else if (GABBLE_LIST_HANDLE_DENY == priv->handle)
     {
       tp_group_mixin_change_flags (obj,
           TP_CHANNEL_GROUP_FLAG_CAN_ADD |
-          TP_CHANNEL_GROUP_FLAG_CAN_REMOVE,
+          TP_CHANNEL_GROUP_FLAG_CAN_REMOVE |
+          TP_CHANNEL_GROUP_FLAG_PROPERTIES,
           0);
     }
   else
@@ -252,6 +260,10 @@ gabble_roster_channel_class_init (GabbleRosterChannelClass *gabble_roster_channe
 {
   GObjectClass *object_class = G_OBJECT_CLASS (gabble_roster_channel_class);
   GParamSpec *param_spec;
+  static TpDBusPropertiesMixinIfaceImpl interfaces[] = {
+        { NULL /* initialized with tp_group_mixin_init_dbus_properties () */ },
+        { NULL }
+  };
 
   g_type_class_add_private (gabble_roster_channel_class,
       sizeof (GabbleRosterChannelPrivate));
@@ -286,6 +298,11 @@ gabble_roster_channel_class_init (GabbleRosterChannelClass *gabble_roster_channe
       G_STRUCT_OFFSET (GabbleRosterChannelClass, group_class),
       _gabble_roster_channel_add_member_cb,
       _gabble_roster_channel_remove_member_cb);
+
+  gabble_roster_channel_class->properties_class.interfaces = interfaces;
+  tp_group_mixin_init_dbus_properties (interfaces + 0);
+  tp_dbus_properties_mixin_class_init (object_class,
+      G_STRUCT_OFFSET (GabbleRosterChannelClass, properties_class));
 }
 
 void
diff --git a/src/gabble-roster-channel.h b/src/gabble-roster-channel.h
index 29f8bd5..30267e7 100644
--- a/src/gabble-roster-channel.h
+++ b/src/gabble-roster-channel.h
@@ -22,6 +22,7 @@
 #define __GABBLE_ROSTER_CHANNEL_H__
 
 #include <glib-object.h>
+#include <telepathy-glib/dbus-properties-mixin.h>
 #include <telepathy-glib/group-mixin.h>
 #include <telepathy-glib/intset.h>
 
@@ -35,6 +36,7 @@ struct _GabbleRosterChannelClass {
     GObjectClass parent_class;
 
     TpGroupMixinClass group_class;
+    TpDBusPropertiesMixinClass properties_class;
 };
 
 struct _GabbleRosterChannel {
-- 
1.5.6.3




More information about the Telepathy-commits mailing list