[evolution/gtk3: 9/47] Adapt EText to latest gtk+-3.0 API.



commit f209d85796ca9c83cecc34f6b9387d3ea29980c8
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Nov 9 10:29:32 2010 -0500

    Adapt EText to latest gtk+-3.0 API.

 widgets/text/e-text.c |   43 +++++++++++++++----------------------------
 1 files changed, 15 insertions(+), 28 deletions(-)
---
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index 8c5d91b..ef3e7d9 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -1195,8 +1195,7 @@ _get_tep (EText *text)
 }
 
 static void
-draw_pango_rectangle (GdkDrawable *drawable,
-                      cairo_t *cr,
+draw_pango_rectangle (cairo_t *cr,
                       gint x1,
                       gint y1,
                       PangoRectangle rect)
@@ -1277,12 +1276,11 @@ show_pango_rectangle (EText *text, PangoRectangle rect)
 
 /* Draw handler for the text item */
 static void
-e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
+e_text_draw (GnomeCanvasItem *item, cairo_t *cr,
 	     gint x, gint y, gint width, gint height)
 {
 	EText *text;
 	gint xpos, ypos;
-	cairo_t *cr;
 	GnomeCanvas *canvas;
 	GtkWidget *widget;
 	GdkWindow *window;
@@ -1295,7 +1293,6 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
 	state = gtk_widget_get_state (widget);
 	style = gtk_widget_get_style (widget);
 	window = gtk_widget_get_window (widget);
-        cr = gdk_cairo_create (drawable);
 
 	if (text->draw_background || text->draw_button) {
 		gdk_cairo_set_source_color (cr, &style->fg[state]);
@@ -1320,17 +1317,17 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
 
 		if (text->draw_borders) {
 
-			gtk_paint_shadow (style, drawable,
+			gtk_paint_shadow (style, cr,
 					  GTK_STATE_NORMAL, GTK_SHADOW_IN,
-					  NULL, widget, "entry",
+					  widget, "entry",
 					  thisx, thisy, thiswidth, thisheight);
 
 		}
 
 		if (text->draw_background) {
-			gtk_paint_flat_box (style, drawable,
+			gtk_paint_flat_box (style, cr,
 					    state, GTK_SHADOW_NONE,
-					    NULL, widget, "entry_bg",
+					    widget, "entry_bg",
 					    thisx + style->xthickness,
 					    thisy + style->ythickness,
 					    thiswidth - style->xthickness * 2,
@@ -1364,12 +1361,6 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
 			guint border_width;
 			gint thisx, thisy, thisheight, thiswidth;
 			gint default_spacing;
-			GdkRectangle area;
-
-			area.x = 0;
-			area.y = 0;
-			area.width = width;
-			area.height = height;
 
 			gtk_widget_get_allocation (widget, &allocation);
 			relief = gtk_button_get_relief (GTK_BUTTON (widget));
@@ -1391,9 +1382,9 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
 			if (gtk_widget_has_default (widget) &&
 			    relief == GTK_RELIEF_NORMAL)
 				{
-					gtk_paint_box (style, drawable,
+					gtk_paint_box (style, cr,
 						       GTK_STATE_NORMAL, GTK_SHADOW_IN,
-						       &area, widget, "buttondefault",
+						       widget, "buttondefault",
 						       thisx + xoff, thisy + yoff, thiswidth, thisheight);
 				}
 
@@ -1421,8 +1412,8 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
 			if ((relief != GTK_RELIEF_NONE) ||
 			    ((state != GTK_STATE_NORMAL) &&
 			     (state != GTK_STATE_INSENSITIVE)))
-			gtk_paint_box (style, drawable, state,
-				       shadow_type, &area, widget, "button",
+			gtk_paint_box (style, cr, state,
+				       shadow_type, widget, "button",
 				       thisx + xoff, thisy + yoff,
 				       thiswidth, thisheight);
 
@@ -1432,8 +1423,8 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
 				thiswidth += 2;
 				thisheight += 2;
 
-				gtk_paint_focus (style, window, state,
-						 &area, widget, "button",
+				gtk_paint_focus (style, cr, state,
+						 widget, "button",
 						 thisx + xoff, thisy + yoff,
 						 thiswidth - 1, thisheight - 1);
 			}
@@ -1450,10 +1441,8 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
 	if (!text->preedit_len)
 		reset_layout (text);
 
-	if (!pango_layout_get_text (text->layout)) {
-		cairo_destroy (cr);
+	if (!pango_layout_get_text (text->layout))
 		return;
-	}
 
 	xpos = text->text_cx;
 	ypos = text->text_cy;
@@ -1514,17 +1503,15 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
 					text->layout, offs - text->text +
 					text->preedit_len, &strong_pos,
 					&weak_pos);
-				draw_pango_rectangle (drawable, cr, xpos, ypos, strong_pos);
+				draw_pango_rectangle (cr, xpos, ypos, strong_pos);
 				if (strong_pos.x != weak_pos.x ||
 				    strong_pos.y != weak_pos.y ||
 				    strong_pos.width != weak_pos.width ||
 				    strong_pos.height != weak_pos.height)
-					draw_pango_rectangle (drawable, cr, xpos, ypos, weak_pos);
+					draw_pango_rectangle (cr, xpos, ypos, weak_pos);
 			}
 		}
 	}
-
-	cairo_destroy (cr);
 }
 
 /* Point handler for the text item */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]