aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-01-15 23:12:53 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:41:27 +0800
commitb754e4a5d2f9b19ab7d70f79bad698c0fc69beff (patch)
treefdcb8760dbb98dd288a8a440a520a8381b203593 /widgets
parent0dd0f9b28f962837e847ed57ad4ee0c0f9b77038 (diff)
downloadgsoc2013-evolution-b754e4a5d2f9b19ab7d70f79bad698c0fc69beff.tar.gz
gsoc2013-evolution-b754e4a5d2f9b19ab7d70f79bad698c0fc69beff.tar.zst
gsoc2013-evolution-b754e4a5d2f9b19ab7d70f79bad698c0fc69beff.zip
Adapt ETableHeaderItem to latest gtk+-3.0 API.
Diffstat (limited to 'widgets')
-rw-r--r--widgets/table/e-table-header-item.c36
-rw-r--r--widgets/table/e-table-header-utils.c25
-rw-r--r--widgets/table/e-table-header-utils.h4
3 files changed, 32 insertions, 33 deletions
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index eda9e26063..b7388fdfaa 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -454,24 +454,18 @@ static GtkWidget *
make_shaped_window_from_xpm (const gchar **xpm)
{
GdkPixbuf *pixbuf;
- GdkPixmap *pixmap;
- GdkBitmap *bitmap;
GtkWidget *win, *pix;
pixbuf = gdk_pixbuf_new_from_xpm_data (xpm);
- gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &bitmap, 128);
- g_object_unref (pixbuf);
win = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_type_hint (GTK_WINDOW (win), GDK_WINDOW_TYPE_HINT_NOTIFICATION);
- pix = gtk_image_new_from_pixmap (pixmap, bitmap);
+ pix = gtk_image_new_from_pixbuf (pixbuf);
gtk_widget_realize (win);
gtk_container_add (GTK_CONTAINER (win), pix);
- gtk_widget_shape_combine_mask (win, bitmap, 0, 0);
- g_object_unref (pixmap);
- g_object_unref (bitmap);
+ g_object_unref (pixbuf);
return win;
}
@@ -972,7 +966,7 @@ ethi_unrealize (GnomeCanvasItem *item)
static void
ethi_draw (GnomeCanvasItem *item,
- GdkDrawable *drawable,
+ cairo_t *cr,
gint x,
gint y,
gint width,
@@ -1036,7 +1030,7 @@ ethi_draw (GnomeCanvasItem *item,
state = gtk_widget_get_state (GTK_WIDGET (canvas));
e_table_header_draw_button (
- drawable, ecol,
+ cr, ecol,
style, state, GTK_WIDGET (canvas),
x1 - x, -y, width, height,
x2 - x1, ethi->height,
@@ -1176,7 +1170,10 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event)
GdkDragContext *context;
ETableCol *ecol;
gint col_width;
- GdkPixmap *pixmap;
+ cairo_surface_t *s;
+ GdkPixbuf *pixbuf;
+ cairo_t *cr;
+
gint group_indent = 0;
GHashTable *arrows = g_hash_table_new (NULL, NULL);
GtkStateType state;
@@ -1236,26 +1233,29 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event)
ecol = e_table_header_get_column (ethi->eth, ethi->drag_col);
col_width = ecol->width;
- pixmap = gdk_pixmap_new (window, col_width, ethi->height, -1);
+ s = cairo_image_surface_create (CAIRO_FORMAT_A1, col_width, ethi->height);
+ cr = cairo_create (s);
+ pixbuf = gdk_pixbuf_get_from_surface(s,
+ 0, 0,
+ col_width, ethi->height);
state = gtk_widget_get_state (widget);
e_table_header_draw_button (
- pixmap, ecol,
+ cr, ecol,
style, state,
widget, 0, 0,
col_width, ethi->height,
col_width, ethi->height,
(ETableColArrow) g_hash_table_lookup (
arrows, GINT_TO_POINTER (ecol->col_idx)));
- gtk_drag_set_icon_pixmap (
+ gtk_drag_set_icon_pixbuf (
context,
- gdk_drawable_get_colormap (GDK_DRAWABLE (window)),
- pixmap,
- NULL,
+ pixbuf,
col_width / 2,
ethi->height / 2);
- g_object_unref (pixmap);
+ g_object_unref (pixbuf);
+ cairo_surface_destroy (s);
ethi->maybe_drag = FALSE;
g_hash_table_destroy (arrows);
diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c
index 56fa44a3c6..da60ce03d9 100644
--- a/widgets/table/e-table-header-utils.c
+++ b/widgets/table/e-table-header-utils.c
@@ -237,7 +237,7 @@ make_composite_pixmap (GdkDrawable *drawable, GdkGC *gc,
* Draws a button suitable for a table header.
**/
void
-e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
+e_table_header_draw_button (cairo_t *cr, ETableCol *ecol,
GtkStyle *style, GtkStateType state,
GtkWidget *widget,
gint x, gint y, gint width, gint height,
@@ -249,10 +249,9 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
gint inner_width, inner_height;
gint arrow_width = 0, arrow_height = 0;
PangoLayout *layout;
- cairo_t *cr;
static gpointer g_label = NULL;
- g_return_if_fail (drawable != NULL);
+ g_return_if_fail (cr != NULL);
g_return_if_fail (ecol != NULL);
g_return_if_fail (E_IS_TABLE_COL (ecol));
g_return_if_fail (style != NULL);
@@ -272,8 +271,7 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
gtk_widget_realize (g_label);
}
- cr = gdk_cairo_create (drawable);
-
+ cairo_save (cr);
gdk_cairo_set_source_color (cr, &gtk_widget_get_style (GTK_WIDGET (g_label))->fg[state]);
xthick = style->xthickness;
@@ -281,8 +279,8 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
/* Button bevel */
- gtk_paint_box (style, drawable, state, GTK_SHADOW_OUT,
- NULL, widget, "button",
+ gtk_paint_box (style, cr, state, GTK_SHADOW_OUT,
+ widget, "button",
x, y, button_width, button_height);
/* Inside area */
@@ -291,7 +289,7 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
inner_height = button_height - 2 * (ythick + HEADER_PADDING);
if (inner_width < 1 || inner_height < 1) {
- cairo_destroy (cr);
+ cairo_restore (cr);
return; /* nothing fits */
}
@@ -313,11 +311,12 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
inner_width -= arrow_width + HEADER_PADDING;
break;
default:
+ cairo_restore (cr);
g_return_if_reached ();
}
if (inner_width < 1) {
- cairo_destroy (cr);
+ cairo_restore (cr);
return; /* nothing else fits */
}
@@ -397,8 +396,8 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
if (ecol->icon_name == NULL)
inner_width += arrow_width + HEADER_PADDING;
- gtk_paint_arrow (style, drawable, state,
- GTK_SHADOW_NONE, NULL, widget, "header",
+ gtk_paint_arrow (style, cr, state,
+ GTK_SHADOW_NONE, widget, "header",
(arrow == E_TABLE_COL_ARROW_UP) ? GTK_ARROW_UP : GTK_ARROW_DOWN,
(ecol->icon_name == NULL),
inner_x + inner_width - arrow_width,
@@ -408,10 +407,10 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
}
default:
+ cairo_restore (cr);
g_return_if_reached ();
}
g_object_unref (layout);
-
- cairo_destroy (cr);
+ cairo_restore (cr);
}
diff --git a/widgets/table/e-table-header-utils.h b/widgets/table/e-table-header-utils.h
index 3ae11a4eca..cfa568bcdd 100644
--- a/widgets/table/e-table-header-utils.h
+++ b/widgets/table/e-table-header-utils.h
@@ -32,8 +32,8 @@ G_BEGIN_DECLS
gdouble e_table_header_compute_height (ETableCol *ecol,
GtkWidget *widget);
-gdouble e_table_header_width_extras (GtkStyle *style);
-void e_table_header_draw_button (GdkDrawable *drawable,
+gdouble e_table_header_width_extras (GtkStyle *style);
+void e_table_header_draw_button (cairo_t *cr,
ETableCol*ecol,
GtkStyle *style,
GtkStateType state,