From f0308684e7442e55a88fe5588161daa5faafc365 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Tue, 3 Mar 2009 23:25:34 +0100 Subject: Port EmpathyChatWindow's DnD to new API --- src/empathy-chat-window.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index a6ca638b8..0738f6e52 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -1160,17 +1161,33 @@ chat_window_drag_data_received (GtkWidget *widget, McAccount *account; const gchar *id; gchar **strv; + const gchar *account_id; + const gchar *contact_id; id = (const gchar*) selection->data; DEBUG ("DND contact from roster with id:'%s'", id); strv = g_strsplit (id, "/", 2); - account = mc_account_lookup (strv[0]); - chat = empathy_chat_window_find_chat (account, strv[1]); + account_id = strv[0]; + contact_id = strv[1]; + account = mc_account_lookup (account_id); + chat = empathy_chat_window_find_chat (account, contact_id); if (!chat) { - empathy_dispatcher_chat_with_contact_id (account, strv[2], NULL, NULL); + EmpathyAccountManager *account_manager; + TpConnection *connection; + + account_manager = empathy_account_manager_dup_singleton (); + connection = empathy_account_manager_get_connection ( + account_manager, account); + + if (connection) { + empathy_dispatcher_chat_with_contact_id ( + connection, contact_id, NULL, NULL); + } + + g_object_unref (account_manager); g_object_unref (account); g_strfreev (strv); return; -- cgit v1.2.3