# HG changeset patch # User Tim Ringenbach # Date 1103142847 0 # Node ID 9f50c31a41f9bb003fb8f5d1557407836c724fec # Parent bed8d9a7bb889296135fc375620649510b21ec43 [gaim-migrate @ 11607] Gabor Farkas wanted to hack his blist.xml file so he could set buddy icons for jabber buddies, who's screenname's have slashes in them. While I don't recommend this, his patch, which changes how we load buddy icons in conversations to not write tmp files, is good nevertheless. committer: Tailor Script diff -r bed8d9a7bb88 -r 9f50c31a41f9 COPYRIGHT --- a/COPYRIGHT Wed Dec 15 16:27:07 2004 +0000 +++ b/COPYRIGHT Wed Dec 15 20:34:07 2004 +0000 @@ -52,6 +52,7 @@ Brian Enigma Stefan Esser Larry Ewing +Gabor Farkas Jesse Farmer Gavan Fantom (gavan) Rob Flynn diff -r bed8d9a7bb88 -r 9f50c31a41f9 src/gtkconv.c --- a/src/gtkconv.c Wed Dec 15 16:27:07 2004 +0000 +++ b/src/gtkconv.c Wed Dec 15 20:34:07 2004 +0000 @@ -5305,8 +5305,8 @@ GaimGtkConversation *gtkconv; GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); - char filename[256]; - FILE *file; + GdkPixbufLoader *loader; + GdkPixbufAnimation *anim; GError *err = NULL; const void *data; @@ -5372,22 +5372,17 @@ data = gaim_buddy_icon_get_data(icon, &len); - /* this is such an evil hack, i don't know why i'm even considering it. - * we'll do it differently when gdk-pixbuf-loader isn't leaky anymore. */ - /* gdk-pixbuf-loader was leaky? is it still? */ - g_snprintf(filename, sizeof(filename), - "%s" G_DIR_SEPARATOR_S "gaimicon-%s.%d", - g_get_tmp_dir(), gaim_conversation_get_name(conv), getpid()); - - if (!(file = fopen(filename, "wb"))) + loader = gdk_pixbuf_loader_new(); + gdk_pixbuf_loader_write(loader, data, len, NULL); + anim = gdk_pixbuf_loader_get_animation(loader); + if (anim) + g_object_ref(G_OBJECT(anim)); + gdk_pixbuf_loader_close(loader, &err); + g_object_unref(loader); + + if (!anim) return; - - fwrite(data, 1, len, file); - fclose(file); - - gtkconv->u.im->anim = gdk_pixbuf_animation_new_from_file(filename, &err); - /* make sure we remove the file as soon as possible */ - unlink(filename); + gtkconv->u.im->anim = anim; if (err) { gaim_debug(GAIM_DEBUG_ERROR, "gtkconv",