Mercurial > pidgin
comparison src/gtkconv.c @ 7008:ecce6b23ea25
[gaim-migrate @ 7565]
plug a big memleak, and simplify some code in the process
committer: Tailor Script <tailor@pidgin.im>
| author | Nathan Walp <nwalp@pidgin.im> |
|---|---|
| date | Mon, 29 Sep 2003 04:30:35 +0000 |
| parents | 083d1e4a9c78 |
| children | feb3d21a7794 |
comparison
equal
deleted
inserted
replaced
| 7007:da1430478acf | 7008:ecce6b23ea25 |
|---|---|
| 4958 { | 4958 { |
| 4959 GaimGtkConversation *gtkconv; | 4959 GaimGtkConversation *gtkconv; |
| 4960 GaimAccount *account; | 4960 GaimAccount *account; |
| 4961 const char *name; | 4961 const char *name; |
| 4962 GaimBuddy *b; | 4962 GaimBuddy *b; |
| 4963 GdkPixbuf *status = NULL; | |
| 4963 | 4964 |
| 4964 gtkconv = GAIM_GTK_CONVERSATION(conv); | 4965 gtkconv = GAIM_GTK_CONVERSATION(conv); |
| 4965 name = gaim_conversation_get_name(conv); | 4966 name = gaim_conversation_get_name(conv); |
| 4966 account = gaim_conversation_get_account(conv); | 4967 account = gaim_conversation_get_account(conv); |
| 4967 | 4968 |
| 4968 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { | 4969 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { |
| 4969 b = gaim_find_buddy(account, name); | 4970 b = gaim_find_buddy(account, name); |
| 4970 if (b != NULL) { | 4971 if (b != NULL) { |
| 4971 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), | 4972 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)b, |
| 4972 gaim_gtk_blist_get_status_icon((GaimBlistNode *)b, | 4973 GAIM_STATUS_ICON_SMALL); |
| 4973 GAIM_STATUS_ICON_SMALL)); | 4974 } |
| 4974 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), | 4975 } |
| 4975 gaim_gtk_blist_get_status_icon((GaimBlistNode *)b, | 4976 |
| 4976 GAIM_STATUS_ICON_SMALL)); | 4977 if (!status) { |
| 4977 } else { | 4978 GdkPixbuf *pixbuf; |
| 4978 GdkPixbuf *pixbuf, *scale; | |
| 4979 pixbuf = create_prpl_icon(account); | |
| 4980 | |
| 4981 if (pixbuf) { | |
| 4982 scale = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); | |
| 4983 | |
| 4984 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), scale); | |
| 4985 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), scale); | |
| 4986 | |
| 4987 g_object_unref(pixbuf); | |
| 4988 g_object_unref(scale); | |
| 4989 } else { | |
| 4990 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), NULL); | |
| 4991 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), NULL); | |
| 4992 } | |
| 4993 } | |
| 4994 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { | |
| 4995 GdkPixbuf *pixbuf, *scale; | |
| 4996 pixbuf = create_prpl_icon(account); | 4979 pixbuf = create_prpl_icon(account); |
| 4997 | 4980 |
| 4998 if (pixbuf) { | 4981 if (pixbuf) { |
| 4999 scale = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); | 4982 status = gdk_pixbuf_scale_simple(pixbuf, 15, 15, |
| 5000 | 4983 GDK_INTERP_BILINEAR); |
| 5001 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), scale); | |
| 5002 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), scale); | |
| 5003 | |
| 5004 g_object_unref(pixbuf); | 4984 g_object_unref(pixbuf); |
| 5005 g_object_unref(scale); | 4985 } |
| 5006 } else { | 4986 } |
| 5007 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), NULL); | 4987 |
| 5008 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), NULL); | 4988 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->icon), status); |
| 5009 } | 4989 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkconv->menu_icon), status); |
| 5010 } | 4990 |
| 4991 if(status) | |
| 4992 g_object_unref(status); | |
| 5011 } | 4993 } |
| 5012 | 4994 |
| 5013 static void | 4995 static void |
| 5014 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) | 4996 gaim_gtkconv_updated(GaimConversation *conv, GaimConvUpdateType type) |
| 5015 { | 4997 { |
