| 4413 |
4413 |
| 4414 gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &iter, mark); |
4414 gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &iter, mark); |
| 4415 gtk_imhtml_insert_smiley_at_iter(imhtml, sml, smiley, &iter); |
4415 gtk_imhtml_insert_smiley_at_iter(imhtml, sml, smiley, &iter); |
| 4416 } |
4416 } |
| 4417 |
4417 |
| |
4418 static gboolean |
| |
4419 image_expose(GtkWidget *widget, GdkEventExpose *event, gpointer user_data) |
| |
4420 { |
| |
4421 GTK_WIDGET_CLASS(GTK_WIDGET_GET_CLASS(widget))->expose_event(widget, event); |
| |
4422 |
| |
4423 return TRUE; |
| |
4424 } |
| |
4425 |
| 4418 void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char *smiley, GtkTextIter *iter) |
4426 void gtk_imhtml_insert_smiley_at_iter(GtkIMHtml *imhtml, const char *sml, char *smiley, GtkTextIter *iter) |
| 4419 { |
4427 { |
| 4420 GdkPixbuf *pixbuf = NULL; |
4428 GdkPixbuf *pixbuf = NULL; |
| 4421 GdkPixbufAnimation *annipixbuf = NULL; |
4429 GdkPixbufAnimation *annipixbuf = NULL; |
| 4422 GtkWidget *icon = NULL; |
4430 GtkWidget *icon = NULL; |
| 4439 |
4447 |
| 4440 if (icon) { |
4448 if (icon) { |
| 4441 anchor = gtk_text_buffer_create_child_anchor(imhtml->text_buffer, iter); |
4449 anchor = gtk_text_buffer_create_child_anchor(imhtml->text_buffer, iter); |
| 4442 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", g_strdup(unescaped), g_free); |
4450 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", g_strdup(unescaped), g_free); |
| 4443 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_htmltext", g_strdup(smiley), g_free); |
4451 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_htmltext", g_strdup(smiley), g_free); |
| |
4452 |
| |
4453 /* This catches the expose events generated by animated |
| |
4454 * images, and ensures that they are handled by the image |
| |
4455 * itself, without propagating to the textview and causing |
| |
4456 * a complete refresh */ |
| |
4457 g_signal_connect(G_OBJECT(icon), "expose-event", G_CALLBACK(image_expose), NULL); |
| 4444 |
4458 |
| 4445 gtk_widget_show(icon); |
4459 gtk_widget_show(icon); |
| 4446 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), icon, anchor); |
4460 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), icon, anchor); |
| 4447 } else if (imhtml_smiley != NULL && (imhtml->format_functions & GTK_IMHTML_SMILEY)) { |
4461 } else if (imhtml_smiley != NULL && (imhtml->format_functions & GTK_IMHTML_SMILEY)) { |
| 4448 anchor = gtk_text_buffer_create_child_anchor(imhtml->text_buffer, iter); |
4462 anchor = gtk_text_buffer_create_child_anchor(imhtml->text_buffer, iter); |