diff options
Diffstat (limited to 'widgets/table')
-rw-r--r-- | widgets/table/e-cell-pixbuf.c | 50 |
1 files changed, 17 insertions, 33 deletions
diff --git a/widgets/table/e-cell-pixbuf.c b/widgets/table/e-cell-pixbuf.c index 9b829fbc0b..3014c45019 100644 --- a/widgets/table/e-cell-pixbuf.c +++ b/widgets/table/e-cell-pixbuf.c @@ -17,7 +17,6 @@ typedef struct _ECellPixbufView ECellPixbufView; struct _ECellPixbufView { ECellView cell_view; - GdkGC *gc; GnomeCanvas *canvas; }; @@ -71,27 +70,10 @@ pixbuf_kill_view (ECellView *ecell_view) } static void -pixbuf_realize (ECellView *ecell_view) -{ - ECellPixbufView *pixbuf_view = (ECellPixbufView *) ecell_view; - - pixbuf_view->gc = gdk_gc_new (GTK_WIDGET (pixbuf_view->canvas)->window); -} - -static void -pixbuf_unrealize (ECellView *ecell_view) -{ - ECellPixbufView *pixbuf_view = (ECellPixbufView *) ecell_view; - - gdk_gc_unref (pixbuf_view->gc); -} - -static void pixbuf_draw (ECellView *ecell_view, GdkDrawable *drawable, int model_col, int view_col, int row, ECellFlags flags, int x1, int y1, int x2, int y2) { - ECellPixbufView *pixbuf_view = (ECellPixbufView *) ecell_view; GdkPixbuf *cell_pixbuf; int real_x, real_y, real_w, real_h; int pix_w, pix_h; @@ -103,6 +85,9 @@ pixbuf_draw (ECellView *ecell_view, GdkDrawable *drawable, if (x2 - x1 == 0) return; + if (!cell_pixbuf) + return; + pix_w = gdk_pixbuf_get_width (cell_pixbuf); pix_h = gdk_pixbuf_get_height (cell_pixbuf); @@ -126,14 +111,15 @@ pixbuf_draw (ECellView *ecell_view, GdkDrawable *drawable, } - gdk_pixbuf_render_to_drawable (cell_pixbuf, - drawable, - pixbuf_view->gc, - 0, 0, - real_x, real_y, - real_w, real_h, - GDK_RGB_DITHER_NORMAL, - 0, 0); + gdk_pixbuf_render_to_drawable_alpha (cell_pixbuf, + drawable, + 0, 0, + real_x, real_y, + real_w, real_h, + GDK_PIXBUF_ALPHA_BILEVEL, + 127, + GDK_RGB_DITHER_NORMAL, + 0, 0); } static gint @@ -152,11 +138,8 @@ pixbuf_height (ECellView *ecell_view, int model_col, int view_col, int row) GdkPixbuf *pixbuf; pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, model_col, row); - if (!pixbuf) { - /* ??? */ - g_warning ("e-cell-pixbuf: height with NULL pixbuf at %d %d %d\n", model_col, view_col, row); + if (!pixbuf) return 0; - } /* We give ourselves 3 pixels of padding on either side */ return gdk_pixbuf_get_height (pixbuf) + 6; @@ -165,6 +148,7 @@ pixbuf_height (ECellView *ecell_view, int model_col, int view_col, int row) static gint pixbuf_max_width (ECellView *ecell_view, int model_col, int view_col) { + int pw; gint num_rows, i; gint max_width = -1; @@ -176,7 +160,9 @@ pixbuf_max_width (ECellView *ecell_view, int model_col, int view_col) (ecell_view->e_table_model, model_col, i); - int pw = gdk_pixbuf_get_width (pixbuf); + if (!pixbuf) + continue; + pw = gdk_pixbuf_get_width (pixbuf); if (max_width < pw) max_width = pw; } @@ -208,8 +194,6 @@ e_cell_pixbuf_class_init (GtkObjectClass *object_class) ecc->new_view = pixbuf_new_view; ecc->kill_view = pixbuf_kill_view; - ecc->realize = pixbuf_realize; - ecc->unrealize = pixbuf_unrealize; ecc->draw = pixbuf_draw; ecc->event = pixbuf_event; ecc->height = pixbuf_height; |