comparison pidgin/gtkimhtml.c @ 32686:3538e783b98c

Fix all deprecated GTK_WIDGET_* macros.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 09 Oct 2011 02:50:20 +0000
parents 02a2e8183b1d
children 763d65f3f758
comparison
equal deleted inserted replaced
32685:457443ca22e0 32686:3538e783b98c
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 #if !GTK_CHECK_VERSION(2,20,0)
69 #define gtk_widget_get_realized(x) GTK_WIDGET_REALIZED(x)
70
71 #if !GTK_CHECK_VERSION(2,18,0)
72 #define gtk_widget_get_has_window(x) !GTK_WIDGET_NO_WINDOW(x)
73 #define gtk_widget_get_state(x) GTK_WIDGET_STATE(x)
74 #define gtk_widget_is_drawable(x) GTK_WIDGET_DRAWABLE(x)
75 #endif
76 #endif
77
68 static GtkTextViewClass *parent_class = NULL; 78 static GtkTextViewClass *parent_class = NULL;
69 79
70 struct scalable_data { 80 struct scalable_data {
71 GtkIMHtmlScalable *scalable; 81 GtkIMHtmlScalable *scalable;
72 GtkTextMark *mark; 82 GtkTextMark *mark;
420 imhtml->old_rect = rect; 430 imhtml->old_rect = rect;
421 parent_size_allocate(widget, alloc); 431 parent_size_allocate(widget, alloc);
422 432
423 /* Don't scroll here if we're in the middle of a smooth scroll */ 433 /* Don't scroll here if we're in the middle of a smooth scroll */
424 if (scroll && imhtml->scroll_time == NULL && 434 if (scroll && imhtml->scroll_time == NULL &&
425 GTK_WIDGET_REALIZED(imhtml)) 435 gtk_widget_get_realized(GTK_WIDGET(imhtml)))
426 gtk_imhtml_scroll_to_end(imhtml, FALSE); 436 gtk_imhtml_scroll_to_end(imhtml, FALSE);
427 } 437 }
428 438
429 #define DEFAULT_SEND_COLOR "#204a87" 439 #define DEFAULT_SEND_COLOR "#204a87"
430 #define DEFAULT_RECV_COLOR "#cc0000" 440 #define DEFAULT_RECV_COLOR "#cc0000"
537 547
538 gint gap, x, y, h, w, scr_w, baseline_skip; 548 gint gap, x, y, h, w, scr_w, baseline_skip;
539 549
540 g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE); 550 g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE);
541 551
542 if (!imhtml->tip || !GTK_WIDGET_DRAWABLE (GTK_WIDGET(imhtml))) { 552 if (!imhtml->tip || !gtk_widget_is_drawable (GTK_WIDGET(imhtml))) {
543 imhtml->tip_timer = 0; 553 imhtml->tip_timer = 0;
544 return FALSE; 554 return FALSE;
545 } 555 }
546 556
547 if (imhtml->tip_window){ 557 if (imhtml->tip_window){
590 pango_font_metrics_get_descent(font_metrics)); 600 pango_font_metrics_get_descent(font_metrics));
591 w = 8 + scr_w; 601 w = 8 + scr_w;
592 h = 8 + baseline_skip; 602 h = 8 + baseline_skip;
593 603
594 gdk_window_get_pointer (NULL, &x, &y, NULL); 604 gdk_window_get_pointer (NULL, &x, &y, NULL);
595 if (GTK_WIDGET_NO_WINDOW (GTK_WIDGET(imhtml))) 605 if (!gtk_widget_get_has_window (GTK_WIDGET(imhtml)))
596 y += GTK_WIDGET(imhtml)->allocation.y; 606 y += GTK_WIDGET(imhtml)->allocation.y;
597 607
598 scr_w = gdk_screen_width(); 608 scr_w = gdk_screen_width();
599 609
600 x -= ((w >> 1) + 4); 610 x -= ((w >> 1) + 4);
786 796
787 if (GTK_IMHTML(widget)->edit.background) { 797 if (GTK_IMHTML(widget)->edit.background) {
788 gdk_color_parse(GTK_IMHTML(widget)->edit.background, &gcolor); 798 gdk_color_parse(GTK_IMHTML(widget)->edit.background, &gcolor);
789 gdk_cairo_set_source_color(cr, &gcolor); 799 gdk_cairo_set_source_color(cr, &gcolor);
790 } else { 800 } else {
791 gdk_cairo_set_source_color(cr, &(widget->style->base[GTK_WIDGET_STATE(widget)])); 801 gdk_cairo_set_source_color(cr, &(widget->style->base[gtk_widget_get_state(widget)]));
792 } 802 }
793 803
794 cairo_rectangle(cr, 804 cairo_rectangle(cr,
795 visible_rect.x, visible_rect.y, 805 visible_rect.x, visible_rect.y,
796 visible_rect.width, visible_rect.height); 806 visible_rect.width, visible_rect.height);