changeset 12239:36d3b1eaf20e

[gaim-migrate @ 14541] this makes more sense to me committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 27 Nov 2005 19:45:29 +0000
parents 40f6334bb424
children 1c0fd404e07e
files src/gtkblist.c src/gtkconv.c src/gtkconv.h
diffstat 3 files changed, 24 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkblist.c	Sun Nov 27 18:46:14 2005 +0000
+++ b/src/gtkblist.c	Sun Nov 27 19:45:29 2005 +0000
@@ -3194,16 +3194,19 @@
 		GList *convs = gaim_get_ims();
 		tooltip_text = g_string_new("");
 		while (convs) {
-			GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION((GaimConversation *)convs->data);
-
-			if (gtkconv->unseen_state >= GAIM_UNSEEN_TEXT) {
-				g_string_append_printf(tooltip_text,
-						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)));
+			if(GAIM_IS_GTK_CONVERSATION(convs->data)) {
+				GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION((GaimConversation *)convs->data);
+
+				if (gtkconv->unseen_state >= GAIM_UNSEEN_TEXT && gaim_gtkconv_is_hidden(gtkconv)) {
+					g_string_append_printf(tooltip_text,
+							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;
 		}
+		if(tooltip_text->len > 0) {
 		/* get rid of the last newline */
 		tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len -1);
 		img = gtk_image_new_from_stock(GAIM_STOCK_PENDING, GTK_ICON_SIZE_MENU);
@@ -3214,7 +3217,9 @@
 		gtk_widget_show(gtkblist->menutrayicon);
 		g_signal_connect(G_OBJECT(gtkblist->menutrayicon), "button-press-event", G_CALLBACK(menutray_press_cb), NULL);
 
-		gaim_gtk_menu_tray_append(GAIM_GTK_MENU_TRAY(gtkblist->menutray), gtkblist->menutrayicon, g_string_free(tooltip_text, FALSE));
+		gaim_gtk_menu_tray_append(GAIM_GTK_MENU_TRAY(gtkblist->menutray), gtkblist->menutrayicon, tooltip_text->str);
+		}
+		g_string_free(tooltip_text, FALSE);
 	}
 }
 
--- a/src/gtkconv.c	Sun Nov 27 18:46:14 2005 +0000
+++ b/src/gtkconv.c	Sun Nov 27 19:45:29 2005 +0000
@@ -2448,7 +2448,7 @@
 		GaimConversation *conv = (GaimConversation*)l->data;
 		GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv);
 
-		if (gtkconv->unseen_state >= min_state) {
+		if (gtkconv->unseen_state >= min_state && gtkconv->win == hidden_convwin) {
 			GtkWidget *icon = gtk_image_new();
 			GdkPixbuf *pbuf = gaim_gtkconv_get_tab_icon(conv, TRUE);
 			GtkWidget *item;
@@ -5698,7 +5698,7 @@
 
 		if(gaim_status_type_get_primitive(
 					gaim_status_get_type(gaim_account_get_active_status(
-					gaim_conversation_get_account(conv)))) == GAIM_STATUS_AWAY)
+							gaim_conversation_get_account(conv)))) == GAIM_STATUS_AWAY)
 			continue;
 
 		private_remove_gtkconv(hidden_convwin, gtkconv, FALSE);
@@ -7437,3 +7437,11 @@
 	else
 		conv_placement_new_window(gtkconv);
 }
+
+gboolean
+gaim_gtkconv_is_hidden(GaimGtkConversation *gtkconv)
+{
+	g_return_val_if_fail(gtkconv != NULL, FALSE);
+
+	return (gtkconv->win == hidden_convwin);
+}
--- a/src/gtkconv.h	Sun Nov 27 18:46:14 2005 +0000
+++ b/src/gtkconv.h	Sun Nov 27 19:45:29 2005 +0000
@@ -237,6 +237,7 @@
 GdkPixbuf *gaim_gtkconv_get_tab_icon(GaimConversation *conv, gboolean small_icon);
 void gaim_gtkconv_new(GaimConversation *conv);
 int gaim_gtkconv_get_tab_at_xy(GaimGtkWindow *win, int x, int y, gboolean *to_right);
+gboolean gaim_gtkconv_is_hidden(GaimGtkConversation *gtkconv);
 /*@}*/
 
 /**************************************************************************/