[telepathy-mission-control/master] _mcd_dispatch_operation_approve: remove the subtle and confusing distinction between this function and _mcd_dispatch_operation_set_approved

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Nov 2 06:41:50 PST 2009


---
 src/mcd-dispatch-operation-priv.h |    3 ---
 src/mcd-dispatch-operation.c      |   23 ++++++++++++++++++-----
 src/mcd-dispatcher.c              |   13 +------------
 3 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/src/mcd-dispatch-operation-priv.h b/src/mcd-dispatch-operation-priv.h
index 9d6c205..601c642 100644
--- a/src/mcd-dispatch-operation-priv.h
+++ b/src/mcd-dispatch-operation-priv.h
@@ -88,9 +88,6 @@ G_GNUC_INTERNAL
 const gchar * const *_mcd_dispatch_operation_get_possible_handlers (
     McdDispatchOperation *self);
 
-G_GNUC_INTERNAL void _mcd_dispatch_operation_set_approved (
-    McdDispatchOperation *self);
-
 /* AddDispatchOperation calls */
 G_GNUC_INTERNAL gboolean _mcd_dispatch_operation_has_ado_pending (
     McdDispatchOperation *self);
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index 3d8d2fe..707638f 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -465,6 +465,8 @@ mcd_dispatch_operation_set_channel_handled_by (McdDispatchOperation *self,
                                           tp_channel, unique_name);
 }
 
+static void _mcd_dispatch_operation_set_approved (McdDispatchOperation *self);
+
 static void
 mcd_dispatch_operation_actually_finish (McdDispatchOperation *self)
 {
@@ -1129,12 +1131,23 @@ _mcd_dispatch_operation_approve (McdDispatchOperation *self)
 
     DEBUG ("%s/%p", self->priv->unique_name, self);
 
-    if (!mcd_dispatch_operation_check_handle_with (self, NULL, NULL))
+    if (_mcd_dispatch_operation_has_ado_pending (self)
+        || _mcd_dispatch_operation_is_awaiting_approval (self))
     {
-        return;
-    }
+        /* the existing channel is waiting for approval; but since the
+         * same channel has been requested, the approval operation must
+         * terminate */
+        if (!mcd_dispatch_operation_check_handle_with (self, NULL, NULL))
+        {
+            return;
+        }
 
-    _mcd_dispatch_operation_finish (self);
+        _mcd_dispatch_operation_finish (self);
+    }
+    else
+    {
+        _mcd_dispatch_operation_set_approved (self);
+    }
 }
 
 static void
@@ -1309,7 +1322,7 @@ _mcd_dispatch_operation_handlers_can_bypass_approval (
     return FALSE;
 }
 
-void
+static void
 _mcd_dispatch_operation_set_approved (McdDispatchOperation *self)
 {
     g_return_if_fail (MCD_IS_DISPATCH_OPERATION (self));
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index d276cde..7ec846b 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -1905,18 +1905,7 @@ _mcd_dispatcher_add_channel_request (McdDispatcher *dispatcher,
             g_return_if_fail (op != NULL);
 
             DEBUG ("channel %p is in CDO %p", channel, op);
-            if (_mcd_dispatch_operation_has_ado_pending (op)
-                || _mcd_dispatch_operation_is_awaiting_approval (op))
-            {
-                /* the existing channel is waiting for approval; but since the
-                 * same channel has been requested, the approval operation must
-                 * terminate */
-                _mcd_dispatch_operation_approve (op);
-            }
-            else
-            {
-                _mcd_dispatch_operation_set_approved (op);
-            }
+            _mcd_dispatch_operation_approve (op);
         }
         DEBUG ("channel %p is proxying %p", request, channel);
     }
-- 
1.5.6.5




More information about the telepathy-commits mailing list