aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-04-27 21:19:25 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-04-27 21:19:25 +0800
commit46fcfa0a1c15e58b98cfec0c1ce998dee6de5a40 (patch)
treeb6e7046cce61a873dcb2bfb9b1847c6e05d97689 /libempathy
parentffe14c2ff520c3a561e4cac20510e23f70127a1d (diff)
downloadgsoc2013-empathy-46fcfa0a1c15e58b98cfec0c1ce998dee6de5a40.tar
gsoc2013-empathy-46fcfa0a1c15e58b98cfec0c1ce998dee6de5a40.tar.gz
gsoc2013-empathy-46fcfa0a1c15e58b98cfec0c1ce998dee6de5a40.tar.bz2
gsoc2013-empathy-46fcfa0a1c15e58b98cfec0c1ce998dee6de5a40.tar.lz
gsoc2013-empathy-46fcfa0a1c15e58b98cfec0c1ce998dee6de5a40.tar.xz
gsoc2013-empathy-46fcfa0a1c15e58b98cfec0c1ce998dee6de5a40.tar.zst
gsoc2013-empathy-46fcfa0a1c15e58b98cfec0c1ce998dee6de5a40.zip
tube-handler: wait that the connection is ready before creating the TpChannel
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-tube-handler.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/libempathy/empathy-tube-handler.c b/libempathy/empathy-tube-handler.c
index 43e19fde7..ec12d18ba 100644
--- a/libempathy/empathy-tube-handler.c
+++ b/libempathy/empathy-tube-handler.c
@@ -85,21 +85,20 @@ tube_ready_destroy_notify (gpointer data)
g_slice_free (IdleData, idle_data);
}
-static gboolean
-tube_handler_handle_tube_idle_cb (gpointer data)
+static void
+connection_ready_cb (TpConnection *connection,
+ const GError *error,
+ gpointer data)
{
- IdleData *idle_data = data;
- TpConnection *connection;
TpChannel *channel;
- static TpDBusDaemon *daemon = NULL;
-
- DEBUG ("New tube to be handled");
+ IdleData *idle_data = data;
- if (!daemon)
- daemon = tp_dbus_daemon_new (tp_get_bus ());
+ if (error != NULL)
+ {
+ DEBUG ("connection has been invalidated: %s", error->message);
+ return;
+ }
- connection = tp_connection_new (daemon, idle_data->bus_name,
- idle_data->connection, NULL);
channel = tp_channel_new (connection, idle_data->channel,
TP_IFACE_CHANNEL_TYPE_TUBES, idle_data->handle_type,
idle_data->handle, NULL);
@@ -111,6 +110,24 @@ tube_handler_handle_tube_idle_cb (gpointer data)
g_object_unref (channel);
g_object_unref (connection);
+}
+
+static gboolean
+tube_handler_handle_tube_idle_cb (gpointer data)
+{
+ IdleData *idle_data = data;
+ TpConnection *connection;
+ static TpDBusDaemon *daemon = NULL;
+
+ DEBUG ("New tube to be handled");
+
+ if (!daemon)
+ daemon = tp_dbus_daemon_new (tp_get_bus ());
+
+ connection = tp_connection_new (daemon, idle_data->bus_name,
+ idle_data->connection, NULL);
+ tp_connection_call_when_ready (connection,
+ connection_ready_cb, idle_data);
return FALSE;
}