[telepathy-mission-control/master] _mcd_client_proxy_handle_channels: require at least one channel, and recover the connection path from the first
Simon McVittie
simon.mcvittie at collabora.co.uk
Mon Nov 2 07:18:13 PST 2009
---
src/mcd-client-priv.h | 2 +-
src/mcd-client.c | 21 +++++++++++++++++++--
src/mcd-dispatch-operation.c | 5 ++---
src/mcd-dispatcher.c | 21 +--------------------
4 files changed, 23 insertions(+), 26 deletions(-)
diff --git a/src/mcd-client-priv.h b/src/mcd-client-priv.h
index d1acf22..e78dfbf 100644
--- a/src/mcd-client-priv.h
+++ b/src/mcd-client-priv.h
@@ -114,7 +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 gchar *connection_path,
+ gint timeout_ms, const gchar *account_path,
const GList *channels, const GPtrArray *requests_satisfied,
guint64 user_action_time, GHashTable *handler_info,
tp_cli_client_handler_callback_for_handle_channels callback,
diff --git a/src/mcd-client.c b/src/mcd-client.c
index 3b65b99..6e7bb78 100644
--- a/src/mcd-client.c
+++ b/src/mcd-client.c
@@ -1538,11 +1538,26 @@ _mcd_client_match_filters (GHashTable *channel_properties,
return best_quality;
}
+static const gchar *
+borrow_channel_connection_path (McdChannel *channel)
+{
+ TpChannel *tp_channel;
+ TpConnection *tp_connection;
+ const gchar *connection_path;
+
+ tp_channel = mcd_channel_get_tp_channel (channel);
+ g_return_val_if_fail (tp_channel != NULL, "/");
+ tp_connection = tp_channel_borrow_connection (tp_channel);
+ g_return_val_if_fail (tp_connection != NULL, "/");
+ connection_path = tp_proxy_get_object_path (tp_connection);
+ g_return_val_if_fail (connection_path != NULL, "/");
+ return connection_path;
+}
+
void
_mcd_client_proxy_handle_channels (McdClientProxy *self,
gint timeout_ms,
const gchar *account_path,
- const gchar *connection_path,
const GList *channels,
const GPtrArray *requests_satisfied,
guint64 user_action_time,
@@ -1555,11 +1570,13 @@ _mcd_client_proxy_handle_channels (McdClientProxy *self,
GPtrArray *channel_details;
g_return_if_fail (MCD_IS_CLIENT_PROXY (self));
+ g_return_if_fail (channels != NULL);
channel_details = _mcd_channel_details_build_from_list (channels);
tp_cli_client_handler_call_handle_channels ((TpClient *) self,
- timeout_ms, account_path, connection_path, channel_details,
+ timeout_ms, account_path,
+ borrow_channel_connection_path (channels->data), channel_details,
requests_satisfied, user_action_time, handler_info,
callback, user_data, destroy, weak_object);
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index 6a9711b..bab4fb8 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -1658,12 +1658,11 @@ mcd_dispatch_operation_handle_channels (McdDispatchOperation *self,
McdClientProxy *handler)
{
guint64 user_action_time;
- const gchar *account_path, *connection_path;
+ const gchar *account_path;
GPtrArray *satisfied_requests;
GHashTable *handler_info;
const GList *cl;
- connection_path = _mcd_dispatch_operation_get_connection_path (self);
account_path = _mcd_dispatch_operation_get_account_path (self);
user_action_time = 0; /* TODO: if we have a CDO, get it from there */
@@ -1696,7 +1695,7 @@ mcd_dispatch_operation_handle_channels (McdDispatchOperation *self,
DEBUG ("calling HandleChannels on %s for op %p",
tp_proxy_get_bus_name (handler), self);
_mcd_client_proxy_handle_channels (handler,
- -1, account_path, connection_path,
+ -1, account_path,
self->priv->channels, satisfied_requests, user_action_time,
handler_info, _mcd_dispatch_operation_handle_channels_cb,
g_object_ref (self), g_object_unref, NULL);
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 862426d..21b5cb4 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -452,22 +452,6 @@ mcd_dispatcher_dup_possible_handlers (McdDispatcher *self,
return ret;
}
-static const gchar *
-mcd_dispatcher_borrow_channel_connection_path (McdChannel *channel)
-{
- TpChannel *tp_channel;
- TpConnection *tp_connection;
- const gchar *connection_path;
-
- tp_channel = mcd_channel_get_tp_channel (channel);
- g_return_val_if_fail (tp_channel != NULL, "/");
- tp_connection = tp_channel_borrow_connection (tp_channel);
- g_return_val_if_fail (tp_connection != NULL, "/");
- connection_path = tp_proxy_get_object_path (tp_connection);
- g_return_val_if_fail (connection_path != NULL, "/");
- return connection_path;
-}
-
/*
* _mcd_dispatcher_context_abort:
*
@@ -1777,7 +1761,6 @@ _mcd_dispatcher_reinvoke_handler (McdDispatcher *dispatcher,
GStrv possible_handlers;
GPtrArray *satisfied_requests;
GHashTable *handler_info;
- const gchar *connection_path;
McdAccount *account;
const gchar *account_path;
const GList *requests;
@@ -1835,8 +1818,6 @@ _mcd_dispatcher_reinvoke_handler (McdDispatcher *dispatcher,
if (G_UNLIKELY (account_path == NULL)) /* can't happen? */
account_path = "/";
- connection_path = mcd_dispatcher_borrow_channel_connection_path (request);
-
satisfied_requests = g_ptr_array_new ();
for (requests = _mcd_channel_get_satisfied_requests (request);
@@ -1852,7 +1833,7 @@ _mcd_dispatcher_reinvoke_handler (McdDispatcher *dispatcher,
_mcd_channel_set_status (request, MCD_CHANNEL_STATUS_HANDLER_INVOKED);
_mcd_client_proxy_handle_channels (handler,
- -1, account_path, connection_path, request_as_list,
+ -1, account_path, request_as_list,
satisfied_requests, user_action_time, handler_info,
reinvoke_handle_channels_cb, NULL, NULL, (GObject *) request);
--
1.5.6.5
More information about the telepathy-commits
mailing list