aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorDavyd Madeley <davyd@madeley.id.au>2009-04-24 14:25:27 +0800
committerDavyd Madeley <davyd@madeley.id.au>2009-07-15 18:12:15 +0800
commit736807e3c658aee559cb3d41413e775023d29c51 (patch)
treec73bd752b6f1c6158aa513741abb706c25b6b07a /libempathy
parentb39c5448563fe1313203884c9da04471817a999e (diff)
downloadgsoc2013-empathy-736807e3c658aee559cb3d41413e775023d29c51.tar
gsoc2013-empathy-736807e3c658aee559cb3d41413e775023d29c51.tar.gz
gsoc2013-empathy-736807e3c658aee559cb3d41413e775023d29c51.tar.bz2
gsoc2013-empathy-736807e3c658aee559cb3d41413e775023d29c51.tar.lz
gsoc2013-empathy-736807e3c658aee559cb3d41413e775023d29c51.tar.xz
gsoc2013-empathy-736807e3c658aee559cb3d41413e775023d29c51.tar.zst
gsoc2013-empathy-736807e3c658aee559cb3d41413e775023d29c51.zip
Expose channel group flags via EmpathyContactList iface
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-contact-list.c11
-rw-r--r--libempathy/empathy-contact-list.h10
-rw-r--r--libempathy/empathy-tp-contact-list.c25
3 files changed, 46 insertions, 0 deletions
diff --git a/libempathy/empathy-contact-list.c b/libempathy/empathy-contact-list.c
index 1fe894e99..d9493af1e 100644
--- a/libempathy/empathy-contact-list.c
+++ b/libempathy/empathy-contact-list.c
@@ -229,3 +229,14 @@ empathy_contact_list_remove_group (EmpathyContactList *list,
}
}
+EmpathyContactListFlags
+empathy_contact_list_get_flags (EmpathyContactList *list)
+{
+ g_return_val_if_fail (EMPATHY_IS_CONTACT_LIST (list), 0);
+
+ if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->get_flags) {
+ return EMPATHY_CONTACT_LIST_GET_IFACE (list)->get_flags (list);
+ } else {
+ return 0;
+ }
+}
diff --git a/libempathy/empathy-contact-list.h b/libempathy/empathy-contact-list.h
index 5eabf32c3..0296b6486 100644
--- a/libempathy/empathy-contact-list.h
+++ b/libempathy/empathy-contact-list.h
@@ -34,6 +34,11 @@ G_BEGIN_DECLS
#define EMPATHY_IS_CONTACT_LIST(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CONTACT_LIST))
#define EMPATHY_CONTACT_LIST_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), EMPATHY_TYPE_CONTACT_LIST, EmpathyContactListIface))
+typedef enum {
+ EMPATHY_CONTACT_LIST_CAN_ADD = 1 << 0,
+ EMPATHY_CONTACT_LIST_CAN_REMOVE = 1 << 1,
+} EmpathyContactListFlags;
+
typedef struct _EmpathyContactListIface EmpathyContactListIface;
struct _EmpathyContactListIface {
@@ -64,6 +69,8 @@ struct _EmpathyContactListIface {
const gchar *group);
EmpathyContactMonitor *
(*get_monitor) (EmpathyContactList *list);
+ EmpathyContactListFlags
+ (*get_flags) (EmpathyContactList *list);
};
GType empathy_contact_list_get_type (void) G_GNUC_CONST;
@@ -92,6 +99,9 @@ void empathy_contact_list_remove_group (EmpathyContactList *list,
EmpathyContactMonitor *
empathy_contact_list_get_monitor (EmpathyContactList *list);
+EmpathyContactListFlags
+ empathy_contact_list_get_flags (EmpathyContactList *list);
+
G_END_DECLS
#endif /* __EMPATHY_CONTACT_LIST_H__ */
diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c
index cdb0431c4..4ae5c88c9 100644
--- a/libempathy/empathy-tp-contact-list.c
+++ b/libempathy/empathy-tp-contact-list.c
@@ -1074,6 +1074,30 @@ tp_contact_list_remove_group (EmpathyContactList *list,
g_array_free (handles, TRUE);
}
+static EmpathyContactListFlags
+tp_contact_list_get_flags (EmpathyContactList *list)
+{
+ EmpathyTpContactListPriv *priv;
+ EmpathyContactListFlags flags = 0;
+ TpChannelGroupFlags group_flags;
+
+ g_return_val_if_fail (EMPATHY_IS_TP_CONTACT_LIST (list), FALSE);
+
+ priv = GET_PRIV (list);
+
+ group_flags = tp_channel_group_get_flags (priv->subscribe);
+
+ if (group_flags & TP_CHANNEL_GROUP_FLAG_CAN_ADD) {
+ flags |= EMPATHY_CONTACT_LIST_CAN_ADD;
+ }
+
+ if (group_flags & TP_CHANNEL_GROUP_FLAG_CAN_REMOVE) {
+ flags |= EMPATHY_CONTACT_LIST_CAN_REMOVE;
+ }
+
+ return flags;
+}
+
static void
tp_contact_list_iface_init (EmpathyContactListIface *iface)
{
@@ -1087,6 +1111,7 @@ tp_contact_list_iface_init (EmpathyContactListIface *iface)
iface->remove_from_group = tp_contact_list_remove_from_group;
iface->rename_group = tp_contact_list_rename_group;
iface->remove_group = tp_contact_list_remove_group;
+ iface->get_flags = tp_contact_list_get_flags;
}
gboolean