]> git.0d.be Git - empathy.git/commitdiff
goa-auth-handler: factor out auth_data_new()
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 3 Aug 2012 07:28:49 +0000 (09:28 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 3 Aug 2012 07:39:49 +0000 (09:39 +0200)
We already have the _free() function and it makes easier to track the
lifecycle of the struct.

https://bugzilla.gnome.org/show_bug.cgi?id=680952

libempathy/empathy-goa-auth-handler.c

index 260ba126458aed5f0ae653492ed4959ee71128d6..99968946d2cef18d1d245fad67f765601bd24a45 100644 (file)
@@ -86,6 +86,21 @@ typedef struct
   gchar *access_token;
 } AuthData;
 
+static AuthData *
+auth_data_new (EmpathyGoaAuthHandler *self,
+    TpChannel *channel,
+    TpAccount *account)
+{
+  AuthData *data;
+
+  data = g_slice_new0 (AuthData);
+  data->self = g_object_ref (self);
+  data->channel = g_object_ref (channel);
+  data->account = g_object_ref (account);
+
+  return data;
+}
+
 static void
 auth_data_free (AuthData *data)
 {
@@ -300,10 +315,7 @@ empathy_goa_auth_handler_start (EmpathyGoaAuthHandler *self,
   DEBUG ("Start Goa auth for account: %s",
       tp_proxy_get_object_path (account));
 
-  data = g_slice_new0 (AuthData);
-  data->self = g_object_ref (self);
-  data->channel = g_object_ref (channel);
-  data->account = g_object_ref (account);
+  data = auth_data_new (self, channel, account);
 
   if (self->priv->client == NULL)
     {