diff options
author | Alberto Mardegan <alberto.mardegan@nokia.com> | 2009-01-26 12:45:04 +0200 |
---|---|---|
committer | Alberto Mardegan <alberto.mardegan@nokia.com> | 2009-01-26 12:45:04 +0200 |
commit | 018fbb8f86835fd023152769785683c93202d60f (patch) | |
tree | 95d2fa2748d6b7c3e98c92ebf1e08c1e3aa4a3e1 | |
parent | dd417f04f9ef6b5dd1b6f2df0d5513df88db2985 (diff) |
Rewrite mcd_dispatcher_get_channel_type_usage()
Reimplement without using the "channels" list.
-rw-r--r-- | src/mcd-dispatcher.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c index 318b9a7c..3b01f7df 100644 --- a/src/mcd-dispatcher.c +++ b/src/mcd-dispatcher.c @@ -594,17 +594,36 @@ gint mcd_dispatcher_get_channel_type_usage (McdDispatcher * dispatcher, GQuark chan_type_quark) { - GList *node; + const GList *managers, *connections, *channels; McdDispatcherPrivate *priv = dispatcher->priv; gint usage_counter = 0; - - node = priv->channels; - while (node) + + managers = mcd_operation_get_missions (MCD_OPERATION (priv->master)); + while (managers) { - McdChannel *chan = (McdChannel*) node->data; - if (chan && chan_type_quark == mcd_channel_get_channel_type_quark (chan)) - usage_counter++; - node = node->next; + connections = + mcd_operation_get_missions (MCD_OPERATION (managers->data)); + while (connections) + { + channels = + mcd_operation_get_missions (MCD_OPERATION (connections->data)); + while (channels) + { + McdChannel *channel = MCD_CHANNEL (channels->data); + McdChannelStatus status; + + status = mcd_channel_get_status (channel); + if ((status == MCD_CHANNEL_STATUS_DISPATCHING || + status == MCD_CHANNEL_STATUS_HANDLER_INVOKED || + status == MCD_CHANNEL_STATUS_DISPATCHED) && + mcd_channel_get_channel_type_quark (channel) == + chan_type_quark) + usage_counter++; + channels = channels->next; + } + connections = connections->next; + } + managers = managers->next; } return usage_counter; |