[Telepathy-commits] [telepathy-salut/master] Factorise g_object_ref (priv->xmpp_connection) in _initialise_connection

Alban Crequy alban.crequy at collabora.co.uk
Tue Nov 25 03:59:21 PST 2008


---
 src/salut-tubes-channel.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/salut-tubes-channel.c b/src/salut-tubes-channel.c
index 887710e..6987423 100644
--- a/src/salut-tubes-channel.c
+++ b/src/salut-tubes-channel.c
@@ -358,13 +358,14 @@ salut_tubes_channel_set_property (GObject *object,
 }
 
 static void
-_initialise_connection (SalutTubesChannel *self)
+_initialise_connection (SalutTubesChannel *self, GibberXmppConnection *conn)
 {
   SalutTubesChannelPrivate *priv = SALUT_TUBES_CHANNEL_GET_PRIVATE (self);
 
-  DEBUG ("called.");
+  g_assert (conn != NULL);
+  priv->xmpp_connection = conn;
+  g_object_ref (priv->xmpp_connection);
 
-  g_assert (priv->xmpp_connection != NULL);
   g_assert (
      (priv->xmpp_connection->stream_flags &
        ~(GIBBER_XMPP_CONNECTION_STREAM_FULLY_OPEN
@@ -403,9 +404,7 @@ xmpp_connection_manager_new_connection_cb (SalutXmppConnectionManager *mgr,
 
   DEBUG ("pending connection fully open");
 
-  priv->xmpp_connection = conn;
-  g_object_ref (priv->xmpp_connection);
-  _initialise_connection (self);
+  _initialise_connection (self, conn);
 }
 
 static void
@@ -489,9 +488,7 @@ _setup_connection (SalutTubesChannel *self)
   if (result == SALUT_XMPP_CONNECTION_MANAGER_REQUEST_CONNECTION_RESULT_DONE)
     {
       DEBUG ("connection done.");
-      priv->xmpp_connection = conn;
-      g_object_ref (priv->xmpp_connection);
-      _initialise_connection (self);
+      _initialise_connection (self, conn);
     }
   else if (result ==
       SALUT_XMPP_CONNECTION_MANAGER_REQUEST_CONNECTION_RESULT_PENDING)
-- 
1.5.6.5




More information about the Telepathy-commits mailing list