diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-03-24 11:05:59 +0000 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-03-24 11:12:17 +0000 |
commit | 1098480d797fb261eef5e8b9ce6c206acb63fd73 (patch) | |
tree | 867df29c894cee2b129f32f4e22eadf2545b3f07 /lib/gibber | |
parent | e3a81ac84abf6cedaea3aac4d638461e296346fd (diff) |
bytestream-[io]bb: fix so more than the first object can work
Also, clean up by removing the if (blah blah blah) in the set_property
implementation.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Diffstat (limited to 'lib/gibber')
-rw-r--r-- | lib/gibber/gibber-bytestream-ibb.c | 23 | ||||
-rw-r--r-- | lib/gibber/gibber-bytestream-oob.c | 24 |
2 files changed, 23 insertions, 24 deletions
diff --git a/lib/gibber/gibber-bytestream-ibb.c b/lib/gibber/gibber-bytestream-ibb.c index 437dd4f8..5fe2823b 100644 --- a/lib/gibber/gibber-bytestream-ibb.c +++ b/lib/gibber/gibber-bytestream-ibb.c @@ -224,12 +224,8 @@ static void make_porter_connections (GibberBytestreamIBB *self) { GibberBytestreamIBBPrivate *priv = GIBBER_BYTESTREAM_IBB_GET_PRIVATE (self); - static gboolean done = FALSE; gchar *jid; - if (done) - return; - jid = wocky_contact_dup_jid (priv->contact); priv->stanza_received_id = wocky_porter_register_handler_from (priv->porter, @@ -237,8 +233,6 @@ make_porter_connections (GibberBytestreamIBB *self) WOCKY_PORTER_HANDLER_PRIORITY_NORMAL, received_stanza_cb, self, NULL); g_free (jid); - - done = TRUE; } static void @@ -254,15 +248,9 @@ gibber_bytestream_ibb_set_property (GObject *object, { case PROP_PORTER: priv->porter = g_value_dup_object (value); - - if (priv->porter != NULL && priv->contact != NULL) - make_porter_connections (self); break; case PROP_CONTACT: priv->contact = g_value_dup_object (value); - - if (priv->porter != NULL && priv->contact != NULL) - make_porter_connections (self); break; case PROP_SELF_ID: g_free (priv->self_id); @@ -316,6 +304,16 @@ gibber_bytestream_ibb_constructor (GType type, } static void +gibber_bytestream_ibb_constructed (GObject *obj) +{ + GibberBytestreamIBB *self = GIBBER_BYTESTREAM_IBB (obj); + GibberBytestreamIBBPrivate *priv = GIBBER_BYTESTREAM_IBB_GET_PRIVATE (self); + + if (priv->porter != NULL && priv->contact != NULL) + make_porter_connections (self); +} + +static void gibber_bytestream_ibb_class_init ( GibberBytestreamIBBClass *gibber_bytestream_ibb_class) { @@ -331,6 +329,7 @@ gibber_bytestream_ibb_class_init ( object_class->get_property = gibber_bytestream_ibb_get_property; object_class->set_property = gibber_bytestream_ibb_set_property; object_class->constructor = gibber_bytestream_ibb_constructor; + object_class->constructed = gibber_bytestream_ibb_constructed; g_object_class_override_property (object_class, PROP_SELF_ID, "self-id"); diff --git a/lib/gibber/gibber-bytestream-oob.c b/lib/gibber/gibber-bytestream-oob.c index c2ec7ad8..8df7aecc 100644 --- a/lib/gibber/gibber-bytestream-oob.c +++ b/lib/gibber/gibber-bytestream-oob.c @@ -564,12 +564,8 @@ static void make_porter_connections (GibberBytestreamOOB *self) { GibberBytestreamOOBPrivate *priv = GIBBER_BYTESTREAM_OOB_GET_PRIVATE (self); - static gboolean done = FALSE; gchar *jid; - if (done) - return; - jid = wocky_contact_dup_jid (priv->contact); priv->stanza_received_id = wocky_porter_register_handler_from (priv->porter, @@ -577,8 +573,6 @@ make_porter_connections (GibberBytestreamOOB *self) WOCKY_PORTER_HANDLER_PRIORITY_NORMAL, received_stanza_cb, self, NULL); g_free (jid); - - done = TRUE; } static void @@ -594,15 +588,9 @@ gibber_bytestream_oob_set_property (GObject *object, { case PROP_PORTER: priv->porter = g_value_dup_object (value); - - if (priv->porter != NULL && priv->contact != NULL) - make_porter_connections (self); break; case PROP_CONTACT: priv->contact = g_value_dup_object (value); - - if (priv->porter != NULL && priv->contact != NULL) - make_porter_connections (self); break; case PROP_SELF_ID: g_free (priv->self_id); @@ -660,6 +648,17 @@ gibber_bytestream_oob_constructor (GType type, } static void +gibber_bytestream_oob_constructed (GObject *obj) +{ + GibberBytestreamOOB *self = GIBBER_BYTESTREAM_OOB (obj); + GibberBytestreamOOBPrivate *priv = GIBBER_BYTESTREAM_OOB_GET_PRIVATE (self); + + if (priv->porter != NULL && priv->contact != NULL) + make_porter_connections (self); +} + + +static void gibber_bytestream_oob_class_init ( GibberBytestreamOOBClass *gibber_bytestream_oob_class) { @@ -675,6 +674,7 @@ gibber_bytestream_oob_class_init ( object_class->get_property = gibber_bytestream_oob_get_property; object_class->set_property = gibber_bytestream_oob_set_property; object_class->constructor = gibber_bytestream_oob_constructor; + object_class->constructed = gibber_bytestream_oob_constructed; g_object_class_override_property (object_class, PROP_SELF_ID, "self-id"); |