summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2011-11-02 13:30:24 +0100
committerXavier Claessens <xclaesse@gmail.com>2011-11-07 14:34:52 +0100
commitdedce116cc8b592743cb599bda3e6aa32c5be730 (patch)
tree3e36c3b04f6707007a6d2d7a1bdf32aab5282b10
parentd2e6b77f34cf74cbaa8ec8f352ff7b7d9be117d4 (diff)
TpObserverChannelsContext: prepare the CDO
Observers doing tp_cdo_claim_with_async() will need it to be prepared
-rw-r--r--telepathy-glib/observe-channels-context.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/telepathy-glib/observe-channels-context.c b/telepathy-glib/observe-channels-context.c
index 7acebd81..30253056 100644
--- a/telepathy-glib/observe-channels-context.c
+++ b/telepathy-glib/observe-channels-context.c
@@ -529,6 +529,31 @@ context_check_prepare (TpObserveChannelsContext *self)
}
static void
+cdo_prepare_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ TpObserveChannelsContext *self = user_data;
+ GError *error = NULL;
+
+ if (self->priv->result == NULL)
+ goto out;
+
+ if (!tp_proxy_prepare_finish (source, result, &error))
+ {
+ DEBUG ("Failed to prepare ChannelDispatchOperation: %s", error->message);
+
+ g_error_free (error);
+ }
+
+ self->priv->num_pending--;
+ context_check_prepare (self);
+
+out:
+ g_object_unref (self);
+}
+
+static void
account_prepare_cb (GObject *source,
GAsyncResult *result,
gpointer user_data)
@@ -606,6 +631,7 @@ context_prepare (TpObserveChannelsContext *self,
const GQuark *connection_features,
const GQuark *channel_features)
{
+ GQuark cdo_features[] = { TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE, 0 };
guint i;
self->priv->num_pending = 2;
@@ -616,6 +642,13 @@ context_prepare (TpObserveChannelsContext *self,
tp_proxy_prepare_async (self->connection, connection_features,
conn_prepare_cb, g_object_ref (self));
+ if (self->dispatch_operation != NULL)
+ {
+ self->priv->num_pending++;
+ tp_proxy_prepare_async (self->dispatch_operation, cdo_features,
+ cdo_prepare_cb, g_object_ref (self));
+ }
+
for (i = 0; i < self->channels->len; i++)
{
TpChannel *channel = g_ptr_array_index (self->channels, i);