aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-tube-handler.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-04-17 21:23:52 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-04-21 23:47:08 +0800
commitc8d23985b7754541cab512992294c19f5c87cfaa (patch)
tree5bccdf5cb53a7a0583515c9943925f31f38e2e55 /libempathy/empathy-tube-handler.c
parent5bd12dbfd7f41cbfdb8cfc7a783b756ce77da6e3 (diff)
downloadgsoc2013-empathy-c8d23985b7754541cab512992294c19f5c87cfaa.tar
gsoc2013-empathy-c8d23985b7754541cab512992294c19f5c87cfaa.tar.gz
gsoc2013-empathy-c8d23985b7754541cab512992294c19f5c87cfaa.tar.bz2
gsoc2013-empathy-c8d23985b7754541cab512992294c19f5c87cfaa.tar.lz
gsoc2013-empathy-c8d23985b7754541cab512992294c19f5c87cfaa.tar.xz
gsoc2013-empathy-c8d23985b7754541cab512992294c19f5c87cfaa.tar.zst
gsoc2013-empathy-c8d23985b7754541cab512992294c19f5c87cfaa.zip
empathy-tube-handler: wait that tube is ready before announcing it
Diffstat (limited to 'libempathy/empathy-tube-handler.c')
-rw-r--r--libempathy/empathy-tube-handler.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/libempathy/empathy-tube-handler.c b/libempathy/empathy-tube-handler.c
index 18cda18b3..43e19fde7 100644
--- a/libempathy/empathy-tube-handler.c
+++ b/libempathy/empathy-tube-handler.c
@@ -59,15 +59,38 @@ typedef struct
gchar *channel;
guint handle_type;
guint handle;
+ EmpathyTpTube *tube;
} IdleData;
+static void
+tube_ready_cb (EmpathyTpTube *tube,
+ const GError *error,
+ gpointer user_data,
+ GObject *weak_object)
+{
+ IdleData *idle_data = user_data;
+
+ g_signal_emit (idle_data->thandler, signals[NEW_TUBE], 0, tube);
+}
+
+static void
+tube_ready_destroy_notify (gpointer data)
+{
+ IdleData *idle_data = data;
+
+ g_object_unref (idle_data->tube);
+ g_free (idle_data->bus_name);
+ g_free (idle_data->connection);
+ g_free (idle_data->channel);
+ g_slice_free (IdleData, idle_data);
+}
+
static gboolean
tube_handler_handle_tube_idle_cb (gpointer data)
{
IdleData *idle_data = data;
TpConnection *connection;
TpChannel *channel;
- EmpathyTpTube *tube;
static TpDBusDaemon *daemon = NULL;
DEBUG ("New tube to be handled");
@@ -82,16 +105,12 @@ tube_handler_handle_tube_idle_cb (gpointer data)
idle_data->handle, NULL);
tp_channel_run_until_ready (channel, NULL, NULL);
- tube = empathy_tp_tube_new (channel);
- g_signal_emit (idle_data->thandler, signals[NEW_TUBE], 0, tube);
+ idle_data->tube = empathy_tp_tube_new (channel);
+ empathy_tp_tube_call_when_ready (idle_data->tube, tube_ready_cb, idle_data,
+ tube_ready_destroy_notify, NULL);
- g_object_unref (tube);
g_object_unref (channel);
g_object_unref (connection);
- g_free (idle_data->bus_name);
- g_free (idle_data->connection);
- g_free (idle_data->channel);
- g_slice_free (IdleData, idle_data);
return FALSE;
}