[evolution/gtk3] Adapt deprecated GdkPixmap API to gtk+-3.0 changes
- From: Vibha Yadav <yvibha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gtk3] Adapt deprecated GdkPixmap API to gtk+-3.0 changes
- Date: Mon, 13 Dec 2010 11:24:36 +0000 (UTC)
commit b96aae77b2d496e77c8d0c2b85cfe20af36d3e37
Author: Vibha Yadav <yvibha novell com>
Date: Mon Dec 13 15:26:31 2010 +0530
Adapt deprecated GdkPixmap API to gtk+-3.0 changes
Instead of using deprecated GdkPixmap API, using cairo_surface_t and
pixbuf API for getting images.
calendar/gui/e-day-view.c | 2 +-
calendar/gui/e-meeting-time-sel.c | 4 ++--
mail/em-folder-tree.c | 8 +++-----
widgets/table/e-table-header-item.c | 22 ++++++++++++++--------
widgets/table/e-table-header-utils.c | 14 ++++++--------
widgets/table/e-table-item.c | 6 +-----
widgets/table/e-table.c | 27 ++++++++++++---------------
widgets/table/e-tree.c | 13 +++++--------
8 files changed, 44 insertions(+), 52 deletions(-)
---
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 551173b..a3ccc42 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -1265,7 +1265,7 @@ e_day_view_on_canvas_realized (GtkWidget *widget,
GdkWindow *window;
window = gtk_layout_get_bin_window (GTK_LAYOUT (widget));
- gdk_window_set_back_pixmap (window, NULL, FALSE);
+ gdk_window_set_background_pattern (window, NULL);
}
/**
diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c
index f774a1d..142927f 100644
--- a/calendar/gui/e-meeting-time-sel.c
+++ b/calendar/gui/e-meeting-time-sel.c
@@ -911,7 +911,7 @@ e_meeting_time_selector_expose_key_color (GtkWidget *darea,
gtk_paint_shadow (
style, window_cr, GTK_STATE_NORMAL,
- GTK_SHADOW_IN, NULL, NULL, NULL, 0, 0,
+ GTK_SHADOW_IN, NULL, NULL, 0, 0,
allocation.width, allocation.height);
cr = gdk_cairo_create (event->window);
@@ -2453,7 +2453,7 @@ e_meeting_time_selector_on_canvas_realized (GtkWidget *widget,
GdkWindow *window;
window = gtk_layout_get_bin_window (GTK_LAYOUT (widget));
- gdk_window_set_back_pixmap (window, NULL, FALSE);
+ gdk_window_set_background_pattern (window, NULL);
}
/* This is called when the meeting start time GnomeDateEdit is changed,
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 1a40973..d772cc9 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -1596,8 +1596,7 @@ tree_drag_begin (GtkWidget *widget,
EMFolderTreePrivate *priv = folder_tree->priv;
GtkTreeSelection *selection;
GtkTreeView *tree_view;
- GdkColormap *colormap;
- GdkPixmap *pixmap;
+ cairo_surface_t *s;
GtkTreeModel *model;
GtkTreePath *path;
GtkTreeIter iter;
@@ -1610,9 +1609,8 @@ tree_drag_begin (GtkWidget *widget,
path = gtk_tree_model_get_path (model, &iter);
priv->drag_row = gtk_tree_row_reference_new (model, path);
- pixmap = gtk_tree_view_create_row_drag_icon (tree_view, path);
- colormap = gdk_drawable_get_colormap (pixmap);
- gtk_drag_set_icon_pixmap (context, colormap, pixmap, NULL, 0, 0);
+ s = gtk_tree_view_create_row_drag_icon (tree_view, path);
+ gtk_drag_set_icon_surface (context, s);
gtk_tree_path_free (path);
}
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index 44bfa8d..857d50c 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -1173,7 +1173,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;
@@ -1233,26 +1236,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 56fa44a..9509816 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,7 +271,6 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
gtk_widget_realize (g_label);
}
- cr = gdk_cairo_create (drawable);
gdk_cairo_set_source_color (cr, >k_widget_get_style (GTK_WIDGET (g_label))->fg[state]);
@@ -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 */
@@ -397,8 +395,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,
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 7c45bbe..0f43d72 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -271,8 +271,6 @@ eti_get_cell_background_color (ETableItem *eti, gint row, gint col, gboolean sel
if (color_spec != NULL) {
if (gdk_color_parse (color_spec, &bg)) {
background = gdk_color_copy (&bg);
- gdk_colormap_alloc_color (gtk_widget_get_colormap (canvas), background,
- FALSE, TRUE);
allocated = TRUE;
}
}
@@ -286,8 +284,6 @@ eti_get_cell_background_color (ETableItem *eti, gint row, gint col, gboolean sel
allocated = TRUE;
}
e_hsv_tweak (background, 0.0f, 0.0f, -0.07f);
- gdk_colormap_alloc_color (gtk_widget_get_colormap (canvas), background,
- FALSE, TRUE);
}
}
if (allocatedp)
@@ -1958,7 +1954,7 @@ eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gint x, gint y, gint wid
break;
}
- e_cell_draw (ecell_view, drawable, ecol->col_idx, col, row, flags,
+ e_cell_draw (ecell_view, cr, ecol->col_idx, col, row, flags,
xd, yd, xd + ecol->width, yd + height);
if (!f_found && !selected) {
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 4cbd655..bef1897 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -2585,9 +2585,7 @@ struct _ETableDragSourceSite
GdkModifierType start_button_mask;
GtkTargetList *target_list; /* Targets for drag data */
GdkDragAction actions; /* Possible actions */
- GdkColormap *colormap; /* Colormap for drag icon */
- GdkPixmap *pixmap; /* Icon for drag data */
- GdkBitmap *mask;
+ GdkPixbuf *pixbuf; /* Icon for drag data */
/* Stored button press information to detect drag beginning */
gint state;
@@ -2824,11 +2822,10 @@ et_real_start_drag (ETable *table, gint row, gint col, GdkEvent *event)
info = g_dataset_get_data (context, "gtk-info");
if (info && !info->icon_window) {
- if (site->pixmap)
- gtk_drag_set_icon_pixmap (context,
- site->colormap,
- site->pixmap,
- site->mask, -2, -2);
+ if (site->pixbuf)
+ gtk_drag_set_icon_pixbuf (context,
+ site->pixbuf,
+ -2, -2);
else
gtk_drag_set_icon_default (context);
}
@@ -3470,13 +3467,13 @@ e_table_class_init (ETableClass *class)
class->set_scroll_adjustments = set_scroll_adjustments;
widget_class->set_scroll_adjustments_signal =
- g_signal_new ("set_scroll_adjustments",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, set_scroll_adjustments),
- NULL, NULL,
- e_marshal_NONE__OBJECT_OBJECT,
- G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
+ g_signal_new ("set_scroll_adjustments",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClass, set_scroll_adjustments),
+ NULL, NULL,
+ e_marshal_NONE__OBJECT_OBJECT,
+ G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
g_object_class_install_property (object_class, PROP_LENGTH_THRESHOLD,
g_param_spec_int ("length_threshold",
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index 5f0effa..b411e07 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -2388,9 +2388,7 @@ struct _ETreeDragSourceSite
GdkModifierType start_button_mask;
GtkTargetList *target_list; /* Targets for drag data */
GdkDragAction actions; /* Possible actions */
- GdkColormap *colormap; /* Colormap for drag icon */
- GdkPixmap *pixmap; /* Icon for drag data */
- GdkBitmap *mask;
+ GdkPixbuf *pixbuf; /* Icon for drag data */
/* Stored button press information to detect drag beginning */
gint state;
@@ -2611,11 +2609,10 @@ et_real_start_drag (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *e
info = g_dataset_get_data (context, "gtk-info");
if (info && !info->icon_window) {
- if (site->pixmap)
- gtk_drag_set_icon_pixmap (context,
- site->colormap,
- site->pixmap,
- site->mask, -2, -2);
+ if (site->pixbuf)
+ gtk_drag_set_icon_pixbuf (context,
+ site->pixbuf,
+ -2, -2);
else
gtk_drag_set_icon_default (context);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]