Mercurial > pidgin
diff src/gtkconv.c @ 13090:0aa231ebbfd5
[gaim-migrate @ 15452]
Changes to some pixbuf stuff.
I added a 'gaim_gtk_create_gaim_icon_with_status()' function to util.c,
and changed 'gaim_gtk_create_prpl_icon_with_status()' to accept a scale
factor because almost everywhere this function was used we would scale
the pixbuf to a smaller size as soon as we got it. So there's a bit less
code duplication.
Also, I think I added some g_object_unref()'s in one or two places where
it was missing.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 01 Feb 2006 22:38:34 +0000 |
parents | 614ab5ffc6f9 |
children | e1e5462b7d81 |
line wrap: on
line diff
--- a/src/gtkconv.c Wed Feb 01 06:07:53 2006 +0000 +++ b/src/gtkconv.c Wed Feb 01 22:38:34 2006 +0000 @@ -2220,6 +2220,7 @@ g_return_val_if_fail(account != NULL, NULL); g_return_val_if_fail(name != NULL, NULL); + /* Use the buddy icon, if possible */ if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { GaimBuddy *b = gaim_find_buddy(account, name); if (b != NULL) { @@ -2228,19 +2229,10 @@ } } - if (!status) { - GdkPixbuf *pixbuf; - pixbuf = gaim_gtk_create_prpl_icon(account); - - if (small_icon && pixbuf != NULL) - { - status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, - GDK_INTERP_BILINEAR); - g_object_unref(pixbuf); - } - else - status = pixbuf; - } + /* If they don't have a buddy icon, then use the PRPL icon */ + if (status == NULL) + status = gaim_gtk_create_prpl_icon(account, small_icon ? 0.5 : 1.0); + return status; } @@ -3036,25 +3028,19 @@ if (buddy != NULL) pixbuf = gaim_gtk_blist_get_status_icon((GaimBlistNode*)buddy, GAIM_STATUS_ICON_SMALL); else - { - GdkPixbuf *unscaled = gaim_gtk_create_prpl_icon(account); - - /* XXX: 15 is the size for GAIM_STATUS_ICON_SMALL in gtkblist.c */ - pixbuf = gdk_pixbuf_scale_simple(unscaled, 15, 15, - GDK_INTERP_BILINEAR); - g_object_unref(G_OBJECT(unscaled)); - } + pixbuf = gaim_gtk_create_prpl_icon(account, 0.5); /* Now convert it to GtkImage */ if (pixbuf == NULL) image = gtk_image_new(); else + { image = gtk_image_new_from_pixbuf(pixbuf); + g_object_unref(G_OBJECT(pixbuf)); + } gtk_size_group_add_widget(sg, image); - g_object_unref(G_OBJECT(pixbuf)); - /* Make our menu item */ text = g_strdup_printf("%s (%s)", name, gaim_account_get_username(account)); menuitem = gtk_radio_menu_item_new_with_label(*group, text); @@ -5542,7 +5528,7 @@ win = gaim_gtkconv_get_window(gtkconv); if (!win) return; - + if (fields & GAIM_GTKCONV_SET_TITLE) { gaim_conversation_autoset_title(conv);