telepathy-mission-control: _mcd_dispatch_operation_new: only take one channel

Simon McVittie smcv at kemper.freedesktop.org
Tue Jul 31 03:41:20 PDT 2012


Module: telepathy-mission-control
Branch: master
Commit: 60ee7341921191f2de4ec587eb098fe55488a869
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=60ee7341921191f2de4ec587eb098fe55488a869

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Fri Jul 20 13:27:19 2012 +0100

_mcd_dispatch_operation_new: only take one channel

https://bugs.freedesktop.org/show_bug.cgi?id=52305

---

 src/mcd-dispatch-operation-priv.h |    7 +++++--
 src/mcd-dispatch-operation.c      |   12 +++++-------
 src/mcd-dispatcher.c              |    5 +----
 3 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/src/mcd-dispatch-operation-priv.h b/src/mcd-dispatch-operation-priv.h
index a861171..ce168fc 100644
--- a/src/mcd-dispatch-operation-priv.h
+++ b/src/mcd-dispatch-operation-priv.h
@@ -69,8 +69,11 @@ G_GNUC_INTERNAL void _mcd_dispatch_operation_approve
 #define MCD_DISPATCH_OPERATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MCD_TYPE_DISPATCH_OPERATION, McdDispatchOperationClass))
 
 G_GNUC_INTERNAL McdDispatchOperation *_mcd_dispatch_operation_new (
-    McdClientRegistry *client_registry, McdHandlerMap *handler_map,
-    gboolean needs_approval, gboolean observe_only, GList *channels,
+    McdClientRegistry *client_registry,
+    McdHandlerMap *handler_map,
+    gboolean needs_approval,
+    gboolean observe_only,
+    McdChannel *channel,
     const gchar * const *possible_handlers);
 
 G_GNUC_INTERNAL gboolean _mcd_dispatch_operation_has_channel (
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index d18f3cc..39a77f8 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -1424,8 +1424,8 @@ _mcd_dispatch_operation_init (McdDispatchOperation *operation)
  * _mcd_dispatch_operation_new:
  * @client_registry: the client registry.
  * @handler_map: the handler map
- * @channels: a #GList of #McdChannel elements to dispatch.
- * @possible_handlers: the bus names of possible handlers for these channels.
+ * @channel: the channel to dispatch
+ * @possible_handlers: the bus names of possible handlers for this channel
  *
  * Creates a #McdDispatchOperation.
  */
@@ -1434,7 +1434,7 @@ _mcd_dispatch_operation_new (McdClientRegistry *client_registry,
                              McdHandlerMap *handler_map,
                              gboolean needs_approval,
                              gboolean observe_only,
-                             GList *channels,
+                             McdChannel *channel,
                              const gchar * const *possible_handlers)
 {
     gpointer *obj;
@@ -1443,14 +1443,12 @@ _mcd_dispatch_operation_new (McdClientRegistry *client_registry,
      * back", so they can't need approval (i.e. observe_only implies
      * !needs_approval) */
     g_return_val_if_fail (!observe_only || !needs_approval, NULL);
-    /* exactly one channel */
-    g_return_val_if_fail (channels != NULL, NULL);
-    g_return_val_if_fail (channels->next == NULL, NULL);
+    g_return_val_if_fail (MCD_IS_CHANNEL (channel), NULL);
 
     obj = g_object_new (MCD_TYPE_DISPATCH_OPERATION,
                         "client-registry", client_registry,
                         "handler-map", handler_map,
-                        "channel", channels->data,
+                        "channel", channel,
                         "possible-handlers", possible_handlers,
                         "needs-approval", needs_approval,
                         "observe-only", observe_only,
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index ce3292d..c7f3c7a 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -246,7 +246,6 @@ _mcd_dispatcher_enter_state_machine (McdDispatcher *dispatcher,
     McdDispatchOperation *operation;
     McdDispatcherPrivate *priv;
     McdAccount *account;
-    GList *channels;
 
     g_return_if_fail (MCD_IS_DISPATCHER (dispatcher));
     g_return_if_fail (MCD_IS_CHANNEL (channel));
@@ -266,11 +265,9 @@ _mcd_dispatcher_enter_state_machine (McdDispatcher *dispatcher,
            channel,
            mcd_channel_get_object_path (channel));
 
-    channels = g_list_prepend (NULL, channel);
     operation = _mcd_dispatch_operation_new (priv->clients,
-        priv->handler_map, !requested, only_observe, channels,
+        priv->handler_map, !requested, only_observe, channel,
         (const gchar * const *) possible_handlers);
-    g_list_free (channels);
 
     if (!requested)
     {



More information about the telepathy-commits mailing list