[telepathy-mission-control/master] _mcd_client_proxy_handle_channels: automatically extract user_action_time from any channels that are really requests

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Oct 20 15:00:06 PDT 2009


---
 src/mcd-client-priv.h        |    3 +--
 src/mcd-client.c             |   14 ++++++++++++--
 src/mcd-dispatch-operation.c |   20 ++------------------
 src/mcd-dispatcher.c         |   13 -------------
 4 files changed, 15 insertions(+), 35 deletions(-)

diff --git a/src/mcd-client-priv.h b/src/mcd-client-priv.h
index 6f0702d..d19f164 100644
--- a/src/mcd-client-priv.h
+++ b/src/mcd-client-priv.h
@@ -114,8 +114,7 @@ G_GNUC_INTERNAL guint _mcd_client_match_filters (
     gboolean assume_requested);
 
 G_GNUC_INTERNAL void _mcd_client_proxy_handle_channels (McdClientProxy *self,
-    gint timeout_ms, const gchar *account_path,
-    const GList *channels, const GPtrArray *requests_satisfied,
+    gint timeout_ms, const gchar *account_path, const GList *channels,
     gint64 user_action_time, GHashTable *handler_info,
     tp_cli_client_handler_callback_for_handle_channels callback,
     gpointer user_data, GDestroyNotify destroy, GObject *weak_object);
diff --git a/src/mcd-client.c b/src/mcd-client.c
index ca12e3d..cfecde6 100644
--- a/src/mcd-client.c
+++ b/src/mcd-client.c
@@ -1559,7 +1559,6 @@ _mcd_client_proxy_handle_channels (McdClientProxy *self,
     gint timeout_ms,
     const gchar *account_path,
     const GList *channels,
-    const GPtrArray *requests_satisfied,
     gint64 user_action_time,
     GHashTable *handler_info,
     tp_cli_client_handler_callback_for_handle_channels callback,
@@ -1568,18 +1567,28 @@ _mcd_client_proxy_handle_channels (McdClientProxy *self,
     GObject *weak_object)
 {
     GPtrArray *channel_details;
+    GPtrArray *requests_satisfied;
     const GList *iter;
 
     g_return_if_fail (MCD_IS_CLIENT_PROXY (self));
     g_return_if_fail (channels != NULL);
 
     channel_details = _mcd_channel_details_build_from_list (channels);
+    requests_satisfied = g_ptr_array_new ();
 
     for (iter = channels; iter != NULL; iter = iter->next)
     {
         gint64 req_time = 0;
+        const GList *requests;
 
-        _mcd_channel_get_satisfied_requests (iter->data, &req_time);
+        for (requests = _mcd_channel_get_satisfied_requests (iter->data,
+                                                             &req_time);
+             requests != NULL;
+             requests = requests->next)
+        {
+            /* list of borrowed object paths */
+            g_ptr_array_add (requests_satisfied, requests->data);
+        }
 
         if (req_time > user_action_time)
             user_action_time = req_time;
@@ -1592,4 +1601,5 @@ _mcd_client_proxy_handle_channels (McdClientProxy *self,
         callback, user_data, destroy, weak_object);
 
     _mcd_channel_details_free (channel_details);
+    g_ptr_array_free (requests_satisfied, TRUE);
 }
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index dba29af..47e7c83 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -1663,30 +1663,15 @@ static void
 mcd_dispatch_operation_handle_channels (McdDispatchOperation *self,
                                         McdClientProxy *handler)
 {
-    gint64 user_action_time;
     const gchar *account_path;
-    GPtrArray *satisfied_requests;
     GHashTable *handler_info;
     const GList *cl;
 
     account_path = _mcd_dispatch_operation_get_account_path (self);
 
-    user_action_time = self->priv->handle_with_time;
-    satisfied_requests = g_ptr_array_new ();
-
     for (cl = self->priv->channels; cl != NULL; cl = cl->next)
     {
-        McdChannel *channel = MCD_CHANNEL (cl->data);
-        const GList *requests;
-
-        requests = _mcd_channel_get_satisfied_requests (channel, NULL);
-        while (requests)
-        {
-            g_ptr_array_add (satisfied_requests, requests->data);
-            requests = requests->next;
-        }
-
-        _mcd_channel_set_status (channel,
+        _mcd_channel_set_status (cl->data,
                                  MCD_CHANNEL_STATUS_HANDLER_INVOKED);
     }
 
@@ -1696,11 +1681,10 @@ mcd_dispatch_operation_handle_channels (McdDispatchOperation *self,
            tp_proxy_get_bus_name (handler), self);
     _mcd_client_proxy_handle_channels (handler,
         -1, account_path,
-        self->priv->channels, satisfied_requests, user_action_time,
+        self->priv->channels, self->priv->handle_with_time,
         handler_info, _mcd_dispatch_operation_handle_channels_cb,
         g_object_ref (self), g_object_unref, NULL);
 
-    g_ptr_array_free (satisfied_requests, TRUE);
     g_hash_table_unref (handler_info);
 }
 
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 92768c0..dc1d058 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -1759,11 +1759,9 @@ _mcd_dispatcher_reinvoke_handler (McdDispatcher *dispatcher,
     GList *request_as_list;
     const gchar *handler_unique;
     GStrv possible_handlers;
-    GPtrArray *satisfied_requests;
     GHashTable *handler_info;
     McdAccount *account;
     const gchar *account_path;
-    const GList *requests;
     McdClientProxy *handler;
 
     request_as_list = g_list_append (NULL, request);
@@ -1817,27 +1815,16 @@ _mcd_dispatcher_reinvoke_handler (McdDispatcher *dispatcher,
     if (G_UNLIKELY (account_path == NULL))    /* can't happen? */
         account_path = "/";
 
-    satisfied_requests = g_ptr_array_new ();
-
-    for (requests = _mcd_channel_get_satisfied_requests (request, NULL);
-         requests != NULL;
-         requests = requests->next)
-    {
-        g_ptr_array_add (satisfied_requests, requests->data);
-    }
-
     handler_info = g_hash_table_new (g_str_hash, g_str_equal);
 
     _mcd_channel_set_status (request, MCD_CHANNEL_STATUS_HANDLER_INVOKED);
 
     _mcd_client_proxy_handle_channels (handler,
         -1, account_path, request_as_list,
-        satisfied_requests,
         0, /* the request's user action time will be used automatically */
         handler_info,
         reinvoke_handle_channels_cb, NULL, NULL, (GObject *) request);
 
-    g_ptr_array_free (satisfied_requests, TRUE);
     g_hash_table_unref (handler_info);
 
 finally:
-- 
1.5.6.5




More information about the telepathy-commits mailing list