pidgin/gtkimhtml.c

branch
cpw.qulogic.gtk3
changeset 32433
f539a2c083b2
parent 32422
c215bc5d85e4
parent 32189
3af8d41121b6
child 32438
dc8991868906
child 33120
f6f1a27ade72
equal deleted inserted replaced
32432:47b61b9e08e6 32433:f539a2c083b2
5093 gpointer data; 5093 gpointer data;
5094 size_t len; 5094 size_t len;
5095 5095
5096 data = imhtml->funcs->image_get_data(image); 5096 data = imhtml->funcs->image_get_data(image);
5097 len = imhtml->funcs->image_get_size(image); 5097 len = imhtml->funcs->image_get_size(image);
5098 5098 if (data && len)
5099 if (data && len) { 5099 anim = pidgin_pixbuf_anim_from_data(data, len);
5100 GdkPixbufLoader *loader = gdk_pixbuf_loader_new();
5101 gdk_pixbuf_loader_write(loader, data, len, NULL);
5102 gdk_pixbuf_loader_close(loader, NULL);
5103 anim = gdk_pixbuf_loader_get_animation(loader);
5104 if (anim)
5105 g_object_ref(G_OBJECT(anim));
5106 g_object_unref(G_OBJECT(loader));
5107 }
5108 5100
5109 } 5101 }
5110 5102
5111 if (anim) { 5103 if (anim) {
5112 struct im_image_data *t = g_new(struct im_image_data, 1); 5104 struct im_image_data *t = g_new(struct im_image_data, 1);
5442 tags = g_slist_reverse(tags); 5434 tags = g_slist_reverse(tags);
5443 for (sl = tags; sl; sl = sl->next) { 5435 for (sl = tags; sl; sl = sl->next) {
5444 tag = sl->data; 5436 tag = sl->data;
5445 /** don't worry about non-printing tags ending */ 5437 /** don't worry about non-printing tags ending */
5446 if (tag_ends_here(tag, &iter, &next_iter) && 5438 if (tag_ends_here(tag, &iter, &next_iter) &&
5447 strlen(tag_to_html_end(tag)) > 0 && 5439 *tag_to_html_end(tag) &&
5448 strlen(tag_to_html_start(tag)) > 0) { 5440 *tag_to_html_start(tag))
5449 5441 {
5450 PidginTextTagData *tmp; 5442 PidginTextTagData *tmp;
5451 GQueue *r = g_queue_new(); 5443 GQueue *r = g_queue_new();
5452 5444
5453 while ((tmp = g_queue_pop_tail(q)) && tmp->tag != tag) { 5445 while ((tmp = g_queue_pop_tail(q)) && tmp->tag != tag) {
5454 g_string_append(str, tmp->end); 5446 g_string_append(str, tmp->end);
5766 } 5758 }
5767 5759
5768 static void 5760 static void
5769 gtk_custom_smiley_size_prepared(GdkPixbufLoader *loader, gint width, gint height, gpointer data) 5761 gtk_custom_smiley_size_prepared(GdkPixbufLoader *loader, gint width, gint height, gpointer data)
5770 { 5762 {
5771 #define CUSTOM_SMILEY_SIZE 96 /* XXX: Should this be a theme setting? */ 5763 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/resize_custom_smileys")) {
5772 if (width <= CUSTOM_SMILEY_SIZE && height <= CUSTOM_SMILEY_SIZE) 5764 int custom_smileys_size = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/custom_smileys_size");
5773 return; 5765 if (width <= custom_smileys_size && height <= custom_smileys_size)
5774 5766 return;
5775 if (width >= height) { 5767
5776 height = height * CUSTOM_SMILEY_SIZE / width; 5768 if (width >= height) {
5777 width = CUSTOM_SMILEY_SIZE; 5769 height = height * custom_smileys_size / width;
5778 } else { 5770 width = custom_smileys_size;
5779 width = width * CUSTOM_SMILEY_SIZE / height; 5771 } else {
5780 height = CUSTOM_SMILEY_SIZE; 5772 width = width * custom_smileys_size / height;
5781 } 5773 height = custom_smileys_size;
5782 5774 }
5775 }
5783 gdk_pixbuf_loader_set_size(loader, width, height); 5776 gdk_pixbuf_loader_set_size(loader, width, height);
5784 } 5777 }
5785 5778
5786 void 5779 void
5787 gtk_imhtml_smiley_reload(GtkIMHtmlSmiley *smiley) 5780 gtk_imhtml_smiley_reload(GtkIMHtmlSmiley *smiley)

mercurial