Mercurial > pidgin.yaz
changeset 30251:0bc8e250ae0d
Thumbnail formats should be chosen in the order specified by the prpl.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 25 Apr 2010 21:23:08 +0000 |
parents | afc9cec164e4 |
children | 45ec328db5bd |
files | pidgin/gtkft.c |
diffstat | 1 files changed, 14 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkft.c Sun Apr 25 21:09:34 2010 +0000 +++ b/pidgin/gtkft.c Sun Apr 25 21:23:08 2010 +0000 @@ -1176,36 +1176,27 @@ gsize size; char *option_keys[2] = {NULL, NULL}; char *option_values[2] = {NULL, NULL}; - gboolean supports_jpeg = FALSE; - gboolean supports_png = FALSE; int i; gchar *format = NULL; - for (i = 0 ; formats_split[i] ; i++) { + for (i = 0; formats_split[i]; i++) { if (purple_strequal(formats_split[i], "jpeg")) { - supports_jpeg = TRUE; + purple_debug_info("pidgin", "creating JPEG thumbnail\n"); + option_keys[0] = "quality"; + option_values[0] = "90"; + format = "jpeg"; + break; } else if (purple_strequal(formats_split[i], "png")) { - supports_png = TRUE; + purple_debug_info("pidgin", "creating PNG thumbnail\n"); + option_keys[0] = "compression"; + option_values[0] = "9"; + format = "png"; + break; } } - /* prefer JPEG, then PNG, otherwise try the first format given - by the PRPL without options */ - if (supports_jpeg) { - purple_debug_info("pidgin", "creating JPEG thumbnail\n"); - option_keys[0] = "quality"; - option_keys[1] = NULL; - option_values[0] = "90"; - option_values[1] = NULL; - format = "jpeg"; - } else if (supports_png) { - purple_debug_info("pidgin", "creating PNG thumbnail\n"); - option_keys[0] = "compression"; - option_keys[1] = NULL; - option_values[0] = "9"; - option_values[1] = NULL; - format = "png"; - } else { + /* Try the first format given by the PRPL without options */ + if (format == NULL) { purple_debug_info("pidgin", "creating thumbnail of format %s as demanded by PRPL\n", formats_split[0]); @@ -1216,7 +1207,7 @@ option_keys, option_values, NULL); if (buffer) { - const gchar *mimetype = g_strdup_printf("image/%s", format); + gchar *mimetype = g_strdup_printf("image/%s", format); purple_debug_info("pidgin", "created thumbnail of %" G_GSIZE_FORMAT " bytes\n", size);