diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-02-20 15:05:40 +0000 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-02-20 15:05:40 +0000 |
commit | 821ccef2463b4ff09810d3f31518018c2d98dd2f (patch) | |
tree | e0c0452621f04406863a1ccae1926be3604ef1f3 /src/bytestream-factory.c | |
parent | be20e2502af62331b32151a0e84f48ed76909ad9 (diff) | |
download | telepathy-gabble-821ccef2463b4ff09810d3f31518018c2d98dd2f.tar.gz |
bytestream-factory: use gabble_signal_connect_weak instead of manually disconnect signals
Diffstat (limited to 'src/bytestream-factory.c')
-rw-r--r-- | src/bytestream-factory.c | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/src/bytestream-factory.c b/src/bytestream-factory.c index a2ab20b5b..d648f9730 100644 --- a/src/bytestream-factory.c +++ b/src/bytestream-factory.c @@ -212,21 +212,6 @@ gabble_bytestream_factory_constructor (GType type, } static void -disconnect_all_bytestreams (GabbleBytestreamFactory *self, - GHashTable *bytestreams) -{ - GHashTableIter iter; - gpointer bytestream; - - g_hash_table_iter_init (&iter, bytestreams); - while (g_hash_table_iter_next (&iter, NULL, &bytestream)) - { - g_signal_handlers_disconnect_matched (bytestream, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, self); - } -} - -static void gabble_bytestream_factory_dispose (GObject *object) { GabbleBytestreamFactory *self = GABBLE_BYTESTREAM_FACTORY (object); @@ -255,19 +240,15 @@ gabble_bytestream_factory_dispose (GObject *object) priv->iq_socks5_cb, LM_MESSAGE_TYPE_IQ); lm_message_handler_unref (priv->iq_socks5_cb); - disconnect_all_bytestreams (self, priv->ibb_bytestreams); g_hash_table_destroy (priv->ibb_bytestreams); priv->ibb_bytestreams = NULL; - disconnect_all_bytestreams (self, priv->muc_bytestreams); g_hash_table_destroy (priv->muc_bytestreams); priv->muc_bytestreams = NULL; - disconnect_all_bytestreams (self, priv->socks5_bytestreams); g_hash_table_destroy (priv->socks5_bytestreams); priv->socks5_bytestreams = NULL; - disconnect_all_bytestreams (self, priv->multiple_bytestreams); g_hash_table_destroy (priv->multiple_bytestreams); priv->multiple_bytestreams = NULL; @@ -1276,8 +1257,8 @@ gabble_bytestream_factory_create_ibb (GabbleBytestreamFactory *self, "peer-resource", peer_resource, NULL); - g_signal_connect (ibb, "state-changed", - G_CALLBACK (bytestream_state_changed_cb), self); + gabble_signal_connect_weak (ibb, "state-changed", + G_CALLBACK (bytestream_state_changed_cb), G_OBJECT (self)); id = bytestream_id_new (GABBLE_BYTESTREAM_IFACE (ibb)); DEBUG ("add IBB bytestream <%s> from <%s>", id->stream, id->jid); @@ -1306,8 +1287,8 @@ gabble_bytestream_factory_create_muc (GabbleBytestreamFactory *self, "state", state, NULL); - g_signal_connect (bytestream, "state-changed", - G_CALLBACK (bytestream_state_changed_cb), self); + gabble_signal_connect_weak (bytestream, "state-changed", + G_CALLBACK (bytestream_state_changed_cb), G_OBJECT (self)); id = bytestream_id_new (GABBLE_BYTESTREAM_IFACE (bytestream)); DEBUG ("add muc bytestream <%s> from <%s>", id->stream, id->jid); @@ -1340,8 +1321,8 @@ gabble_bytestream_factory_create_socks5 (GabbleBytestreamFactory *self, "peer-resource", peer_resource, NULL); - g_signal_connect (socks5, "state-changed", - G_CALLBACK (bytestream_state_changed_cb), self); + gabble_signal_connect_weak (socks5, "state-changed", + G_CALLBACK (bytestream_state_changed_cb), G_OBJECT (self)); id = bytestream_id_new (GABBLE_BYTESTREAM_IFACE (socks5)); DEBUG ("add SOCKS5 bytestream <%s> from <%s>", id->stream, id->jid); @@ -1375,8 +1356,8 @@ gabble_bytestream_factory_create_multiple (GabbleBytestreamFactory *self, "factory", self, NULL); - g_signal_connect (multiple, "state-changed", - G_CALLBACK (bytestream_state_changed_cb), self); + gabble_signal_connect_weak (multiple, "state-changed", + G_CALLBACK (bytestream_state_changed_cb), G_OBJECT (self)); id = bytestream_id_new (GABBLE_BYTESTREAM_IFACE (multiple)); DEBUG ("add multi bytestream <%s> from <%s>", id->stream, id->jid); |