From c410f418468bf2243dee0f9dc4e7d6afe2c15214 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Mon, 28 Oct 2013 14:22:32 +0100 Subject: cut-n-paste: Fix GTK3 support --- .../gimpcellrenderertoggle.c | 43 ++++++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) (limited to 'cut-n-paste/gimpcellrenderertoggle') diff --git a/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c b/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c index e9a25f15..577aa086 100644 --- a/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c +++ b/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c @@ -60,11 +60,20 @@ static void gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell, gint *width, gint *height); static void gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, +#if GTK_CHECK_VERSION (3, 0, 0) + cairo_t *cr, +#else GdkWindow *window, +#endif GtkWidget *widget, +#if GTK_CHECK_VERSION (3, 0, 0) + const GdkRectangle *background_area, + const GdkRectangle *cell_area, +#else GdkRectangle *background_area, GdkRectangle *cell_area, GdkRectangle *expose_area, +#endif GtkCellRendererState flags); static gboolean gimp_cell_renderer_toggle_activate (GtkCellRenderer *cell, GdkEvent *event, @@ -274,13 +283,26 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell, } } +#if GTK_CHECK_VERSION (3, 0, 0) +#define gimp_cell_renderer_toggle_get_size gtk_cell_renderer_get_size +#endif + static void gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, +#if GTK_CHECK_VERSION (3, 0, 0) + cairo_t *cr, +#else GdkWindow *window, +#endif GtkWidget *widget, +#if GTK_CHECK_VERSION (3, 0, 0) + const GdkRectangle *background_area, + const GdkRectangle *cell_area, +#else GdkRectangle *background_area, GdkRectangle *cell_area, GdkRectangle *expose_area, +#endif GtkCellRendererState flags) { GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell); @@ -294,9 +316,18 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, if (! toggle->stock_id) { - GTK_CELL_RENDERER_CLASS (parent_class)->render (cell, window, widget, + GTK_CELL_RENDERER_CLASS (parent_class)->render (cell, +#if GTK_CHECK_VERSION (3, 0, 0) + cr, +#else + window, +#endif + widget, background_area, - cell_area, expose_area, + cell_area, +#if !GTK_CHECK_VERSION (3, 0, 0) + expose_area, +#endif flags); return; } @@ -338,6 +369,7 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, state = GTK_STATE_INSENSITIVE; } +#if !GTK_CHECK_VERSION (3, 0, 0) if (gdk_rectangle_intersect (expose_area, cell_area, &draw_rect) && (flags & GTK_CELL_RENDERER_PRELIT)) gtk_paint_shadow (style, @@ -348,6 +380,7 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, widget, NULL, toggle_rect.x, toggle_rect.y, toggle_rect.width, toggle_rect.height); +#endif if (active) { @@ -388,15 +421,19 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, if (gdk_rectangle_intersect (&draw_rect, &toggle_rect, &draw_rect)) { +#if !GTK_CHECK_VERSION (3, 0, 0) cairo_t *cr; cr = gdk_cairo_create (window); +#endif gdk_cairo_set_source_pixbuf (cr, pixbuf, toggle_rect.x, toggle_rect.y); gdk_cairo_rectangle (cr, &draw_rect); cairo_fill (cr); - + +#if !GTK_CHECK_VERSION (3, 0, 0) cairo_destroy (cr); +#endif } if (insensitive) -- cgit v1.2.1