Mercurial > pidgin.yaz
comparison 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 |
comparison
equal
deleted
inserted
replaced
13089:b553326bc468 | 13090:0aa231ebbfd5 |
---|---|
2218 name = gaim_conversation_get_name(conv); | 2218 name = gaim_conversation_get_name(conv); |
2219 | 2219 |
2220 g_return_val_if_fail(account != NULL, NULL); | 2220 g_return_val_if_fail(account != NULL, NULL); |
2221 g_return_val_if_fail(name != NULL, NULL); | 2221 g_return_val_if_fail(name != NULL, NULL); |
2222 | 2222 |
2223 /* Use the buddy icon, if possible */ | |
2223 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { | 2224 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { |
2224 GaimBuddy *b = gaim_find_buddy(account, name); | 2225 GaimBuddy *b = gaim_find_buddy(account, name); |
2225 if (b != NULL) { | 2226 if (b != NULL) { |
2226 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, | 2227 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, |
2227 (small_icon ? GAIM_STATUS_ICON_SMALL : GAIM_STATUS_ICON_LARGE)); | 2228 (small_icon ? GAIM_STATUS_ICON_SMALL : GAIM_STATUS_ICON_LARGE)); |
2228 } | 2229 } |
2229 } | 2230 } |
2230 | 2231 |
2231 if (!status) { | 2232 /* If they don't have a buddy icon, then use the PRPL icon */ |
2232 GdkPixbuf *pixbuf; | 2233 if (status == NULL) |
2233 pixbuf = gaim_gtk_create_prpl_icon(account); | 2234 status = gaim_gtk_create_prpl_icon(account, small_icon ? 0.5 : 1.0); |
2234 | 2235 |
2235 if (small_icon && pixbuf != NULL) | |
2236 { | |
2237 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, | |
2238 GDK_INTERP_BILINEAR); | |
2239 g_object_unref(pixbuf); | |
2240 } | |
2241 else | |
2242 status = pixbuf; | |
2243 } | |
2244 return status; | 2236 return status; |
2245 } | 2237 } |
2246 | 2238 |
2247 static void | 2239 static void |
2248 update_tab_icon(GaimConversation *conv) | 2240 update_tab_icon(GaimConversation *conv) |
3034 | 3026 |
3035 /* Create a pixmap for the protocol icon. */ | 3027 /* Create a pixmap for the protocol icon. */ |
3036 if (buddy != NULL) | 3028 if (buddy != NULL) |
3037 pixbuf = gaim_gtk_blist_get_status_icon((GaimBlistNode*)buddy, GAIM_STATUS_ICON_SMALL); | 3029 pixbuf = gaim_gtk_blist_get_status_icon((GaimBlistNode*)buddy, GAIM_STATUS_ICON_SMALL); |
3038 else | 3030 else |
3039 { | 3031 pixbuf = gaim_gtk_create_prpl_icon(account, 0.5); |
3040 GdkPixbuf *unscaled = gaim_gtk_create_prpl_icon(account); | |
3041 | |
3042 /* XXX: 15 is the size for GAIM_STATUS_ICON_SMALL in gtkblist.c */ | |
3043 pixbuf = gdk_pixbuf_scale_simple(unscaled, 15, 15, | |
3044 GDK_INTERP_BILINEAR); | |
3045 g_object_unref(G_OBJECT(unscaled)); | |
3046 } | |
3047 | 3032 |
3048 /* Now convert it to GtkImage */ | 3033 /* Now convert it to GtkImage */ |
3049 if (pixbuf == NULL) | 3034 if (pixbuf == NULL) |
3050 image = gtk_image_new(); | 3035 image = gtk_image_new(); |
3051 else | 3036 else |
3037 { | |
3052 image = gtk_image_new_from_pixbuf(pixbuf); | 3038 image = gtk_image_new_from_pixbuf(pixbuf); |
3039 g_object_unref(G_OBJECT(pixbuf)); | |
3040 } | |
3053 | 3041 |
3054 gtk_size_group_add_widget(sg, image); | 3042 gtk_size_group_add_widget(sg, image); |
3055 | |
3056 g_object_unref(G_OBJECT(pixbuf)); | |
3057 | 3043 |
3058 /* Make our menu item */ | 3044 /* Make our menu item */ |
3059 text = g_strdup_printf("%s (%s)", name, gaim_account_get_username(account)); | 3045 text = g_strdup_printf("%s (%s)", name, gaim_account_get_username(account)); |
3060 menuitem = gtk_radio_menu_item_new_with_label(*group, text); | 3046 menuitem = gtk_radio_menu_item_new_with_label(*group, text); |
3061 g_free(text); | 3047 g_free(text); |
5540 if (!gtkconv) | 5526 if (!gtkconv) |
5541 return; | 5527 return; |
5542 win = gaim_gtkconv_get_window(gtkconv); | 5528 win = gaim_gtkconv_get_window(gtkconv); |
5543 if (!win) | 5529 if (!win) |
5544 return; | 5530 return; |
5545 | 5531 |
5546 if (fields & GAIM_GTKCONV_SET_TITLE) | 5532 if (fields & GAIM_GTKCONV_SET_TITLE) |
5547 { | 5533 { |
5548 gaim_conversation_autoset_title(conv); | 5534 gaim_conversation_autoset_title(conv); |
5549 } | 5535 } |
5550 | 5536 |