summaryrefslogtreecommitdiff
path: root/telepathy-glib/channel.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2011-08-01 14:26:04 +0200
committerXavier Claessens <xclaesse@gmail.com>2011-08-01 14:35:33 +0200
commit98568941339b7f177c790036fdd20a813398dbc8 (patch)
treeb1454c2dee4210dbb479af5c1182d0950b9a8572 /telepathy-glib/channel.c
parent9bd9e89432eee838986ee9e1ab84631892170be4 (diff)
downloadtelepathy-glib-98568941339b7f177c790036fdd20a813398dbc8.tar.gz
TpChannel: prepare CORE on its connection before doing anything else
Diffstat (limited to 'telepathy-glib/channel.c')
-rw-r--r--telepathy-glib/channel.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/telepathy-glib/channel.c b/telepathy-glib/channel.c
index 011456c7b..acfd4dc19 100644
--- a/telepathy-glib/channel.c
+++ b/telepathy-glib/channel.c
@@ -1122,6 +1122,40 @@ missing:
TP_IFACE_CHANNEL, _tp_channel_got_properties, NULL, NULL, NULL);
}
+static void
+connection_prepared_cb (GObject *object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ TpChannel *self = user_data;
+ GError *error = NULL;
+
+ if (!tp_proxy_prepare_finish (object, res, &error))
+ {
+ _tp_channel_abort_introspection (self, "Preparing connection failed", error);
+ g_clear_error (&error);
+ }
+ else
+ {
+ _tp_channel_continue_introspection (self);
+ }
+
+ g_object_unref (self);
+}
+
+static void
+_tp_channel_prepare_connection (TpChannel *self)
+{
+ /* Skip if connection is already prepared */
+ if (tp_proxy_is_prepared (self->priv->connection, TP_CONNECTION_FEATURE_CORE))
+ {
+ _tp_channel_continue_introspection (self);
+ return;
+ }
+
+ tp_proxy_prepare_async (self->priv->connection, NULL,
+ connection_prepared_cb, g_object_ref (self));
+}
static void
tp_channel_closed_cb (TpChannel *self,
@@ -1211,6 +1245,10 @@ tp_channel_constructor (GType type,
self->priv->introspect_needed = g_queue_new ();
+ /* this does nothing if connection already has CORE prepared */
+ g_queue_push_tail (self->priv->introspect_needed,
+ _tp_channel_prepare_connection);
+
/* this does nothing if we already know all the Channel properties this
* code is aware of */
g_queue_push_tail (self->priv->introspect_needed,