[telepathy-mission-control/master] McdDispatchOperation: take the channels_handled flag from McdDispatcherContext
Simon McVittie
simon.mcvittie at collabora.co.uk
Tue Oct 20 08:47:22 PDT 2009
---
src/mcd-dispatch-operation-priv.h | 5 +++++
src/mcd-dispatch-operation.c | 19 +++++++++++++++++++
src/mcd-dispatcher.c | 18 +++++++++---------
3 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/src/mcd-dispatch-operation-priv.h b/src/mcd-dispatch-operation-priv.h
index ee137b4..5d2a424 100644
--- a/src/mcd-dispatch-operation-priv.h
+++ b/src/mcd-dispatch-operation-priv.h
@@ -132,6 +132,11 @@ G_GNUC_INTERNAL gboolean _mcd_dispatch_operation_is_awaiting_approval (
G_GNUC_INTERNAL void _mcd_dispatch_operation_set_awaiting_approval (
McdDispatchOperation *self, gboolean value);
+G_GNUC_INTERNAL gboolean _mcd_dispatch_operation_get_channels_handled (
+ McdDispatchOperation *self);
+G_GNUC_INTERNAL void _mcd_dispatch_operation_set_channels_handled (
+ McdDispatchOperation *self, gboolean value);
+
G_END_DECLS
#endif
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index 6e1ba77..b9d5eeb 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -137,6 +137,10 @@ struct _McdDispatchOperationPrivate
* A reference is held for each pending approver (and in the
* McdDispatcherContext, one instance of CTXREF06 is held for each). */
gsize ado_pending;
+
+ /* If TRUE, either we've already arranged for the channels to get a
+ * handler, or there are no channels left. */
+ gboolean channels_handled;
};
static void _mcd_dispatch_operation_check_finished (
@@ -250,6 +254,21 @@ _mcd_dispatch_operation_set_awaiting_approval (McdDispatchOperation *self,
self->priv->awaiting_approval = value;
}
+void
+_mcd_dispatch_operation_set_channels_handled (McdDispatchOperation *self,
+ gboolean value)
+{
+ g_return_if_fail (MCD_IS_DISPATCH_OPERATION (self));
+ self->priv->channels_handled = value;
+}
+
+gboolean
+_mcd_dispatch_operation_get_channels_handled (McdDispatchOperation *self)
+{
+ g_return_val_if_fail (MCD_IS_DISPATCH_OPERATION (self), FALSE);
+ return self->priv->channels_handled;
+}
+
enum
{
PROP_0,
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index e2a3630..9fabb0c 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -93,10 +93,6 @@ struct _McdDispatcherContext
/* If this flag is TRUE, dispatching must be cancelled ASAP */
guint cancelled : 1;
- /* If TRUE, either we've already arranged for the channels to get a
- * handler, or there are no channels left. */
- guint channels_handled : 1;
-
McdDispatcher *dispatcher;
GList *channels;
@@ -881,9 +877,10 @@ mcd_dispatcher_context_check_client_locks (McdDispatcherContext *context)
_mcd_dispatch_operation_is_approved (context->operation))
{
/* no observers etc. left */
- if (!context->channels_handled)
+ if (!_mcd_dispatch_operation_get_channels_handled (context->operation))
{
- context->channels_handled = TRUE;
+ _mcd_dispatch_operation_set_channels_handled (context->operation,
+ TRUE);
mcd_dispatcher_run_handlers (context);
}
}
@@ -1321,7 +1318,8 @@ on_operation_finished (McdDispatchOperation *operation,
{
DEBUG ("Nothing left to dispatch");
- context->channels_handled = TRUE;
+ _mcd_dispatch_operation_set_channels_handled (context->operation,
+ TRUE);
}
else if (_mcd_dispatch_operation_is_claimed (operation))
{
@@ -1338,8 +1336,10 @@ on_operation_finished (McdDispatchOperation *operation,
channel, _mcd_dispatch_operation_get_claimer (operation));
}
- g_assert (!context->channels_handled);
- context->channels_handled = TRUE;
+ g_assert (!_mcd_dispatch_operation_get_channels_handled
+ (context->operation));
+ _mcd_dispatch_operation_set_channels_handled (context->operation,
+ TRUE);
}
if (_mcd_dispatch_operation_is_awaiting_approval (context->operation))
--
1.5.6.5
More information about the telepathy-commits
mailing list