changeset 15480:62a1ebd08b74

fix a weird tooltip rendering bug when the second buddy in a contact tooltip had an icon, but the first one didn't, and the name on the first one was longer than the name on the second one. Also, remove the now duplicated protocol icon from blist chats
author Nathan Walp <nwalp@pidgin.im>
date Thu, 01 Feb 2007 05:47:08 +0000
parents 5551adcf8f97
children 8e681a2fde77
files pidgin/gtkblist.c
diffstat 1 files changed, 12 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkblist.c	Thu Feb 01 00:37:13 2007 +0000
+++ b/pidgin/gtkblist.c	Thu Feb 01 05:47:08 2007 +0000
@@ -2108,21 +2108,6 @@
 				if (!(icon = gaim_buddy_icons_find(buddy->account, buddy->name))) /* Not sure I like this...*/
 					return NULL;
 			data = gaim_buddy_icon_get_data(icon, &len);
-		} else if(chat != NULL) {
-			if(prpl_info && prpl_info->list_icon) {
-				char *contents;
-				char *image = g_strdup_printf("%s.png", prpl_info->list_icon(account, NULL));
-				char *filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "status", "32", image, NULL);
-				g_free(image);
-
-				gaim_debug_info("icon", "Using %s as a buddy icon for a chat\n");
-
-				/* we'll exit below with data == NULL if this fails */
-				if(g_file_get_contents(filename, &contents, &len, NULL)) {
-					data = (const guchar*)contents;
-				}
-				g_free(filename);
-			}
 		}
 		custom = FALSE;  /* We are not using the custom icon */
 	}
@@ -2289,6 +2274,7 @@
 {
 	GtkStyle *style;
 	int current_height, max_width;
+	int max_text_width;
 	GList *l;
 	int prpl_col = 0;
 
@@ -2300,13 +2286,16 @@
 			NULL, gtkblist->tipwindow, "tooltip", 0, 0, -1, -1);
 
 	max_width = 0;
+	max_text_width = 0;
 	for(l = gtkblist->tooltipdata; l; l = l->next)
 	{
 		struct tooltip_data *td = l->data;
+		max_text_width = MAX(max_text_width,
+				MAX(td->width, td->name_width));
 		max_width = MAX(max_width,
 				TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE +
-				MAX(td->width, td->name_width) + SMALL_SPACE + td->avatar_width + TOOLTIP_BORDER);
-		prpl_col = MAX(prpl_col, 
+				max_text_width + SMALL_SPACE + td->avatar_width + TOOLTIP_BORDER);
+		prpl_col = MAX(prpl_col,
 				TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE + td->name_width - PRPL_SIZE);
 	}
 
@@ -2475,13 +2464,14 @@
 	if(GAIM_BLIST_NODE_IS_CHAT(node) || GAIM_BLIST_NODE_IS_BUDDY(node)) {
 		struct tooltip_data *td = create_tip_for_node(node, TRUE);
 		gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
-		w = TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE + 
+		w = TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE +
 			MAX(td->width, td->name_width) + SMALL_SPACE + td->avatar_width + TOOLTIP_BORDER;
 		h = TOOLTIP_BORDER + MAX(td->height + td->name_height, MAX(STATUS_SIZE, td->avatar_height))
 			+ TOOLTIP_BORDER;
 	} else if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
 		GaimBlistNode *child;
 		GaimBuddy *b = gaim_contact_get_priority_buddy((GaimContact *)node);
+		int tw = 0;
 		w = h = 0;
 		for(child = node->child; child; child = child->next)
 		{
@@ -2492,10 +2482,10 @@
 				} else {
 					gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
 				}
-				w = MAX(w, TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE + 
-					MAX(td->width, td->name_width) + SMALL_SPACE + 
-					td->avatar_width + TOOLTIP_BORDER);
-				h += MAX(TOOLTIP_BORDER + MAX(STATUS_SIZE,td->avatar_height) + TOOLTIP_BORDER, 
+				tw = MAX(tw, MAX(td->width, td->name_width));
+				w = MAX(w, TOOLTIP_BORDER + STATUS_SIZE + SMALL_SPACE +
+					tw + SMALL_SPACE + td->avatar_width + TOOLTIP_BORDER);
+				h += MAX(TOOLTIP_BORDER + MAX(STATUS_SIZE,td->avatar_height) + TOOLTIP_BORDER,
 					 TOOLTIP_BORDER + td->height + td->name_height + TOOLTIP_BORDER);
 			}
 		}