# HG changeset patch # User Nathan Walp # Date 1049512015 0 # Node ID 29c87c6e75d927367468fed27ffcf664bbaed8c5 # Parent eb1d45bffe66018e5d7778ca595e0c9539994e86 [gaim-migrate @ 5356] ugly code warning, but this should at least let people using gtk 2.0.x save jpegs if they want to. committer: Tailor Script diff -r eb1d45bffe66 -r 29c87c6e75d9 src/gtkimhtml.c --- a/src/gtkimhtml.c Sat Apr 05 03:02:12 2003 +0000 +++ b/src/gtkimhtml.c Sat Apr 05 03:06:55 2003 +0000 @@ -1562,6 +1562,23 @@ formats = formats->next; } + g_slist_free(formats); +#else + /* this is really ugly code, but I think it will work */ + char *basename = g_path_get_basename(filename); + char *ext = strrchr(basename, '.'); + + if(ext) { + ext++; + if(!g_ascii_strcasecmp(ext, "jpeg") || !g_ascii_strcasecmp(ext, "jpg")) + type = g_strdup("jpeg"); + else if(!g_ascii_strcasecmp(ext, "png")) + type = g_strdup("png"); + } + + g_free(basename); +#endif + /* If I can't find a valid type, I will just tell the user about it and then assume it's a png */ if(!type){ @@ -1569,10 +1586,6 @@ _("Gaim was unable to guess the image type base on the file extension supplied. Defaulting to PNG.")); type = g_strdup("png"); } - g_slist_free(formats); -#else - type = g_strdup("png"); -#endif gdk_pixbuf_save(gtk_image_get_pixbuf(image->image), filename, type, &error, NULL);