[empathy] empathy-chat-window: update the tab icon when the TpChat is disconnected (#597680)



commit 7d2255306d8c07e760917b1e8a4351c78ee302ed
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Sun Oct 11 21:47:09 2009 +0100

    empathy-chat-window: update the tab icon when the TpChat is disconnected (#597680)

 src/empathy-chat-window.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 3c2b981..f07d251 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -437,7 +437,11 @@ chat_window_update_chat_tab (EmpathyChat *chat)
 		name, empathy_account_get_unique_name (account), subject, remote_contact);
 
 	/* Update tab image */
-	if (g_list_find (priv->chats_new_msg, chat)) {
+	if (empathy_chat_get_tp_chat (chat) == NULL) {
+		/* No TpChat, we are disconnected */
+		icon_name = EMPATHY_IMAGE_OFFLINE;
+	}
+	else if (g_list_find (priv->chats_new_msg, chat)) {
 		icon_name = EMPATHY_IMAGE_MESSAGE;
 	}
 	else if (g_list_find (priv->chats_composing, chat)) {
@@ -1170,6 +1174,9 @@ chat_window_page_added_cb (GtkNotebook      *notebook,
 	g_signal_connect (chat, "new-message",
 			  G_CALLBACK (chat_window_new_message_cb),
 			  window);
+	g_signal_connect (chat, "notify::tp-chat",
+			  G_CALLBACK (chat_window_update_chat_tab),
+			  window);
 
 	/* Set flag so we know to perform some special operations on
 	 * switch page due to the new page being added.
@@ -1214,6 +1221,9 @@ chat_window_page_removed_cb (GtkNotebook      *notebook,
 	g_signal_handlers_disconnect_by_func (chat,
 					      G_CALLBACK (chat_window_new_message_cb),
 					      window);
+	g_signal_handlers_disconnect_by_func (chat,
+					      G_CALLBACK (chat_window_update_chat_tab),
+					      window);
 
 	/* Keep list of chats up to date */
 	priv->chats = g_list_remove (priv->chats, chat);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]