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



commit 694b249d4974e247d6fd9173e62ac8acd21a9f95
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Nov 9 09:57:28 2010 -0500

    Adapt ECalendarItem to latest gtk+-3.0 API.

 widgets/misc/e-calendar-item.c |   64 ++++++++++------------------------------
 1 files changed, 16 insertions(+), 48 deletions(-)
---
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index a73b3db..dd07f34 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -56,19 +56,18 @@ static void e_calendar_item_set_property (GObject	 *object,
 					 const GValue	 *value,
 					 GParamSpec	 *pspec);
 static void e_calendar_item_realize	(GnomeCanvasItem *item);
-static void e_calendar_item_unrealize	(GnomeCanvasItem *item);
 static void e_calendar_item_unmap	(GnomeCanvasItem *item);
 static void e_calendar_item_update	(GnomeCanvasItem *item,
 					 const cairo_matrix_t *i2c,
 					 gint		  flags);
 static void e_calendar_item_draw	(GnomeCanvasItem *item,
-					 GdkDrawable	 *drawable,
+					 cairo_t	 *cr,
 					 gint		  x,
 					 gint		  y,
 					 gint		  width,
 					 gint		  height);
 static void e_calendar_item_draw_month	(ECalendarItem   *calitem,
-					 GdkDrawable	 *drawable,
+					 cairo_t	 *cr,
 					 gint		  x,
 					 gint		  y,
 					 gint		  width,
@@ -76,7 +75,7 @@ static void e_calendar_item_draw_month	(ECalendarItem   *calitem,
 					 gint		  row,
 					 gint		  col);
 static void e_calendar_item_draw_day_numbers (ECalendarItem	*calitem,
-					      GdkDrawable	*drawable,
+					      cairo_t		*cr,
 					      gint		 width,
 					      gint		 height,
 					      gint		 row,
@@ -248,7 +247,6 @@ e_calendar_item_class_init (ECalendarItemClass *class)
 
 	item_class = GNOME_CANVAS_ITEM_CLASS (class);
 	item_class->realize = e_calendar_item_realize;
-	item_class->unrealize = e_calendar_item_unrealize;
 	item_class->unmap = e_calendar_item_unmap;
 	item_class->update = e_calendar_item_update;
 	item_class->draw = e_calendar_item_draw;
@@ -854,22 +852,6 @@ e_calendar_item_realize		(GnomeCanvasItem *item)
 }
 
 static void
-e_calendar_item_unrealize	(GnomeCanvasItem *item)
-{
-	ECalendarItem *calitem;
-	GdkColormap *colormap;
-
-	calitem = E_CALENDAR_ITEM (item);
-
-	colormap = gtk_widget_get_colormap (GTK_WIDGET (item->canvas));
-
-	gdk_colormap_free_colors (colormap, calitem->colors, E_CALENDAR_ITEM_COLOR_LAST);
-
-	if (GNOME_CANVAS_ITEM_CLASS (e_calendar_item_parent_class)->unrealize)
-		(* GNOME_CANVAS_ITEM_CLASS (e_calendar_item_parent_class)->unrealize) (item);
-}
-
-static void
 e_calendar_item_unmap		(GnomeCanvasItem *item)
 {
 	ECalendarItem *calitem;
@@ -1021,7 +1003,7 @@ e_calendar_item_update		(GnomeCanvasItem *item,
  */
 static void
 e_calendar_item_draw		(GnomeCanvasItem *canvas_item,
-				 GdkDrawable	 *drawable,
+				 cairo_t	 *cr,
 				 gint		  x,
 				 gint		  y,
 				 gint		  width,
@@ -1034,7 +1016,6 @@ e_calendar_item_draw		(GnomeCanvasItem *canvas_item,
 	PangoFontDescription *font_desc;
 	PangoContext *pango_context;
 	PangoFontMetrics *font_metrics;
-	cairo_t *cr;
 	GdkColor base, bg;
 
 #if 0
@@ -1060,7 +1041,6 @@ e_calendar_item_draw		(GnomeCanvasItem *canvas_item,
 
 	base = style->base[GTK_STATE_NORMAL];
 	bg = style->bg[GTK_STATE_NORMAL];
-	cr = gdk_cairo_create (drawable);
 
 	/* Clear the entire background. */
 	cairo_save (cr);
@@ -1072,8 +1052,8 @@ e_calendar_item_draw		(GnomeCanvasItem *canvas_item,
 	cairo_restore (cr);
 
 	/* Draw the shadow around the entire item. */
-	gtk_paint_shadow (style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN,
-			  NULL, NULL, "entry",
+	gtk_paint_shadow (style, cr, GTK_STATE_NORMAL, GTK_SHADOW_IN,
+			  NULL, "entry",
 			  calitem->x1 - x, calitem->y1 - y,
 			  calitem->x2 - calitem->x1 + 1,
 			  calitem->y2 - calitem->y1 + 1);
@@ -1096,9 +1076,9 @@ e_calendar_item_draw		(GnomeCanvasItem *canvas_item,
 		cairo_fill (cr);
 		cairo_restore (cr);
 
-		gtk_paint_shadow (style, drawable,
+		gtk_paint_shadow (style, cr,
 				  GTK_STATE_NORMAL, GTK_SHADOW_OUT,
-				  NULL, NULL, "calendar-header",
+				  NULL, "calendar-header",
 				  calitem->x1 + xthickness - x, row_y - y,
 				  calitem->x2 - calitem->x1 + 1
 				  - xthickness * 2,
@@ -1108,9 +1088,8 @@ e_calendar_item_draw		(GnomeCanvasItem *canvas_item,
 			if (col != 0) {
 				col_x = calitem->x1 + calitem->x_offset
 					+ calitem->month_width * col;
-				gtk_paint_vline (style, drawable,
-						 GTK_STATE_NORMAL,
-						 NULL, NULL,
+				gtk_paint_vline (style, cr,
+						 GTK_STATE_NORMAL, NULL,
 						 "calendar-separator",
 						 row_y + ythickness + 1 - y,
 						 row_y + bar_height
@@ -1118,7 +1097,7 @@ e_calendar_item_draw		(GnomeCanvasItem *canvas_item,
 						 col_x - 1 - x);
 			}
 
-			e_calendar_item_draw_month (calitem, drawable, x, y,
+			e_calendar_item_draw_month (calitem, cr, x, y,
 						    width, height, row, col);
 		}
 
@@ -1126,7 +1105,6 @@ e_calendar_item_draw		(GnomeCanvasItem *canvas_item,
 	}
 
 	pango_font_metrics_unref (font_metrics);
-	cairo_destroy (cr);
 }
 
 static void
@@ -1141,7 +1119,7 @@ layout_set_day_text (ECalendarItem *calitem, PangoLayout *layout, gint day_index
 
 static void
 e_calendar_item_draw_month	(ECalendarItem   *calitem,
-				 GdkDrawable	 *drawable,
+				 cairo_t	 *cr,
 				 gint		  x,
 				 gint		  y,
 				 gint		  width,
@@ -1165,7 +1143,6 @@ e_calendar_item_draw_month	(ECalendarItem   *calitem,
 	PangoContext *pango_context;
 	PangoFontMetrics *font_metrics;
 	PangoLayout *layout;
-	cairo_t *cr;
 
 #if 0
 	g_print ("In e_calendar_item_draw_month: %i,%i %ix%i row:%i col:%i\n",
@@ -1175,8 +1152,6 @@ e_calendar_item_draw_month	(ECalendarItem   *calitem,
 	widget = GTK_WIDGET (item->canvas);
 	style = gtk_widget_get_style (widget);
 
-	cr = gdk_cairo_create (drawable);
-
 	/* Set up Pango prerequisites */
 	font_desc = calitem->font_desc;
 	if (!font_desc)
@@ -1206,7 +1181,6 @@ e_calendar_item_draw_month	(ECalendarItem   *calitem,
 	/* Just return if the month is outside the given area. */
 	if (month_x >= width || month_x + calitem->month_width <= 0
 	    || month_y >= height || month_y + calitem->month_height <= 0) {
-		cairo_destroy (cr);
 		return;
 	}
 
@@ -1281,7 +1255,6 @@ e_calendar_item_draw_month	(ECalendarItem   *calitem,
 
 	if (clip_width <= 0 || clip_height <= 0) {
 		g_object_unref (layout);
-		cairo_destroy (cr);
 		return;
 	}
 
@@ -1348,12 +1321,11 @@ e_calendar_item_draw_month	(ECalendarItem   *calitem,
 		cairo_restore (cr);
 	}
 
-        e_calendar_item_draw_day_numbers (calitem, drawable, width, height,
-                                          row, col, year, month, start_weekday,
-                                          cells_x, cells_y);
+	e_calendar_item_draw_day_numbers (
+		calitem, cr, width, height, row, col,
+		year, month, start_weekday, cells_x, cells_y);
 
 	g_object_unref (layout);
-	cairo_destroy (cr);
 }
 
 static const gchar *
@@ -1386,7 +1358,7 @@ get_digit_fomat ()
 
 static void
 e_calendar_item_draw_day_numbers (ECalendarItem	*calitem,
-				  GdkDrawable	*drawable,
+				  cairo_t	*cr,
 				  gint		 width,
 				  gint		 height,
 				  gint		 row,
@@ -1418,14 +1390,11 @@ e_calendar_item_draw_day_numbers (ECalendarItem	*calitem,
 	PangoContext *pango_context;
 	PangoFontMetrics *font_metrics;
 	PangoLayout *layout;
-	cairo_t *cr;
 
 	item = GNOME_CANVAS_ITEM (calitem);
 	widget = GTK_WIDGET (item->canvas);
 	style = gtk_widget_get_style (widget);
 
-	cr = gdk_cairo_create (drawable);
-
 	/* Set up Pango prerequisites */
 	font_desc = calitem->font_desc;
 	if (!font_desc)
@@ -1702,7 +1671,6 @@ e_calendar_item_draw_day_numbers (ECalendarItem	*calitem,
 	g_object_unref (layout);
 
 	pango_font_metrics_unref (font_metrics);
-	cairo_destroy (cr);
 }
 
 gint



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