Mercurial > pidgin
comparison pidgin/gtkft.c @ 29837:45ec328db5bd
The normal category for this file seems to 'ft'.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 25 Apr 2010 21:24:06 +0000 |
parents | 0bc8e250ae0d |
children | 351d07aefb09 |
comparison
equal
deleted
inserted
replaced
29836:0bc8e250ae0d | 29837:45ec328db5bd |
---|---|
1161 } | 1161 } |
1162 | 1162 |
1163 static void | 1163 static void |
1164 pidgin_xfer_add_thumbnail(PurpleXfer *xfer, const gchar *formats) | 1164 pidgin_xfer_add_thumbnail(PurpleXfer *xfer, const gchar *formats) |
1165 { | 1165 { |
1166 purple_debug_info("pidgin", "creating thumbnail for transfer\n"); | 1166 purple_debug_info("ft", "creating thumbnail for transfer\n"); |
1167 | 1167 |
1168 if (purple_xfer_get_size(xfer) <= PIDGIN_XFER_MAX_SIZE_IMAGE_THUMBNAIL) { | 1168 if (purple_xfer_get_size(xfer) <= PIDGIN_XFER_MAX_SIZE_IMAGE_THUMBNAIL) { |
1169 GdkPixbuf *thumbnail = | 1169 GdkPixbuf *thumbnail = |
1170 gdk_pixbuf_new_from_file_at_size( | 1170 gdk_pixbuf_new_from_file_at_size( |
1171 purple_xfer_get_local_filename(xfer), 128, 128, NULL); | 1171 purple_xfer_get_local_filename(xfer), 128, 128, NULL); |
1179 int i; | 1179 int i; |
1180 gchar *format = NULL; | 1180 gchar *format = NULL; |
1181 | 1181 |
1182 for (i = 0; formats_split[i]; i++) { | 1182 for (i = 0; formats_split[i]; i++) { |
1183 if (purple_strequal(formats_split[i], "jpeg")) { | 1183 if (purple_strequal(formats_split[i], "jpeg")) { |
1184 purple_debug_info("pidgin", "creating JPEG thumbnail\n"); | 1184 purple_debug_info("ft", "creating JPEG thumbnail\n"); |
1185 option_keys[0] = "quality"; | 1185 option_keys[0] = "quality"; |
1186 option_values[0] = "90"; | 1186 option_values[0] = "90"; |
1187 format = "jpeg"; | 1187 format = "jpeg"; |
1188 break; | 1188 break; |
1189 } else if (purple_strequal(formats_split[i], "png")) { | 1189 } else if (purple_strequal(formats_split[i], "png")) { |
1190 purple_debug_info("pidgin", "creating PNG thumbnail\n"); | 1190 purple_debug_info("ft", "creating PNG thumbnail\n"); |
1191 option_keys[0] = "compression"; | 1191 option_keys[0] = "compression"; |
1192 option_values[0] = "9"; | 1192 option_values[0] = "9"; |
1193 format = "png"; | 1193 format = "png"; |
1194 break; | 1194 break; |
1195 } | 1195 } |
1196 } | 1196 } |
1197 | 1197 |
1198 /* Try the first format given by the PRPL without options */ | 1198 /* Try the first format given by the PRPL without options */ |
1199 if (format == NULL) { | 1199 if (format == NULL) { |
1200 purple_debug_info("pidgin", | 1200 purple_debug_info("ft", |
1201 "creating thumbnail of format %s as demanded by PRPL\n", | 1201 "creating thumbnail of format %s as demanded by PRPL\n", |
1202 formats_split[0]); | 1202 formats_split[0]); |
1203 format = formats_split[0]; | 1203 format = formats_split[0]; |
1204 } | 1204 } |
1205 | 1205 |
1206 gdk_pixbuf_save_to_bufferv(thumbnail, &buffer, &size, format, | 1206 gdk_pixbuf_save_to_bufferv(thumbnail, &buffer, &size, format, |
1207 option_keys, option_values, NULL); | 1207 option_keys, option_values, NULL); |
1208 | 1208 |
1209 if (buffer) { | 1209 if (buffer) { |
1210 gchar *mimetype = g_strdup_printf("image/%s", format); | 1210 gchar *mimetype = g_strdup_printf("image/%s", format); |
1211 purple_debug_info("pidgin", | 1211 purple_debug_info("ft", |
1212 "created thumbnail of %" G_GSIZE_FORMAT " bytes\n", | 1212 "created thumbnail of %" G_GSIZE_FORMAT " bytes\n", |
1213 size); | 1213 size); |
1214 purple_xfer_set_thumbnail(xfer, buffer, size, mimetype); | 1214 purple_xfer_set_thumbnail(xfer, buffer, size, mimetype); |
1215 g_free(buffer); | 1215 g_free(buffer); |
1216 g_free(mimetype); | 1216 g_free(mimetype); |