[telepathy-mission-control/master] _mcd_dispatch_operation_run_clients: run approvers from an idle

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Oct 19 14:41:39 PDT 2009


---
 src/mcd-dispatch-operation.c |   36 +++++++++++++++++++++++-------------
 1 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index 2e5ff5b..ced8fb7 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -1625,26 +1625,18 @@ _mcd_dispatch_operation_run_approvers (McdDispatchOperation *self)
     _mcd_dispatch_operation_dec_ado_pending (self);
 }
 
-/* After this function is called, the McdDispatchOperation takes over its
- * own life-cycle, and the caller needn't hold an explicit reference to it. */
-void
-_mcd_dispatch_operation_run_clients (McdDispatchOperation *self)
+static gboolean
+mcd_dispatch_operation_idle_run_approvers (gpointer p)
 {
-    g_object_ref (self);
+    McdDispatchOperation *self = p;
 
-    _mcd_dispatch_operation_run_observers (self);
-    self->priv->invoked_observers_if_needed = TRUE;
-    _mcd_dispatch_operation_check_client_locks (self);
-
-    /* if the dispatch operation thinks the channels were not
-     * requested, start the Approvers */
     if (_mcd_dispatch_operation_needs_approval (self))
     {
-        /* but if the handlers have the BypassApproval flag set, then don't
+        /* Bypass approval if a handler has BypassApproval
          *
          * FIXME: we should really run BypassApproval handlers as a separate
          * stage, rather than considering the existence of a BypassApproval
-         * handler to constitute approval - this is fd.o #23687 */
+         * handler to constitute general approval - this is fd.o #23687 */
         if (_mcd_dispatch_operation_handlers_can_bypass_approval (self))
             _mcd_dispatch_operation_set_approved (self);
 
@@ -1655,6 +1647,24 @@ _mcd_dispatch_operation_run_clients (McdDispatchOperation *self)
     self->priv->invoked_approvers_if_needed = TRUE;
     _mcd_dispatch_operation_check_client_locks (self);
 
+    return FALSE;
+}
+
+/* After this function is called, the McdDispatchOperation takes over its
+ * own life-cycle, and the caller needn't hold an explicit reference to it. */
+void
+_mcd_dispatch_operation_run_clients (McdDispatchOperation *self)
+{
+    g_object_ref (self);
+
+    _mcd_dispatch_operation_run_observers (self);
+    self->priv->invoked_observers_if_needed = TRUE;
+    _mcd_dispatch_operation_check_client_locks (self);
+
+    g_idle_add_full (G_PRIORITY_HIGH,
+                     mcd_dispatch_operation_idle_run_approvers,
+                     g_object_ref (self), g_object_unref);
+
     g_object_unref (self);
 }
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list