changeset 12208:ddcd92a32eeb

[gaim-migrate @ 14510] Make the unread message thing in the buddy list respond to deleting conversations, and add a safety check to avoid trying to display a NULL conversation. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Thu, 24 Nov 2005 12:50:49 +0000
parents 201be1b681a4
children 8f8087bc9732
files src/gtkblist.c
diffstat 1 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkblist.c	Thu Nov 24 02:18:05 2005 +0000
+++ b/src/gtkblist.c	Thu Nov 24 12:50:49 2005 +0000
@@ -3148,10 +3148,13 @@
 static gboolean
 menutray_press_cb(GtkWidget *widget, GdkEventButton *event)
 {
+	GaimConversation *conv;
+
 	switch (event->button) {
 		case 1:
-			gaim_gtkconv_present_conversation(gaim_gtk_conversations_get_first_unseen(
-					GAIM_CONV_TYPE_IM, GAIM_UNSEEN_TEXT));
+			conv = gaim_gtk_conversations_get_first_unseen(GAIM_CONV_TYPE_IM, GAIM_UNSEEN_TEXT);
+			if (conv != NULL)
+				gaim_gtkconv_present_conversation(conv);
 			break;
 		case 3:
 			unseen_conv_menu();
@@ -3183,7 +3186,8 @@
 
 			if (gtkconv->unseen_state >= GAIM_UNSEEN_TEXT) {
 				g_string_append_printf(tooltip_text,
-						_("%d unread message(s) from %s\n"), gtkconv->unseen_count,
+						ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count),
+						gtkconv->unseen_count,
 						gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)));
 			}
 			convs = convs->next;
@@ -3202,6 +3206,12 @@
 	}
 }
 
+static void
+conversation_deleting_cb(GaimConversation *conv, GaimGtkBuddyList *gtkblist)
+{
+	conversation_updated_cb(conv, GAIM_CONV_UPDATE_UNSEEN, gtkblist);
+}
+
 /**********************************************************************************
  * Public API Functions                                                           *
  **********************************************************************************/
@@ -3627,6 +3637,9 @@
 	gaim_signal_connect(gaim_conversations_get_handle(), "conversation-updated",
 						gtkblist, GAIM_CALLBACK(conversation_updated_cb),
 						gtkblist);
+	gaim_signal_connect(gaim_conversations_get_handle(), "deleting-conversation",
+						gtkblist, GAIM_CALLBACK(conversation_deleting_cb),
+						gtkblist);
 
 	/* emit our created signal */
 	gaim_signal_emit(handle, "gtkblist-created", list);