From 6eee3479f40b71b0345d30a2ff1e4879aa9eb557 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Mon, 13 Apr 2009 08:21:26 +0000 Subject: Let the chat dialog directly grab the channel on reconnect When reconnecting open chat dialogs requests a new channel. It can grab this directly when it is opened, no need to go through the dispatcher. Fixes issue with stealing focus From: Sjoerd Simons svn path=/trunk/; revision=2814 --- libempathy-gtk/empathy-chat.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'libempathy-gtk/empathy-chat.c') diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 5f54c12eb..99d4d4c09 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -167,6 +167,28 @@ chat_set_property (GObject *object, }; } +static void +chat_connect_channel_reconnected (EmpathyDispatchOperation *dispatch, + const GError *error, + gpointer user_data) +{ + EmpathyChat *chat = EMPATHY_CHAT (user_data); + EmpathyTpChat *tpchat; + + if (error != NULL) { + empathy_chat_view_append_event (chat->view, + _("Failed to reconnect this chat")); + return; + } + + tpchat = EMPATHY_TP_CHAT ( + empathy_dispatch_operation_get_channel_wrapper (dispatch)); + + if (empathy_dispatch_operation_claim (dispatch)) { + empathy_chat_set_tp_chat (chat, tpchat); + } +} + static void chat_connection_changed_cb (EmpathyAccountManager *manager, McAccount *account, @@ -187,10 +209,13 @@ chat_connection_changed_cb (EmpathyAccountManager *manager, switch (priv->handle_type) { case TP_HANDLE_TYPE_CONTACT: empathy_dispatcher_chat_with_contact_id (account, priv->id, - NULL, NULL); + chat_connect_channel_reconnected, + chat); break; case TP_HANDLE_TYPE_ROOM: - empathy_dispatcher_join_muc (account, priv->id, NULL, NULL); + empathy_dispatcher_join_muc (account, priv->id, + chat_connect_channel_reconnected, + chat); break; default: g_assert_not_reached (); -- cgit v1.2.3