From 7c54415fc4b9d9751ce2bcadcbd5e53d511ab42c Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 3 Aug 2012 09:28:49 +0200 Subject: goa-auth-handler: factor out auth_data_new() 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 | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-goa-auth-handler.c b/libempathy/empathy-goa-auth-handler.c index 260ba1264..99968946d 100644 --- a/libempathy/empathy-goa-auth-handler.c +++ b/libempathy/empathy-goa-auth-handler.c @@ -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) { -- cgit