+Fri Apr 26 21:46:42 2002 Kristian Rietveld <kris@gtk.org>
+
+ This commit fixes binary compatibility, which I broke with my
+ recent cell renderer commits :/.
+
+ * gtk/gtkcellrenderer.h: move cell_background out of _GtkCellRenderer
+
+ * gtk/gtkcellrenderer.c: create GtkCellRendererInfo, with the
+ cell_background field and use this as object data. This way we keep
+ the field private and dont break ABI.
+
+ * gtk/gtkcellrendererpixbuf.h: remove stock_id, stock_size and
+ stock_detail from _GtkCellRendererPixbuf
+
+ * gtk/gtkcellrendererpixbuf.c: create a GtkCellRendererPixbufInfo
+ with above mentioned fields. And update everything.
+
Fri Apr 26 21:42:02 2002 Kristian Rietveld <kris@gtk.org>
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
+Fri Apr 26 21:46:42 2002 Kristian Rietveld <kris@gtk.org>
+
+ This commit fixes binary compatibility, which I broke with my
+ recent cell renderer commits :/.
+
+ * gtk/gtkcellrenderer.h: move cell_background out of _GtkCellRenderer
+
+ * gtk/gtkcellrenderer.c: create GtkCellRendererInfo, with the
+ cell_background field and use this as object data. This way we keep
+ the field private and dont break ABI.
+
+ * gtk/gtkcellrendererpixbuf.h: remove stock_id, stock_size and
+ stock_detail from _GtkCellRendererPixbuf
+
+ * gtk/gtkcellrendererpixbuf.c: create a GtkCellRendererPixbufInfo
+ with above mentioned fields. And update everything.
+
Fri Apr 26 21:42:02 2002 Kristian Rietveld <kris@gtk.org>
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
+Fri Apr 26 21:46:42 2002 Kristian Rietveld <kris@gtk.org>
+
+ This commit fixes binary compatibility, which I broke with my
+ recent cell renderer commits :/.
+
+ * gtk/gtkcellrenderer.h: move cell_background out of _GtkCellRenderer
+
+ * gtk/gtkcellrenderer.c: create GtkCellRendererInfo, with the
+ cell_background field and use this as object data. This way we keep
+ the field private and dont break ABI.
+
+ * gtk/gtkcellrendererpixbuf.h: remove stock_id, stock_size and
+ stock_detail from _GtkCellRendererPixbuf
+
+ * gtk/gtkcellrendererpixbuf.c: create a GtkCellRendererPixbufInfo
+ with above mentioned fields. And update everything.
+
Fri Apr 26 21:42:02 2002 Kristian Rietveld <kris@gtk.org>
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
+Fri Apr 26 21:46:42 2002 Kristian Rietveld <kris@gtk.org>
+
+ This commit fixes binary compatibility, which I broke with my
+ recent cell renderer commits :/.
+
+ * gtk/gtkcellrenderer.h: move cell_background out of _GtkCellRenderer
+
+ * gtk/gtkcellrenderer.c: create GtkCellRendererInfo, with the
+ cell_background field and use this as object data. This way we keep
+ the field private and dont break ABI.
+
+ * gtk/gtkcellrendererpixbuf.h: remove stock_id, stock_size and
+ stock_detail from _GtkCellRendererPixbuf
+
+ * gtk/gtkcellrendererpixbuf.c: create a GtkCellRendererPixbufInfo
+ with above mentioned fields. And update everything.
+
Fri Apr 26 21:42:02 2002 Kristian Rietveld <kris@gtk.org>
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
+Fri Apr 26 21:46:42 2002 Kristian Rietveld <kris@gtk.org>
+
+ This commit fixes binary compatibility, which I broke with my
+ recent cell renderer commits :/.
+
+ * gtk/gtkcellrenderer.h: move cell_background out of _GtkCellRenderer
+
+ * gtk/gtkcellrenderer.c: create GtkCellRendererInfo, with the
+ cell_background field and use this as object data. This way we keep
+ the field private and dont break ABI.
+
+ * gtk/gtkcellrendererpixbuf.h: remove stock_id, stock_size and
+ stock_detail from _GtkCellRendererPixbuf
+
+ * gtk/gtkcellrendererpixbuf.c: create a GtkCellRendererPixbufInfo
+ with above mentioned fields. And update everything.
+
Fri Apr 26 21:42:02 2002 Kristian Rietveld <kris@gtk.org>
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
+Fri Apr 26 21:46:42 2002 Kristian Rietveld <kris@gtk.org>
+
+ This commit fixes binary compatibility, which I broke with my
+ recent cell renderer commits :/.
+
+ * gtk/gtkcellrenderer.h: move cell_background out of _GtkCellRenderer
+
+ * gtk/gtkcellrenderer.c: create GtkCellRendererInfo, with the
+ cell_background field and use this as object data. This way we keep
+ the field private and dont break ABI.
+
+ * gtk/gtkcellrendererpixbuf.h: remove stock_id, stock_size and
+ stock_detail from _GtkCellRendererPixbuf
+
+ * gtk/gtkcellrendererpixbuf.c: create a GtkCellRendererPixbufInfo
+ with above mentioned fields. And update everything.
+
Fri Apr 26 21:42:02 2002 Kristian Rietveld <kris@gtk.org>
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
PROP_CELL_BACKGROUND_SET
};
+#define CELLINFO_KEY "gtk-cell-renderer-info"
+
+typedef struct _GtkCellRendererInfo GtkCellRendererInfo;
+struct _GtkCellRendererInfo
+{
+ GdkColor cell_background;
+};
GtkType
gtk_cell_renderer_get_type (void)
static void
gtk_cell_renderer_init (GtkCellRenderer *cell)
{
+ GtkCellRendererInfo *cellinfo;
+
cell->mode = GTK_CELL_RENDERER_MODE_INERT;
cell->visible = TRUE;
cell->width = -1;
cell->yalign = 0.5;
cell->xpad = 0;
cell->ypad = 0;
+
+ cellinfo = g_new0 (GtkCellRendererInfo, 1);
+ g_object_set_data_full (G_OBJECT (cell), CELLINFO_KEY, cellinfo, g_free);
}
static void
GParamSpec *pspec)
{
GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
+ GtkCellRendererInfo *cellinfo = g_object_get_data (object, CELLINFO_KEY);
switch (param_id)
{
{
GdkColor color;
- color.red = cell->cell_background.red;
- color.green = cell->cell_background.green;
- color.blue = cell->cell_background.blue;
+ color.red = cellinfo->cell_background.red;
+ color.green = cellinfo->cell_background.green;
+ color.blue = cellinfo->cell_background.blue;
g_value_set_boxed (value, &color);
}
set_cell_bg_color (GtkCellRenderer *cell,
GdkColor *color)
{
+ GtkCellRendererInfo *cellinfo = g_object_get_data (G_OBJECT (cell), CELLINFO_KEY);
+
if (color)
{
if (!cell->cell_background_set)
g_object_notify (G_OBJECT (cell), "cell_background_set");
}
- cell->cell_background.red = color->red;
- cell->cell_background.green = color->green;
- cell->cell_background.blue = color->blue;
+ cellinfo->cell_background.red = color->red;
+ cellinfo->cell_background.green = color->green;
+ cellinfo->cell_background.blue = color->blue;
}
else
{
GtkCellRendererState flags)
{
gboolean selected = FALSE;
+ GtkCellRendererInfo *cellinfo = g_object_get_data (G_OBJECT (cell), CELLINFO_KEY);
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->render != NULL);
GdkColor color;
GdkGC *gc;
- color.red = cell->cell_background.red;
- color.green = cell->cell_background.green;
- color.blue = cell->cell_background.blue;
+ color.red = cellinfo->cell_background.red;
+ color.green = cellinfo->cell_background.green;
+ color.blue = cellinfo->cell_background.blue;
gc = gdk_gc_new (window);
gdk_gc_set_rgb_fg_color (gc, &color);
guint visible : 1;
guint is_expander : 1;
guint is_expanded : 1;
-
guint cell_background_set : 1;
-
- GdkColor cell_background;
};
struct _GtkCellRendererClass
static gpointer parent_class;
+#define CELLINFO_KEY "gtk-cell-renderer-pixbuf-info"
+
+typedef struct _GtkCellRendererPixbufInfo GtkCellRendererPixbufInfo;
+struct _GtkCellRendererPixbufInfo
+{
+ gchar *stock_id;
+ GtkIconSize stock_size;
+ gchar *stock_detail;
+};
GtkType
gtk_cell_renderer_pixbuf_get_type (void)
static void
gtk_cell_renderer_pixbuf_init (GtkCellRendererPixbuf *cellpixbuf)
{
- cellpixbuf->stock_size = GTK_ICON_SIZE_MENU;
+ GtkCellRendererPixbufInfo *cellinfo;
+
+ cellinfo = g_new0 (GtkCellRendererPixbufInfo, 1);
+ cellinfo->stock_size = GTK_ICON_SIZE_MENU;
+ g_object_set_data (G_OBJECT (cellpixbuf), CELLINFO_KEY, cellinfo);
}
static void
gtk_cell_renderer_pixbuf_finalize (GObject *object)
{
GtkCellRendererPixbuf *cellpixbuf = GTK_CELL_RENDERER_PIXBUF (object);
+ GtkCellRendererPixbufInfo *cellinfo = g_object_get_data (object, CELLINFO_KEY);
- if (cellpixbuf->pixbuf && cellpixbuf->stock_id)
+ if (cellpixbuf->pixbuf && cellinfo->stock_id)
g_object_unref (cellpixbuf->pixbuf);
- if (cellpixbuf->stock_id)
- g_free (cellpixbuf->stock_id);
+ if (cellinfo->stock_id)
+ g_free (cellinfo->stock_id);
- if (cellpixbuf->stock_detail)
- g_free (cellpixbuf->stock_detail);
+ if (cellinfo->stock_detail)
+ g_free (cellinfo->stock_detail);
+
+ g_free (cellinfo);
+ g_object_set_data (object, CELLINFO_KEY, NULL);
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
GParamSpec *pspec)
{
GtkCellRendererPixbuf *cellpixbuf = GTK_CELL_RENDERER_PIXBUF (object);
+ GtkCellRendererPixbufInfo *cellinfo = g_object_get_data (object, CELLINFO_KEY);
switch (param_id)
{
cellpixbuf->pixbuf_expander_closed ? G_OBJECT (cellpixbuf->pixbuf_expander_closed) : NULL);
break;
case PROP_STOCK_ID:
- g_value_set_string (value, cellpixbuf->stock_id);
+ g_value_set_string (value, cellinfo->stock_id);
break;
case PROP_STOCK_SIZE:
- g_value_set_enum (value, cellpixbuf->stock_size);
+ g_value_set_enum (value, cellinfo->stock_size);
break;
case PROP_STOCK_DETAIL:
- g_value_set_string (value, cellpixbuf->stock_detail);
+ g_value_set_string (value, cellinfo->stock_detail);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
{
GdkPixbuf *pixbuf;
GtkCellRendererPixbuf *cellpixbuf = GTK_CELL_RENDERER_PIXBUF (object);
+ GtkCellRendererPixbufInfo *cellinfo = g_object_get_data (object, CELLINFO_KEY);
switch (param_id)
{
cellpixbuf->pixbuf_expander_closed = pixbuf;
break;
case PROP_STOCK_ID:
- if (cellpixbuf->stock_id)
- g_free (cellpixbuf->stock_id);
- cellpixbuf->stock_id = g_strdup (g_value_get_string (value));
+ if (cellinfo->stock_id)
+ g_free (cellinfo->stock_id);
+ cellinfo->stock_id = g_strdup (g_value_get_string (value));
g_object_notify (G_OBJECT (object), "stock_id");
break;
case PROP_STOCK_SIZE:
- cellpixbuf->stock_size = g_value_get_enum (value);
+ cellinfo->stock_size = g_value_get_enum (value);
g_object_notify (G_OBJECT (object), "stock_size");
break;
case PROP_STOCK_DETAIL:
- if (cellpixbuf->stock_detail)
- g_free (cellpixbuf->stock_detail);
- cellpixbuf->stock_detail = g_strdup (g_value_get_string (value));
+ if (cellinfo->stock_detail)
+ g_free (cellinfo->stock_detail);
+ cellinfo->stock_detail = g_strdup (g_value_get_string (value));
g_object_notify (G_OBJECT (object), "stock_detail");
break;
default:
break;
}
- if (cellpixbuf->pixbuf && cellpixbuf->stock_id)
+ if (cellpixbuf->pixbuf && cellinfo->stock_id)
{
g_object_unref (cellpixbuf->pixbuf);
cellpixbuf->pixbuf = NULL;
gtk_cell_renderer_pixbuf_create_stock_pixbuf (GtkCellRendererPixbuf *cellpixbuf,
GtkWidget *widget)
{
+ GtkCellRendererPixbufInfo *cellinfo = g_object_get_data (G_OBJECT (cellpixbuf), CELLINFO_KEY);
+
if (cellpixbuf->pixbuf)
g_object_unref (G_OBJECT (cellpixbuf->pixbuf));
cellpixbuf->pixbuf = gtk_widget_render_icon (widget,
- cellpixbuf->stock_id,
- cellpixbuf->stock_size,
- cellpixbuf->stock_detail);
+ cellinfo->stock_id,
+ cellinfo->stock_size,
+ cellinfo->stock_detail);
}
static void
gint *height)
{
GtkCellRendererPixbuf *cellpixbuf = (GtkCellRendererPixbuf *) cell;
+ GtkCellRendererPixbufInfo *cellinfo = g_object_get_data (G_OBJECT (cell), CELLINFO_KEY);
gint pixbuf_width = 0;
gint pixbuf_height = 0;
gint calc_width;
gint calc_height;
- if (!cellpixbuf->pixbuf && cellpixbuf->stock_id)
+ if (!cellpixbuf->pixbuf && cellinfo->stock_id)
gtk_cell_renderer_pixbuf_create_stock_pixbuf (cellpixbuf, widget);
if (cellpixbuf->pixbuf)
{
GtkCellRendererPixbuf *cellpixbuf = (GtkCellRendererPixbuf *) cell;
+ GtkCellRendererPixbufInfo *cellinfo = g_object_get_data (G_OBJECT (cell), CELLINFO_KEY);
GdkPixbuf *pixbuf;
GdkRectangle pix_rect;
GdkRectangle draw_rect;
pixbuf = cellpixbuf->pixbuf_expander_closed;
}
- if (!pixbuf && !cellpixbuf->stock_id)
+ if (!pixbuf && !cellinfo->stock_id)
return;
- else if (!pixbuf && cellpixbuf->stock_id)
+ else if (!pixbuf && cellinfo->stock_id)
stock_pixbuf = TRUE;
gtk_cell_renderer_pixbuf_get_size (cell, widget, cell_area,
pix_rect.y += cell_area->y;
pix_rect.width -= cell->xpad * 2;
pix_rect.height -= cell->ypad * 2;
-
+
if (gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect))
gdk_pixbuf_render_to_drawable_alpha (pixbuf,
window,
GdkPixbuf *pixbuf;
GdkPixbuf *pixbuf_expander_open;
GdkPixbuf *pixbuf_expander_closed;
-
- gchar *stock_id;
- GtkIconSize stock_size;
- gchar *stock_detail;
};
struct _GtkCellRendererPixbufClass