[empathy: 4/7] [chat-window] add a spinner to the window tab for when messages are being sent



commit 3e22736f0211a0bb668218243bc4764435f62a58
Author: Danielle Madeley <danielle madeley collabora co uk>
Date:   Thu Apr 28 15:28:35 2011 +1000

    [chat-window] add a spinner to the window tab for when messages are being sent

 src/empathy-chat-window.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index ac97601..1012e4e 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -314,6 +314,15 @@ chat_window_create_label (EmpathyChatWindow *window,
 
 	if (is_tab_label) {
 		GtkWidget            *close_button;
+		GtkWidget *sending_spinner;
+
+		sending_spinner = gtk_spinner_new ();
+
+		gtk_box_pack_start (GTK_BOX (hbox), sending_spinner,
+			FALSE, FALSE, 0);
+		g_object_set_data (G_OBJECT (chat),
+			"chat-window-tab-sending-spinner",
+			sending_spinner);
 
 		close_button = gedit_close_button_new ();
 		g_object_set_data (G_OBJECT (chat), "chat-window-tab-close-button", close_button);
@@ -652,6 +661,8 @@ chat_window_update_chat_tab_full (EmpathyChat *chat,
 	const gchar           *icon_name;
 	GtkWidget             *tab_image;
 	GtkWidget             *menu_image;
+	GtkWidget             *sending_spinner;
+	guint                  nb_sending;
 
 	window = chat_window_find_chat (chat);
 	if (!window) {
@@ -700,6 +711,16 @@ chat_window_update_chat_tab_full (EmpathyChat *chat,
 		gtk_widget_hide (menu_image);
 	}
 
+	/* Update the sending spinner */
+	nb_sending = empathy_chat_get_n_messages_sending (chat);
+	sending_spinner = g_object_get_data (G_OBJECT (chat),
+		"chat-window-tab-sending-spinner");
+
+	g_object_set (sending_spinner,
+		"active", nb_sending > 0,
+		"visible", nb_sending > 0,
+		NULL);
+
 	/* Update tab tooltip */
 	tooltip = g_string_new (NULL);
 
@@ -719,6 +740,15 @@ chat_window_update_chat_tab_full (EmpathyChat *chat,
 			      id,
 			      tp_account_get_display_name (account));
 
+	if (nb_sending > 0) {
+		append_markup_printf (tooltip, "\n");
+		append_markup_printf (tooltip,
+				      ngettext ("Sending %d message",
+					        "Sending %d messages",
+						nb_sending),
+				      nb_sending);
+	}
+
 	if (!EMP_STR_EMPTY (status)) {
 		append_markup_printf (tooltip, "\n<i>%s</i>", status);
 	}
@@ -2251,6 +2281,9 @@ empathy_chat_window_add_chat (EmpathyChatWindow *window,
 	g_signal_connect (chat, "notify::sms-channel",
 			  G_CALLBACK (chat_window_chat_notify_cb),
 			  NULL);
+	g_signal_connect (chat, "notify::n-messages-sending",
+			  G_CALLBACK (chat_window_chat_notify_cb),
+			  NULL);
 	chat_window_chat_notify_cb (chat);
 
 	gtk_notebook_append_page_menu (GTK_NOTEBOOK (priv->notebook), child, label, popup_label);



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