# HG changeset patch # User Sean Egan # Date 1134796425 0 # Node ID e63a80be5227f927f0e3f1412ce7ba9c8bfdb731 # Parent 81c2d63f17334252ad1ef456d8a19c940a855a1d [gaim-migrate @ 14831] better (?) tooltips committer: Tailor Script diff -r 81c2d63f1733 -r e63a80be5227 NEWS --- a/NEWS Sat Dec 17 05:04:08 2005 +0000 +++ b/NEWS Sat Dec 17 05:13:45 2005 +0000 @@ -1,6 +1,11 @@ -=[ Gaim ]=- The Pimpin' Penguin IM Client That's Good For The Soul! 2.0.0beta1 (12/16/2005): + Sean: I think Nathan sums everything up really well below. There's still + a bunch we want to add (and remove) before the official release, but we + really want to start getting feedback about what's good and what's not. + So, please, be vocal about this beta! + Nathan: 15 months since we branched oldstatus, and started working on the behemoth that is 2.0.0. In that time, we've added a couple new protocols, we had a few crazy patch writers become developers, and diff -r 81c2d63f1733 -r e63a80be5227 src/blist.h --- a/src/blist.h Sat Dec 17 05:04:08 2005 +0000 +++ b/src/blist.h Sat Dec 17 05:13:45 2005 +0000 @@ -71,6 +71,9 @@ #define GAIM_BLIST_NODE_HAS_FLAG(b, f) ((b)->flags & (f)) #define GAIM_BLIST_NODE_SHOULD_SAVE(b) (! GAIM_BLIST_NODE_HAS_FLAG(b, GAIM_BLIST_NODE_FLAG_NO_SAVE)) +#define GAIM_BLIST_NODE_NAME(n) ((n)->type == GAIM_BLIST_CHAT_NODE ? gaim_chat_get_name((GaimChat*)n) : \ + (n)->type == GAIM_BLIST_BUDDY_NODE ? gaim_buddy_get_name((GaimBuddy*)n) : NULL) + #include "account.h" #include "buddyicon.h" #include "status.h" diff -r 81c2d63f1733 -r e63a80be5227 src/gtkblist.c --- a/src/gtkblist.c Sat Dec 17 05:04:08 2005 +0000 +++ b/src/gtkblist.c Sat Dec 17 05:13:45 2005 +0000 @@ -2064,19 +2064,26 @@ PangoLayout *layout; GdkPixbuf *status_icon; GdkPixbuf *avatar; + GaimStatusIconSize size; int avatar_width; int width; int height; }; -static struct tooltip_data * create_tip_for_node(GaimBlistNode *node) +static struct tooltip_data * create_tip_for_node(GaimBlistNode *node, GaimStatusIconSize size) { + char *tooltip_text = NULL; struct tooltip_data *td = g_new0(struct tooltip_data, 1); - char *tooltip_text = gaim_get_tooltip_text(node); - - td->status_icon = gaim_gtk_blist_get_status_icon(node, GAIM_STATUS_ICON_LARGE); - td->avatar = gaim_gtk_blist_get_buddy_icon(node, FALSE, FALSE); - + + td->status_icon = gaim_gtk_blist_get_status_icon(node, size); + if (size == GAIM_STATUS_ICON_LARGE) { + td->avatar = gaim_gtk_blist_get_buddy_icon(node, FALSE, FALSE); + tooltip_text = gaim_get_tooltip_text(node); + } else if (size == GAIM_STATUS_ICON_SMALL) { + td->avatar = NULL; + tooltip_text = g_strdup_printf("%s", GAIM_BLIST_NODE_NAME(node)); + } + td->size = size; td->layout = gtk_widget_create_pango_layout(gtkblist->tipwindow, NULL); pango_layout_set_markup(td->layout, tooltip_text, strlen(tooltip_text)); pango_layout_set_wrap(td->layout, PANGO_WRAP_WORD); @@ -2084,7 +2091,10 @@ pango_layout_get_size (td->layout, &td->width, &td->height); td->width = PANGO_PIXELS(td->width) + 38 + 8; - td->height = MAX(PANGO_PIXELS(td->height) + 8, 38); + if (size == GAIM_STATUS_ICON_SMALL) + td->height = MAX(PANGO_PIXELS(td->height)+ 4 , 8); + else + td->height = MAX(PANGO_PIXELS(td->height + 4), 38); if(td->avatar) { td->avatar_width = gdk_pixbuf_get_width(td->avatar); @@ -2115,33 +2125,31 @@ max_width = MAX(max_width, td->width); } - current_height = 0; + current_height = 4; for(l = gtkblist->tooltipdata; l; l = l->next) { struct tooltip_data *td = l->data; #if GTK_CHECK_VERSION(2,2,0) gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->status_icon, - 0, 0, 4, current_height + 4, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0); + 0, 0, td->size == GAIM_STATUS_ICON_LARGE ? 4 : 19, current_height, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0); if(td->avatar) gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, - td->avatar, 0, 0, max_width - (td->avatar_width + 4), current_height + 4, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0); + td->avatar, 0, 0, max_width - (td->avatar_width + 4), current_height, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0); #else - gdk_pixbuf_render_to_drawable(td->status_icon, GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, 0, 0, 4, current_height + 4, -1, -1, GDK_RGB_DITHER_NONE, 0, 0); + gdk_pixbuf_render_to_drawable(td->status_icon, GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, 0, 0, 4, current_height, -1, -1, GDK_RGB_DITHER_NONE, 0, 0); if(td->avatar) gdk_pixbuf_render_to_drawable(td->avatar, GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, 0, 0, - max_width - (td->avatar_width + 4), - current_height + 4, -1, -1, GDK_RGB_DITHER_NONE, 0, 0); + max_width - (td->avatar_width + 4) + (td->size == GAIM_STATUS_ICON_LARGE ? 15 : 0), + current_height, -1, -1, GDK_RGB_DITHER_NONE, 0, 0); #endif gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE, - NULL, gtkblist->tipwindow, "tooltip", 38 + 4, current_height + 4, td->layout); + NULL, gtkblist->tipwindow, "tooltip", 38 + 4, current_height, td->layout); current_height += td->height; - if(l->next) - gtk_paint_hline(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, NULL, NULL, NULL, 4, max_width - 4, current_height-2); } } @@ -2255,18 +2263,19 @@ gtkblist->tipwindow = gtk_window_new(GTK_WINDOW_POPUP); if(GAIM_BLIST_NODE_IS_CHAT(node) || GAIM_BLIST_NODE_IS_BUDDY(node)) { - struct tooltip_data *td = create_tip_for_node(node); + struct tooltip_data *td = create_tip_for_node(node, GAIM_STATUS_ICON_LARGE); gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td); w = td->width; h = td->height; } else if(GAIM_BLIST_NODE_IS_CONTACT(node)) { GaimBlistNode *child; + int count; GaimBuddy *b = gaim_contact_get_priority_buddy((GaimContact *)node); w = h = 0; - for(child = node->child; child; child = child->next) + for(child = node->child, count = 0; child; child = child->next, count++) { if(GAIM_BLIST_NODE_IS_BUDDY(child) && buddy_is_displayable((GaimBuddy*)child)) { - struct tooltip_data *td = create_tip_for_node(child); + struct tooltip_data *td = create_tip_for_node(child, b == (GaimBuddy*)child ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL); if (b == (GaimBuddy *)child) { gtkblist->tooltipdata = g_list_prepend(gtkblist->tooltipdata, td); } else { @@ -2276,6 +2285,7 @@ h += td->height; } } + h += 8; } else { gtk_widget_destroy(gtkblist->tipwindow); gtkblist->tipwindow = NULL;