diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-10-12 18:43:01 -0400 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-10-12 18:46:06 -0400 |
commit | fea8294ac39d066738914849619a48f7be6d4ab5 (patch) | |
tree | a78e80224576f4563a2e569808ae50161f8d2a85 | |
parent | 5dd6de2e21f672009ce064cc7d7aeb1ea64741ee (diff) | |
download | telepathy-glib-fea8294ac39d066738914849619a48f7be6d4ab5.tar.gz |
TpChannel: don't rely on introspection queue to add the iface ID of the type
tp-glib uses to rely on its introspection queue to add the interface ID
of its channel type even when the type was already known during
construction (which is basically alway the case now as we always pass the
immutable properties when creating a TpChannel).
This was forcing TpChannel subclasses to have a CORE feature to connect
signals on their channel type interface for no good reason.
https://bugs.freedesktop.org/show_bug.cgi?id=41729
-rw-r--r-- | telepathy-glib/channel.c | 8 | ||||
-rw-r--r-- | tests/dbus/channel-introspect.c | 48 |
2 files changed, 49 insertions, 7 deletions
diff --git a/telepathy-glib/channel.c b/telepathy-glib/channel.c index 236bb6ba9..b407bfd23 100644 --- a/telepathy-glib/channel.c +++ b/telepathy-glib/channel.c @@ -550,6 +550,9 @@ _tp_channel_maybe_set_channel_type (TpChannel *self, g_hash_table_insert (self->priv->channel_properties, g_strdup (TP_PROP_CHANNEL_CHANNEL_TYPE), tp_g_value_slice_new_static_string (g_quark_to_string (q))); + + tp_proxy_add_interface_by_id ((TpProxy *) self, + self->priv->channel_type); } @@ -879,9 +882,6 @@ tp_channel_got_channel_type_cb (TpChannel *self, _tp_channel_maybe_set_channel_type (self, channel_type); g_object_notify ((GObject *) self, "channel-type"); - tp_proxy_add_interface_by_id ((TpProxy *) self, - self->priv->channel_type); - _tp_channel_continue_introspection (self); } else @@ -906,8 +906,6 @@ _tp_channel_get_channel_type (TpChannel *self) { DEBUG ("%p: channel type %s already determined", self, g_quark_to_string (self->priv->channel_type)); - tp_proxy_add_interface_by_id ((TpProxy *) self, - self->priv->channel_type); _tp_channel_continue_introspection (self); } } diff --git a/tests/dbus/channel-introspect.c b/tests/dbus/channel-introspect.c index 985b06563..5ec471daf 100644 --- a/tests/dbus/channel-introspect.c +++ b/tests/dbus/channel-introspect.c @@ -117,8 +117,8 @@ main (int argc, TpTestsPropsTextChannel *service_props_chan; TpTestsPropsGroupTextChannel *service_props_group_chan; TpDBusDaemon *dbus; - TpConnection *conn; - TpChannel *chan; + TpConnection *conn, *conn2; + TpChannel *chan, *chan2; GError *error = NULL; gchar *name; gchar *conn_path; @@ -715,6 +715,50 @@ main (int argc, assert_chan_sane (chan, handle, FALSE, 0, ""); + /* regression test for fdo#41729 + * + * tp-glib uses to rely on its introspection queue to add the interface ID + * of its channel type even when the type was already known during + * construction. + * + * This test create new proxies, ensuring that the TpConnection of the + * TpChannel isn't prepared yet, and check that the interface is added right + * away after its construction. + * */ + conn2 = tp_connection_new (dbus, name, conn_path, &error); + g_assert_no_error (error); + + { + const gchar *interfaces[] = { + TP_IFACE_CHANNEL_INTERFACE_GROUP, + NULL + }; + + asv = tp_asv_new ( + TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, + TP_IFACE_CHANNEL_TYPE_TEXT, + TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, + TP_HANDLE_TYPE_CONTACT, + TP_PROP_CHANNEL_TARGET_HANDLE, G_TYPE_UINT, handle, + TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, IDENTIFIER, + TP_PROP_CHANNEL_INITIATOR_HANDLE, G_TYPE_UINT, handle, + TP_PROP_CHANNEL_INITIATOR_ID, G_TYPE_STRING, IDENTIFIER, + TP_PROP_CHANNEL_INTERFACES, G_TYPE_STRV, interfaces, + TP_PROP_CHANNEL_REQUESTED, G_TYPE_BOOLEAN, FALSE, + NULL); + } + + chan2 = tp_channel_new_from_properties (conn2, props_group_chan_path, asv, + &error); + g_assert_no_error (error); + + g_assert (tp_proxy_has_interface_by_id (chan2, + TP_IFACE_QUARK_CHANNEL_TYPE_TEXT)); + g_assert (tp_proxy_has_interface_by_id (chan2, + TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP)); + + g_hash_table_unref (asv); + /* ... keep the same channel for the next test */ g_message ("Channel already dead, so we are called back synchronously"); |