aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimo.cecchi@collabora.co.uk>2010-09-09 18:01:05 +0800
committerCosimo Cecchi <cosimo.cecchi@collabora.co.uk>2010-09-09 18:05:21 +0800
commit1df0a982198b8bd8cec867708dd65b8b7373acee (patch)
tree12100b6e546a01cc71479e9f7c303f6e121658d7 /libempathy
parentd4a88e86b74d89c0fb6022b6fea430eb904fe9b5 (diff)
downloadgsoc2013-empathy-1df0a982198b8bd8cec867708dd65b8b7373acee.tar
gsoc2013-empathy-1df0a982198b8bd8cec867708dd65b8b7373acee.tar.gz
gsoc2013-empathy-1df0a982198b8bd8cec867708dd65b8b7373acee.tar.bz2
gsoc2013-empathy-1df0a982198b8bd8cec867708dd65b8b7373acee.tar.lz
gsoc2013-empathy-1df0a982198b8bd8cec867708dd65b8b7373acee.tar.xz
gsoc2013-empathy-1df0a982198b8bd8cec867708dd65b8b7373acee.tar.zst
gsoc2013-empathy-1df0a982198b8bd8cec867708dd65b8b7373acee.zip
Use separate new/free functions for the handler context data
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-auth-factory.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/libempathy/empathy-auth-factory.c b/libempathy/empathy-auth-factory.c
index cfb33c4b3..fa2b7dcd1 100644
--- a/libempathy/empathy-auth-factory.c
+++ b/libempathy/empathy-auth-factory.c
@@ -56,6 +56,28 @@ typedef struct {
} HandlerContextData;
static void
+handler_context_data_free (HandlerContextData *data)
+{
+ tp_clear_object (&data->self);
+ tp_clear_object (&data->context);
+
+ g_slice_free (HandlerContextData, data);
+}
+
+static HandlerContextData *
+handler_context_data_new (EmpathyAuthFactory *self,
+ TpHandleChannelsContext *context)
+{
+ HandlerContextData *data;
+
+ data = g_slice_new0 (HandlerContextData);
+ data->self = g_object_ref (self);
+ data->context = g_object_ref (context);
+
+ return data;
+}
+
+static void
server_tls_handler_ready_cb (GObject *source,
GAsyncResult *res,
gpointer user_data)
@@ -85,10 +107,7 @@ server_tls_handler_ready_cb (GObject *source,
g_object_unref (handler);
}
- tp_clear_object (&data->context);
- tp_clear_object (&data->self);
-
- g_slice_free (HandlerContextData, data);
+ handler_context_data_free (data);
}
static void
@@ -142,10 +161,7 @@ handle_channels_cb (TpSimpleHandler *handler,
}
/* create a handler */
- data = g_slice_new0 (HandlerContextData);
- data->context = g_object_ref (context);
- data->self = g_object_ref (self);
-
+ data = handler_context_data_new (self, context);
tp_handle_channels_context_delay (context);
empathy_server_tls_handler_new_async (channel, server_tls_handler_ready_cb,
data);