[telepathy-gabble/master] bytestream-factory: use gabble_signal_connect_weak instead of manually disconnect signals
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Fri Apr 3 09:25:52 PDT 2009
---
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 a2ab20b..d648f97 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);
--
1.5.6.5
More information about the telepathy-commits
mailing list