aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-01-10 00:15:43 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-01-10 00:15:43 +0800
commit50cad5e06347b2fa49d6718034bcdb552d43b4d3 (patch)
tree286d079352da13fa8e393d905ffe30d870c8b698 /libempathy
parent94255bf43b3fb2dd2684c87b18dbf8448f72d8fb (diff)
downloadgsoc2013-empathy-50cad5e06347b2fa49d6718034bcdb552d43b4d3.tar
gsoc2013-empathy-50cad5e06347b2fa49d6718034bcdb552d43b4d3.tar.gz
gsoc2013-empathy-50cad5e06347b2fa49d6718034bcdb552d43b4d3.tar.bz2
gsoc2013-empathy-50cad5e06347b2fa49d6718034bcdb552d43b4d3.tar.lz
gsoc2013-empathy-50cad5e06347b2fa49d6718034bcdb552d43b4d3.tar.xz
gsoc2013-empathy-50cad5e06347b2fa49d6718034bcdb552d43b4d3.tar.zst
gsoc2013-empathy-50cad5e06347b2fa49d6718034bcdb552d43b4d3.zip
Port to the new empathy_call_when_ready api
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> svn path=/trunk/; revision=2193
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-dispatcher.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c
index bde8b6a1a..a0d5fbc3d 100644
--- a/libempathy/empathy-dispatcher.c
+++ b/libempathy/empathy-dispatcher.c
@@ -903,6 +903,22 @@ empathy_dispatcher_dup_singleton (void)
}
static void
+dispatcher_request_failed (EmpathyDispatcher *dispatcher,
+ DispatcherRequestData *request_data, const GError *error)
+{
+ EmpathyDispatcherPriv *priv = GET_PRIV (dispatcher);
+ ConnectionData *conn_data;
+
+ conn_data = g_hash_table_lookup (priv->connections, request_data->connection);
+ if (request_data->cb != NULL)
+ request_data->cb (NULL, error, request_data->user_data);
+
+ conn_data->outstanding_requests =
+ g_list_remove (conn_data->outstanding_requests, request_data);
+ free_dispatcher_request_data (request_data);
+}
+
+static void
dispatcher_connection_new_requested_channel (EmpathyDispatcher *dispatcher,
DispatcherRequestData *request_data, const gchar *object_path,
GHashTable *properties, const GError *error)
@@ -918,12 +934,7 @@ dispatcher_connection_new_requested_channel (EmpathyDispatcher *dispatcher,
{
DEBUG ("Channel request failed: %s", error->message);
- if (request_data->cb != NULL)
- request_data->cb (NULL, error, request_data->user_data);
-
- conn_data->outstanding_requests =
- g_list_remove (conn_data->outstanding_requests, request_data);
- free_dispatcher_request_data (request_data);
+ dispatcher_request_failed (dispatcher, request_data, error);
goto out;
}
@@ -1043,7 +1054,8 @@ empathy_dispatcher_call_with_contact ( EmpathyContact *contact,
static void
-dispatcher_chat_with_contact_cb (EmpathyContact *contact, gpointer user_data)
+dispatcher_chat_with_contact_cb (EmpathyContact *contact,
+ const GError *error, gpointer user_data, GObject *object)
{
DispatcherRequestData *request_data = (DispatcherRequestData *) user_data;
@@ -1080,7 +1092,7 @@ empathy_dispatcher_chat_with_contact (EmpathyContact *contact,
empathy_contact_call_when_ready (contact,
EMPATHY_CONTACT_READY_HANDLE, dispatcher_chat_with_contact_cb,
- request_data);
+ request_data, NULL, G_OBJECT (dispatcher));
g_object_unref (dispatcher);
}
@@ -1184,13 +1196,20 @@ dispatcher_create_channel_cb (TpConnection *connect,
static void
dispatcher_create_channel_with_contact_cb (EmpathyContact *contact,
- gpointer user_data)
+ const GError *error, gpointer user_data, GObject *object)
{
DispatcherRequestData *request_data = (DispatcherRequestData *) user_data;
GValue *target_handle;
g_assert (request_data->request);
+ if (error != NULL)
+ {
+ dispatcher_request_failed (request_data->dispatcher,
+ request_data, error);
+ return;
+ }
+
request_data->handle = empathy_contact_get_handle (contact);
target_handle = tp_g_value_slice_new (G_TYPE_UINT);
@@ -1265,7 +1284,7 @@ empathy_dispatcher_send_file_to_contact (EmpathyContact *contact,
empathy_contact_call_when_ready (contact,
EMPATHY_CONTACT_READY_HANDLE, dispatcher_create_channel_with_contact_cb,
- request_data);
+ request_data, NULL, G_OBJECT (dispatcher));
g_object_unref (dispatcher);
}