diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2009-05-15 16:34:47 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2009-05-15 16:35:31 +0100 |
commit | 2c1d962d4b73829ecc0ca37a747353434cfeeaf0 (patch) | |
tree | 638b59c67e2b83a499a410d2c9fefb057eb5b4aa /telepathy-glib/channel-group.c | |
parent | 1bfe03164f4de06a6e48cf741d5b6ad8d38b8eb5 (diff) | |
download | telepathy-glib-2c1d962d4b73829ecc0ca37a747353434cfeeaf0.tar.gz |
Assert that connecting to Group signals works
Diffstat (limited to 'telepathy-glib/channel-group.c')
-rw-r--r-- | telepathy-glib/channel-group.c | 51 |
1 files changed, 41 insertions, 10 deletions
diff --git a/telepathy-glib/channel-group.c b/telepathy-glib/channel-group.c index ba1710893..0e65edc4d 100644 --- a/telepathy-glib/channel-group.c +++ b/telepathy-glib/channel-group.c @@ -1099,6 +1099,10 @@ tp_channel_group_flags_changed_cb (TpChannel *self, void _tp_channel_get_group_properties (TpChannel *self) { + TpChannelPrivate *priv = self->priv; + TpProxySignalConnection *sc; + GError *error = NULL; + if (!tp_proxy_has_interface_by_id (self, TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP)) { @@ -1109,22 +1113,49 @@ _tp_channel_get_group_properties (TpChannel *self) DEBUG ("%p", self); - self->priv->members_changed_sig = + /* If this callback has been called, 'self' has not been invalidated. And we + * just checked above that the proxy has the Group interface. So, connecting + * to these signals must succeed. */ +#define DIE(sig) \ + { \ + g_critical ("couldn't connect to " sig ": %s", error->message); \ + g_assert_not_reached (); \ + g_error_free (error); \ + return; \ + } + + priv->members_changed_sig = tp_cli_channel_interface_group_connect_to_members_changed (self, - tp_channel_group_members_changed_cb, NULL, NULL, NULL, NULL); + tp_channel_group_members_changed_cb, NULL, NULL, NULL, &error); - self->priv->members_changed_detailed_sig = + if (priv->members_changed_sig == NULL) + DIE ("MembersChanged"); + + priv->members_changed_detailed_sig = tp_cli_channel_interface_group_connect_to_members_changed_detailed (self, - tp_channel_group_members_changed_detailed_cb, NULL, NULL, NULL, NULL); + tp_channel_group_members_changed_detailed_cb, NULL, NULL, NULL, + &error); + + if (priv->members_changed_detailed_sig == NULL) + DIE ("MembersChangedDetailed"); + + 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_handle_changed (self, + tp_channel_group_self_handle_changed_cb, NULL, NULL, NULL, &error); - tp_cli_channel_interface_group_connect_to_group_flags_changed (self, - tp_channel_group_flags_changed_cb, NULL, NULL, NULL, NULL); + if (sc == NULL) + DIE ("SelfHandleChanged"); - tp_cli_channel_interface_group_connect_to_self_handle_changed (self, - tp_channel_group_self_handle_changed_cb, NULL, NULL, NULL, NULL); + sc = tp_cli_channel_interface_group_connect_to_handle_owners_changed (self, + tp_channel_handle_owners_changed_cb, NULL, NULL, NULL, &error); - tp_cli_channel_interface_group_connect_to_handle_owners_changed (self, - tp_channel_handle_owners_changed_cb, NULL, NULL, NULL, NULL); + if (sc == NULL) + DIE ("HandleOwnersChanged"); /* First try the 0.17 API (properties). If this fails we'll fall back */ tp_cli_dbus_properties_call_get_all (self, -1, |