pidgin/gtkimhtml.c

branch
cpw.qulogic.gtk3-required
changeset 33170
ce4447562d64
parent 33132
24afd2b22579
child 33176
6594cdb0ab40
equal deleted inserted replaced
33169:1f676cd20646 33170:ce4447562d64
63 63
64 #include <pango/pango-font.h> 64 #include <pango/pango-font.h>
65 65
66 #define TOOLTIP_TIMEOUT 500 66 #define TOOLTIP_TIMEOUT 500
67 67
68 #include "gtk3compat.h"
69
68 static GtkTextViewClass *parent_class = NULL; 70 static GtkTextViewClass *parent_class = NULL;
69 71
70 struct scalable_data { 72 struct scalable_data {
71 GtkIMHtmlScalable *scalable; 73 GtkIMHtmlScalable *scalable;
72 GtkTextMark *mark; 74 GtkTextMark *mark;
800 /* propagate the event normally */ 802 /* propagate the event normally */
801 return FALSE; 803 return FALSE;
802 } 804 }
803 805
804 /* TODO: I think this can be removed for GTK+ 3.0... */ 806 /* TODO: I think this can be removed for GTK+ 3.0... */
805 #if 0 807 #if !GTK_CHECK_VERSION(3,0,0)
806 static gint 808 static gint
807 gtk_imhtml_expose_event (GtkWidget *widget, 809 gtk_imhtml_expose_event (GtkWidget *widget,
808 GdkEventExpose *event) 810 GdkEventExpose *event)
809 { 811 {
810 GtkTextIter start, end, cur; 812 GtkTextIter start, end, cur;
1623 klass->redo = gtk_imhtml_redo; 1625 klass->redo = gtk_imhtml_redo;
1624 1626
1625 gobject_class->finalize = gtk_imhtml_finalize; 1627 gobject_class->finalize = gtk_imhtml_finalize;
1626 widget_class->drag_motion = gtk_text_view_drag_motion; 1628 widget_class->drag_motion = gtk_text_view_drag_motion;
1627 /* TODO: I _think_ this should be removed for GTK+ 3.0 */ 1629 /* TODO: I _think_ this should be removed for GTK+ 3.0 */
1628 /*widget_class->expose_event = gtk_imhtml_expose_event;*/ 1630 #if !GTK_CHECK_VERSION(3,0,0)
1631 widget_class->expose_event = gtk_imhtml_expose_event;
1632 #endif
1629 parent_size_allocate = widget_class->size_allocate; 1633 parent_size_allocate = widget_class->size_allocate;
1630 widget_class->size_allocate = gtk_imhtml_size_allocate; 1634 widget_class->size_allocate = gtk_imhtml_size_allocate;
1631 parent_style_set = widget_class->style_set; 1635 parent_style_set = widget_class->style_set;
1632 widget_class->style_set = gtk_imhtml_style_set; 1636 widget_class->style_set = gtk_imhtml_style_set;
1633 1637
4986 gtk_imhtml_insert_smiley_at_iter(imhtml, sml, smiley, &iter); 4990 gtk_imhtml_insert_smiley_at_iter(imhtml, sml, smiley, &iter);
4987 gtk_text_buffer_end_user_action(imhtml->text_buffer); 4991 gtk_text_buffer_end_user_action(imhtml->text_buffer);
4988 } 4992 }
4989 4993
4990 /* TODO: I think this can be removed for GTK+ 3.0... */ 4994 /* TODO: I think this can be removed for GTK+ 3.0... */
4991 #if 0 4995 #if !GTK_CHECK_VERSION(3,0,0)
4992 static gboolean 4996 static gboolean
4993 image_expose(GtkWidget *widget, GdkEventExpose *event, gpointer user_data) 4997 image_expose(GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
4994 { 4998 {
4995 GTK_WIDGET_CLASS(GTK_WIDGET_GET_CLASS(widget))->expose_event(widget, event); 4999 GTK_WIDGET_CLASS(GTK_WIDGET_GET_CLASS(widget))->expose_event(widget, event);
4996 5000
5116 5120
5117 /* This catches the expose events generated by animated 5121 /* This catches the expose events generated by animated
5118 * images, and ensures that they are handled by the image 5122 * images, and ensures that they are handled by the image
5119 * itself, without propagating to the textview and causing 5123 * itself, without propagating to the textview and causing
5120 * a complete refresh */ 5124 * a complete refresh */
5121 /* TODO: I think this should be removed for GTK+ 3.0? 5125 /* TODO: I think this should be removed for GTK+ 3.0? */
5126 #if !GTK_CHECK_VERSION(3,0,0)
5122 g_signal_connect(G_OBJECT(icon), "expose-event", G_CALLBACK(image_expose), NULL); 5127 g_signal_connect(G_OBJECT(icon), "expose-event", G_CALLBACK(image_expose), NULL);
5123 */ 5128 #endif
5124 5129
5125 gtk_widget_show(icon); 5130 gtk_widget_show(icon);
5126 if (ebox) 5131 if (ebox)
5127 gtk_container_add(GTK_CONTAINER(ebox), icon); 5132 gtk_container_add(GTK_CONTAINER(ebox), icon);
5128 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), ebox ? ebox : icon, anchor); 5133 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), ebox ? ebox : icon, anchor);
5215 static const gchar *tag_to_html_start(GtkTextTag *tag) 5220 static const gchar *tag_to_html_start(GtkTextTag *tag)
5216 { 5221 {
5217 static gchar buf[1024]; 5222 static gchar buf[1024];
5218 gchar *name = NULL; 5223 gchar *name = NULL;
5219 5224
5225 g_object_get(G_OBJECT(tag), "name", &name, NULL);
5220 g_return_val_if_fail(name != NULL, ""); 5226 g_return_val_if_fail(name != NULL, "");
5221 g_object_get(G_OBJECT(tag), "name", &name, NULL);
5222 5227
5223 if (strcmp(name, "BOLD") == 0) { 5228 if (strcmp(name, "BOLD") == 0) {
5224 g_free(name); 5229 g_free(name);
5225 return "<b>"; 5230 return "<b>";
5226 } else if (strcmp(name, "ITALICS") == 0) { 5231 } else if (strcmp(name, "ITALICS") == 0) {
5339 5344
5340 static const gchar *tag_to_html_end(GtkTextTag *tag) 5345 static const gchar *tag_to_html_end(GtkTextTag *tag)
5341 { 5346 {
5342 gchar *name; 5347 gchar *name;
5343 5348
5349 g_object_get(G_OBJECT(tag), "name", &name, NULL);
5344 g_return_val_if_fail(name != NULL, ""); 5350 g_return_val_if_fail(name != NULL, "");
5345 g_object_get(G_OBJECT(tag), "name", &name, NULL);
5346 5351
5347 if (strcmp(name, "BOLD") == 0) { 5352 if (strcmp(name, "BOLD") == 0) {
5348 g_free(name); 5353 g_free(name);
5349 return "</b>"; 5354 return "</b>";
5350 } else if (strcmp(name, "ITALICS") == 0) { 5355 } else if (strcmp(name, "ITALICS") == 0) {

mercurial