From 54f4fd22c09a342bb58da978b5a055e45f968897 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Fri, 6 Jul 2012 16:50:08 +0100 Subject: dispatcher: set channel state back to DISPATCHED after delegating & presenting _mcd_client_proxy_handle_channels sets the McdChannel state to HANDLER_INVOKED, but when we were calling this in both delegate and present operations, the state was not being set back to the DISPATCHED state afterwards. The state being wrong meant that dispatching a channel after if had been delegated or presented would not happen, as MC thought we were still waiting for a handler response. Signed-off-by: Jonny Lamb --- src/mcd-dispatcher.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c index 6a675ddb..3abbd388 100644 --- a/src/mcd-dispatcher.c +++ b/src/mcd-dispatcher.c @@ -2584,6 +2584,13 @@ delegate_channels_cb (TpClient *client, DelegateChannelsCtx *ctx = to_delegate->ctx; McdClientProxy *clt_proxy = MCD_CLIENT_PROXY (client); + /* If the delegation succeeded, the channel has a new handler. If + * the delegation failed, the channel still has the old + * handler. Either way, the channel still has a handler, so it has + * been successfully dispatched (from 'handler invoked'). */ + _mcd_channel_set_status (to_delegate->channel, + MCD_CHANNEL_STATUS_DISPATCHED); + if (error != NULL) { DEBUG ("Handler refused delegated channels"); @@ -2821,10 +2828,17 @@ error: static void present_handle_channels_cb (TpClient *client, const GError *error, - gpointer user_data G_GNUC_UNUSED, + gpointer user_data, GObject *weak_object) { DBusGMethodInvocation *context = user_data; + McdChannel *mcd_channel = MCD_CHANNEL (weak_object); + + /* Whether presenting the channel succeeded or failed, the + * channel's handler hasn't been altered, so it must be set back + * to the dispatched state (from 'handler invoked'). */ + _mcd_channel_set_status (mcd_channel, + MCD_CHANNEL_STATUS_DISPATCHED); if (error != NULL) { @@ -2893,7 +2907,7 @@ dispatcher_present_channel ( _mcd_client_proxy_handle_channels (client, -1, channels, user_action_time, NULL, present_handle_channels_cb, - context, NULL, NULL); + context, NULL, G_OBJECT (mcd_channel)); g_list_free (channels); return; -- cgit v1.2.1