Mercurial > pidgin.yaz
comparison src/gtkimhtml.c @ 8890:6c98b883580a
[gaim-migrate @ 9659]
Smiley fixes from Kevin Stange. Fixes ctrl+[1-8] when the no
smilies smiley theme is selected.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 06 May 2004 06:27:26 +0000 |
parents | 1ab2a9c17f4a |
children | 00138e366ef8 |
comparison
equal
deleted
inserted
replaced
8889:ae3f33870550 | 8890:6c98b883580a |
---|---|
1355 return sml ? gtk_smiley_tree_image(imhtml, NULL, text) : NULL; | 1355 return sml ? gtk_smiley_tree_image(imhtml, NULL, text) : NULL; |
1356 } | 1356 } |
1357 x++; | 1357 x++; |
1358 } | 1358 } |
1359 | 1359 |
1360 if (!t->image->file) | |
1361 return NULL; | |
1362 | |
1360 if (!t->image->icon) | 1363 if (!t->image->icon) |
1361 t->image->icon = gdk_pixbuf_animation_new_from_file(t->image->file, NULL); | 1364 t->image->icon = gdk_pixbuf_animation_new_from_file(t->image->file, NULL); |
1362 | 1365 |
1363 return t->image->icon; | 1366 return t->image->icon; |
1364 } | 1367 } |
1368 | |
1365 #define VALID_TAG(x) if (!g_ascii_strncasecmp (string, x ">", strlen (x ">"))) { \ | 1369 #define VALID_TAG(x) if (!g_ascii_strncasecmp (string, x ">", strlen (x ">"))) { \ |
1366 *tag = g_strndup (string, strlen (x)); \ | 1370 *tag = g_strndup (string, strlen (x)); \ |
1367 *len = strlen (x) + 1; \ | 1371 *len = strlen (x) + 1; \ |
1368 return TRUE; \ | 1372 return TRUE; \ |
1369 } \ | 1373 } \ |
3467 GdkPixbufAnimation *annipixbuf = NULL; | 3471 GdkPixbufAnimation *annipixbuf = NULL; |
3468 GtkWidget *icon = NULL; | 3472 GtkWidget *icon = NULL; |
3469 GtkTextChildAnchor *anchor; | 3473 GtkTextChildAnchor *anchor; |
3470 char *unescaped = gaim_unescape_html(smiley); | 3474 char *unescaped = gaim_unescape_html(smiley); |
3471 | 3475 |
3472 anchor = gtk_text_buffer_create_child_anchor(imhtml->text_buffer, iter); | |
3473 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", unescaped, g_free); | |
3474 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_htmltext", g_strdup(smiley), g_free); | |
3475 | |
3476 annipixbuf = gtk_smiley_tree_image(imhtml, sml, unescaped); | 3476 annipixbuf = gtk_smiley_tree_image(imhtml, sml, unescaped); |
3477 if(annipixbuf) { | 3477 if(annipixbuf) { |
3478 if(gdk_pixbuf_animation_is_static_image(annipixbuf)) { | 3478 if(gdk_pixbuf_animation_is_static_image(annipixbuf)) { |
3479 pixbuf = gdk_pixbuf_animation_get_static_image(annipixbuf); | 3479 pixbuf = gdk_pixbuf_animation_get_static_image(annipixbuf); |
3480 if(pixbuf) | 3480 if(pixbuf) |
3483 icon = gtk_image_new_from_animation(annipixbuf); | 3483 icon = gtk_image_new_from_animation(annipixbuf); |
3484 } | 3484 } |
3485 } | 3485 } |
3486 | 3486 |
3487 if (icon) { | 3487 if (icon) { |
3488 anchor = gtk_text_buffer_create_child_anchor(imhtml->text_buffer, iter); | |
3489 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", g_strdup(unescaped), g_free); | |
3490 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_htmltext", g_strdup(smiley), g_free); | |
3491 | |
3488 gtk_widget_show(icon); | 3492 gtk_widget_show(icon); |
3489 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), icon, anchor); | 3493 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), icon, anchor); |
3490 } | 3494 } else { |
3495 gtk_text_buffer_insert(imhtml->text_buffer, iter, smiley, -1); | |
3496 } | |
3497 | |
3498 g_free(unescaped); | |
3491 } | 3499 } |
3492 | 3500 |
3493 static const gchar *tag_to_html_start(GtkTextTag *tag) | 3501 static const gchar *tag_to_html_start(GtkTextTag *tag) |
3494 { | 3502 { |
3495 const gchar *name; | 3503 const gchar *name; |