diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2010-12-21 15:58:22 +0000 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2010-12-21 15:58:22 +0000 |
commit | 6d6b34b49171602e9bf47039b991d0376dd2c457 (patch) | |
tree | c8b87d64c9a40d89dcaee1fe457d3ffcc6a60778 | |
parent | 6ef602298271ae2741e6e75245002684fb2ff9a6 (diff) | |
download | telepathy-mission-control-6d6b34b49171602e9bf47039b991d0376dd2c457.tar.gz |
mcd-dispatch-operation: don't call ADO if DelayApprover Observers haven't returned
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r-- | src/mcd-dispatch-operation.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c index f65cacb8..aea5bb70 100644 --- a/src/mcd-dispatch-operation.c +++ b/src/mcd-dispatch-operation.c @@ -370,6 +370,8 @@ static gboolean mcd_dispatch_operation_idle_run_approvers (gpointer p); static void mcd_dispatch_operation_set_channel_handled_by ( McdDispatchOperation *self, McdChannel *channel, const gchar *unique_name, const gchar *well_known_name); +static gboolean _mcd_dispatch_operation_observers_can_delay_approvers ( + McdDispatchOperation *self); static gboolean _mcd_dispatch_operation_handlers_can_bypass_approval ( McdDispatchOperation *self); static gboolean _mcd_dispatch_operation_handlers_can_bypass_observers ( @@ -411,6 +413,7 @@ _mcd_dispatch_operation_check_client_locks (McdDispatchOperation *self) * return, then run that handler, then proceed with the other handlers. */ if (!self->priv->tried_handlers_before_approval && !_mcd_dispatch_operation_handlers_can_bypass_approval (self) + && !_mcd_dispatch_operation_observers_can_delay_approvers (self) && self->priv->channels != NULL && ! _mcd_plugin_dispatch_operation_will_terminate ( self->priv->plugin_api)) @@ -1663,6 +1666,58 @@ _mcd_dispatch_operation_get_handler_failed (McdDispatchOperation *self, } static gboolean +_mcd_dispatch_operation_observers_can_delay_approvers ( + McdDispatchOperation *self) +{ + GHashTableIter iter; + gpointer client_p; + const GList *cl; + + _mcd_client_registry_init_hash_iter (self->priv->client_registry, &iter); + + while (g_hash_table_iter_next (&iter, NULL, &client_p)) + { + McdClientProxy *client = MCD_CLIENT_PROXY (client_p); + gboolean can_observe = FALSE; + gboolean bypass; + + if (!tp_proxy_has_interface_by_id (client, + TP_IFACE_QUARK_CLIENT_OBSERVER)) + continue; + + for (cl = self->priv->channels; cl != NULL; cl = cl->next) + { + McdChannel *channel = MCD_CHANNEL (cl->data); + GHashTable *properties; + + properties = _mcd_channel_get_immutable_properties (channel); + g_assert (properties != NULL); + + if (_mcd_client_match_filters (properties, + _mcd_client_proxy_get_observer_filters (client), + FALSE)) + { + can_observe = TRUE; + break; + } + } + + if (!can_observe) + continue; + + bypass = _mcd_client_proxy_get_delay_approvers (client); + + DEBUG ("%s has DelayApprovers=%c", + tp_proxy_get_object_path (client), bypass ? 'T' : 'F'); + + if (bypass) + return bypass; + } + + return FALSE; +} + +static gboolean _mcd_dispatch_operation_handlers_can_bypass_approval ( McdDispatchOperation *self) { |