[next] telepathy-glib: Move TpChannel::group-flags to channel-contacts.c
Xavier Claessens
xclaesse at kemper.freedesktop.org
Thu May 10 07:14:06 PDT 2012
Module: telepathy-glib
Branch: next
Commit: 1bcc4eae5d7605af33ecf44d0880811bb1fd3351
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=1bcc4eae5d7605af33ecf44d0880811bb1fd3351
Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date: Mon May 7 17:44:57 2012 +0200
Move TpChannel::group-flags to channel-contacts.c
It means TP_CHANNEL_FEATURE_CONTACTS must now be prepared to get it
https://bugs.freedesktop.org/show_bug.cgi?id=49371
---
telepathy-glib/channel-contacts.c | 51 ++++++++++++++++++++++++++
telepathy-glib/channel-group.c | 72 -------------------------------------
telepathy-glib/channel.c | 4 +-
telepathy-glib/channel.h | 4 +-
4 files changed, 55 insertions(+), 76 deletions(-)
diff --git a/telepathy-glib/channel-contacts.c b/telepathy-glib/channel-contacts.c
index 40f8a03..a0c0a87 100644
--- a/telepathy-glib/channel-contacts.c
+++ b/telepathy-glib/channel-contacts.c
@@ -946,6 +946,34 @@ self_contact_changed_cb (TpChannel *self,
}
static void
+group_flags_changed_cb (TpChannel *self,
+ guint added,
+ guint removed,
+ gpointer user_data,
+ GObject *weak_object)
+{
+ if (!self->priv->group_properties_retrieved)
+ return;
+
+ DEBUG ("%p GroupFlagsChanged: +%u -%u", self, added, removed);
+
+ added &= ~(self->priv->group_flags);
+ removed &= self->priv->group_flags;
+
+ DEBUG ("%p GroupFlagsChanged (after filtering): +%u -%u",
+ self, added, removed);
+
+ self->priv->group_flags |= added;
+ self->priv->group_flags &= ~removed;
+
+ if (added != 0 || removed != 0)
+ {
+ g_object_notify ((GObject *) self, "group-flags");
+ g_signal_emit_by_name (self, "group-flags-changed", added, removed);
+ }
+}
+
+static void
contacts_prepared_cb (GObject *object,
GAsyncResult *res,
gpointer user_data)
@@ -1051,6 +1079,8 @@ got_group_properties_cb (TpProxy *proxy,
DEBUG ("Received %u group properties", g_hash_table_size (asv));
self->priv->group_properties_retrieved = TRUE;
+ self->priv->group_flags = tp_asv_get_uint32 (asv, "GroupFlags", NULL);
+
identifiers = tp_asv_get_boxed (asv, "MemberIdentifiers",
TP_HASH_TYPE_HANDLE_IDENTIFIER_MAP);
@@ -1120,6 +1150,10 @@ _tp_channel_contacts_prepare_async (TpProxy *proxy,
return;
}
+ tp_cli_channel_interface_group_connect_to_group_flags_changed (self,
+ group_flags_changed_cb, NULL, NULL, NULL, &error);
+ g_assert_no_error (error);
+
tp_cli_channel_interface_group_connect_to_self_contact_changed (self,
self_contact_changed_cb, NULL, NULL, NULL, &error);
g_assert_no_error (error);
@@ -1141,6 +1175,23 @@ _tp_channel_contacts_prepare_async (TpProxy *proxy,
}
/**
+ * tp_channel_group_get_flags:
+ * @self: a channel
+ *
+ * <!-- -->
+ *
+ * Returns: the value of #TpChannel:group-flags
+ * Since: 0.UNRELEASED
+ */
+TpChannelGroupFlags
+tp_channel_group_get_flags (TpChannel *self)
+{
+ g_return_val_if_fail (TP_IS_CHANNEL (self), 0);
+
+ return self->priv->group_flags;
+}
+
+/**
* tp_channel_group_get_self_contact:
* @self: a channel
*
diff --git a/telepathy-glib/channel-group.c b/telepathy-glib/channel-group.c
index e3e2737..dd28426 100644
--- a/telepathy-glib/channel-group.c
+++ b/telepathy-glib/channel-group.c
@@ -95,26 +95,6 @@ tp_channel_group_get_self_handle (TpChannel *self)
return self->priv->group_self_handle;
}
-
-/**
- * tp_channel_group_get_flags:
- * @self: a channel
- *
- * Return the #TpChannel:group-flags property (see the description
- * of that property for notes on validity).
- *
- * Returns: the group flags, or 0
- * Since: 0.7.12
- */
-TpChannelGroupFlags
-tp_channel_group_get_flags (TpChannel *self)
-{
- g_return_val_if_fail (TP_IS_CHANNEL (self), 0);
-
- return self->priv->group_flags;
-}
-
-
/**
* tp_channel_group_get_members:
* @self: a channel
@@ -363,22 +343,6 @@ tp_channel_group_self_handle_changed_cb (TpChannel *self,
}
static void
-_got_initial_group_flags (TpChannel *self,
- TpChannelGroupFlags flags)
-{
- TpChannelPrivate *priv = self->priv;
-
- g_assert (priv->group_flags == 0);
-
- DEBUG ("Initial GroupFlags: %u", flags);
- priv->group_flags = flags;
- priv->have_group_flags = TRUE;
-
- if (flags != 0)
- g_object_notify ((GObject *) self, "group-flags");
-}
-
-static void
tp_channel_group_self_contact_changed_cb (TpChannel *self,
guint self_handle,
const gchar *identifier,
@@ -554,9 +518,6 @@ tp_channel_got_group_properties_cb (TpProxy *proxy,
DEBUG ("Received %u group properties", g_hash_table_size (asv));
- _got_initial_group_flags (self,
- tp_asv_get_uint32 (asv, "GroupFlags", NULL));
-
tp_channel_group_self_handle_changed_cb (self,
tp_asv_get_uint32 (asv, "SelfHandle", NULL), NULL, NULL);
@@ -787,33 +748,6 @@ tp_channel_handle_owners_changed_cb (TpChannel *self,
}
-static void
-tp_channel_group_flags_changed_cb (TpChannel *self,
- guint added,
- guint removed,
- gpointer unused G_GNUC_UNUSED,
- GObject *unused_object G_GNUC_UNUSED)
-{
- if (self->priv->have_group_flags)
- {
- DEBUG ("%p GroupFlagsChanged: +%u -%u", self, added, removed);
-
- added &= ~(self->priv->group_flags);
- removed &= self->priv->group_flags;
-
- DEBUG ("%p GroupFlagsChanged (after filtering): +%u -%u",
- self, added, removed);
-
- self->priv->group_flags |= added;
- self->priv->group_flags &= ~removed;
-
- if (added != 0 || removed != 0)
- {
- g_object_notify ((GObject *) self, "group-flags");
- g_signal_emit_by_name (self, "group-flags-changed", added, removed);
- }
- }
-}
void
_tp_channel_get_group_properties (TpChannel *self)
@@ -851,12 +785,6 @@ _tp_channel_get_group_properties (TpChannel *self)
if (sc == NULL)
DIE ("MembersChanged");
- sc = tp_cli_channel_interface_group_connect_to_group_flags_changed (self,
- tp_channel_group_flags_changed_cb, NULL, NULL, NULL, &error);
-
- if (sc == NULL)
- DIE ("GroupFlagsChanged");
-
sc = tp_cli_channel_interface_group_connect_to_self_contact_changed (self,
tp_channel_group_self_contact_changed_cb, NULL, NULL, NULL, &error);
diff --git a/telepathy-glib/channel.c b/telepathy-glib/channel.c
index bd8fe87..1589eb1 100644
--- a/telepathy-glib/channel.c
+++ b/telepathy-glib/channel.c
@@ -1411,7 +1411,7 @@ tp_channel_class_init (TpChannelClass *klass)
/**
* TpChannel:group-flags:
*
- * If the %TP_CHANNEL_FEATURE_GROUP feature has been prepared successfully,
+ * If the %TP_CHANNEL_FEATURE_CONTACTS feature has been prepared successfully,
* #TpChannelGroupFlags indicating the capabilities and behaviour of that
* group.
*
@@ -1420,7 +1420,7 @@ tp_channel_class_init (TpChannelClass *klass)
* Change notification is via notify::group-flags or
* TpChannel::group-flags-changed.
*
- * Since: 0.7.12
+ * Since: 0.UNRELEASED
*/
param_spec = g_param_spec_uint ("group-flags", "Group.GroupFlags",
"0 if not a group", 0, G_MAXUINT32, 0,
diff --git a/telepathy-glib/channel.h b/telepathy-glib/channel.h
index 73da1ab..cdc90ee 100644
--- a/telepathy-glib/channel.h
+++ b/telepathy-glib/channel.h
@@ -136,8 +136,6 @@ TpContact *tp_channel_get_initiator_contact (TpChannel *self);
tp_channel_get_feature_quark_group ()
GQuark tp_channel_get_feature_quark_group (void) G_GNUC_CONST;
-TpChannelGroupFlags tp_channel_group_get_flags (TpChannel *self);
-
#ifndef TP_DISABLE_DEPRECATED
_TP_DEPRECATED_IN_0_20_FOR (tp_channel_group_get_self_contact)
TpHandle tp_channel_group_get_self_handle (TpChannel *self);
@@ -176,6 +174,8 @@ gboolean tp_channel_join_finish (TpChannel *self,
_TP_AVAILABLE_IN_0_16
GQuark tp_channel_get_feature_quark_contacts (void) G_GNUC_CONST;
+TpChannelGroupFlags tp_channel_group_get_flags (TpChannel *self);
+
_TP_AVAILABLE_IN_0_16
TpContact *tp_channel_group_get_self_contact (TpChannel *self);
_TP_AVAILABLE_IN_0_16
More information about the telepathy-commits
mailing list