Mercurial > pidgin.yaz
comparison pidgin/gtkft.c @ 31813:ea2a155b4439
propagate from branch 'im.pidgin.pidgin' (head 7d1d85421a7221e67b586df32625c65c1434f195)
to branch 'im.pidgin.pidgin.next.minor' (head 5806c0bc47c791300ede51ab92336dd817bd149c)
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Sat, 08 Jan 2011 03:10:40 +0000 |
parents | a8cc50c2279f |
children | 917c597beb97 |
comparison
equal
deleted
inserted
replaced
31812:539aa44be788 | 31813:ea2a155b4439 |
---|---|
1154 pidgin_xfer_dialog_cancel_xfer(xfer_dialog, xfer); | 1154 pidgin_xfer_dialog_cancel_xfer(xfer_dialog, xfer); |
1155 } | 1155 } |
1156 | 1156 |
1157 static void | 1157 static void |
1158 pidgin_xfer_add_thumbnail(PurpleXfer *xfer, const gchar *formats) | 1158 pidgin_xfer_add_thumbnail(PurpleXfer *xfer, const gchar *formats) |
1159 { | 1159 { |
1160 purple_debug_info("ft", "creating thumbnail for transfer\n"); | 1160 purple_debug_info("ft", "creating thumbnail for transfer\n"); |
1161 | 1161 |
1162 if (purple_xfer_get_size(xfer) <= PIDGIN_XFER_MAX_SIZE_IMAGE_THUMBNAIL) { | 1162 if (purple_xfer_get_size(xfer) <= PIDGIN_XFER_MAX_SIZE_IMAGE_THUMBNAIL) { |
1163 GdkPixbuf *thumbnail = | 1163 GdkPixbuf *thumbnail = |
1164 gdk_pixbuf_new_from_file_at_size( | 1164 gdk_pixbuf_new_from_file_at_size( |
1165 purple_xfer_get_local_filename(xfer), 128, 128, NULL); | 1165 purple_xfer_get_local_filename(xfer), 128, 128, NULL); |
1166 | 1166 |
1167 if (thumbnail) { | 1167 if (thumbnail) { |
1168 gchar **formats_split = g_strsplit(formats, ",", 0); | 1168 gchar **formats_split = g_strsplit(formats, ",", 0); |
1170 gsize size; | 1170 gsize size; |
1171 char *option_keys[2] = {NULL, NULL}; | 1171 char *option_keys[2] = {NULL, NULL}; |
1172 char *option_values[2] = {NULL, NULL}; | 1172 char *option_values[2] = {NULL, NULL}; |
1173 int i; | 1173 int i; |
1174 gchar *format = NULL; | 1174 gchar *format = NULL; |
1175 | 1175 |
1176 for (i = 0; formats_split[i]; i++) { | 1176 for (i = 0; formats_split[i]; i++) { |
1177 if (purple_strequal(formats_split[i], "jpeg")) { | 1177 if (purple_strequal(formats_split[i], "jpeg")) { |
1178 purple_debug_info("ft", "creating JPEG thumbnail\n"); | 1178 purple_debug_info("ft", "creating JPEG thumbnail\n"); |
1179 option_keys[0] = "quality"; | 1179 option_keys[0] = "quality"; |
1180 option_values[0] = "90"; | 1180 option_values[0] = "90"; |
1195 "creating thumbnail of format %s as demanded by PRPL\n", | 1195 "creating thumbnail of format %s as demanded by PRPL\n", |
1196 formats_split[0]); | 1196 formats_split[0]); |
1197 format = formats_split[0]; | 1197 format = formats_split[0]; |
1198 } | 1198 } |
1199 | 1199 |
1200 gdk_pixbuf_save_to_bufferv(thumbnail, &buffer, &size, format, | 1200 gdk_pixbuf_save_to_bufferv(thumbnail, &buffer, &size, format, |
1201 option_keys, option_values, NULL); | 1201 option_keys, option_values, NULL); |
1202 | 1202 |
1203 if (buffer) { | 1203 if (buffer) { |
1204 gchar *mimetype = g_strdup_printf("image/%s", format); | 1204 gchar *mimetype = g_strdup_printf("image/%s", format); |
1205 purple_debug_info("ft", | 1205 purple_debug_info("ft", |
1206 "created thumbnail of %" G_GSIZE_FORMAT " bytes\n", | 1206 "created thumbnail of %" G_GSIZE_FORMAT " bytes\n", |
1207 size); | 1207 size); |
1208 purple_xfer_set_thumbnail(xfer, buffer, size, mimetype); | 1208 purple_xfer_set_thumbnail(xfer, buffer, size, mimetype); |
1209 g_free(buffer); | 1209 g_free(buffer); |