This commit fixes binary compatibility, which I broke with my recent cell
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.
This commit is contained in:
parent
f5e0470f6f
commit
74295aeddf
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
|||||||
|
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>
|
Fri Apr 26 21:42:02 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
|
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
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>
|
Fri Apr 26 21:42:02 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
|
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
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>
|
Fri Apr 26 21:42:02 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
|
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
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>
|
Fri Apr 26 21:42:02 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
|
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
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>
|
Fri Apr 26 21:42:02 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
|
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
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>
|
Fri Apr 26 21:42:02 2002 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
|
* gdk/x11/gdkdrawable-x11.h: include X11/Xlib.h, fixes the build
|
||||||
|
@ -51,6 +51,13 @@ enum {
|
|||||||
PROP_CELL_BACKGROUND_SET
|
PROP_CELL_BACKGROUND_SET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define CELLINFO_KEY "gtk-cell-renderer-info"
|
||||||
|
|
||||||
|
typedef struct _GtkCellRendererInfo GtkCellRendererInfo;
|
||||||
|
struct _GtkCellRendererInfo
|
||||||
|
{
|
||||||
|
GdkColor cell_background;
|
||||||
|
};
|
||||||
|
|
||||||
GtkType
|
GtkType
|
||||||
gtk_cell_renderer_get_type (void)
|
gtk_cell_renderer_get_type (void)
|
||||||
@ -81,6 +88,8 @@ gtk_cell_renderer_get_type (void)
|
|||||||
static void
|
static void
|
||||||
gtk_cell_renderer_init (GtkCellRenderer *cell)
|
gtk_cell_renderer_init (GtkCellRenderer *cell)
|
||||||
{
|
{
|
||||||
|
GtkCellRendererInfo *cellinfo;
|
||||||
|
|
||||||
cell->mode = GTK_CELL_RENDERER_MODE_INERT;
|
cell->mode = GTK_CELL_RENDERER_MODE_INERT;
|
||||||
cell->visible = TRUE;
|
cell->visible = TRUE;
|
||||||
cell->width = -1;
|
cell->width = -1;
|
||||||
@ -89,6 +98,9 @@ gtk_cell_renderer_init (GtkCellRenderer *cell)
|
|||||||
cell->yalign = 0.5;
|
cell->yalign = 0.5;
|
||||||
cell->xpad = 0;
|
cell->xpad = 0;
|
||||||
cell->ypad = 0;
|
cell->ypad = 0;
|
||||||
|
|
||||||
|
cellinfo = g_new0 (GtkCellRendererInfo, 1);
|
||||||
|
g_object_set_data_full (G_OBJECT (cell), CELLINFO_KEY, cellinfo, g_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -237,6 +249,7 @@ gtk_cell_renderer_get_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
|
GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
|
||||||
|
GtkCellRendererInfo *cellinfo = g_object_get_data (object, CELLINFO_KEY);
|
||||||
|
|
||||||
switch (param_id)
|
switch (param_id)
|
||||||
{
|
{
|
||||||
@ -274,9 +287,9 @@ gtk_cell_renderer_get_property (GObject *object,
|
|||||||
{
|
{
|
||||||
GdkColor color;
|
GdkColor color;
|
||||||
|
|
||||||
color.red = cell->cell_background.red;
|
color.red = cellinfo->cell_background.red;
|
||||||
color.green = cell->cell_background.green;
|
color.green = cellinfo->cell_background.green;
|
||||||
color.blue = cell->cell_background.blue;
|
color.blue = cellinfo->cell_background.blue;
|
||||||
|
|
||||||
g_value_set_boxed (value, &color);
|
g_value_set_boxed (value, &color);
|
||||||
}
|
}
|
||||||
@ -362,6 +375,8 @@ static void
|
|||||||
set_cell_bg_color (GtkCellRenderer *cell,
|
set_cell_bg_color (GtkCellRenderer *cell,
|
||||||
GdkColor *color)
|
GdkColor *color)
|
||||||
{
|
{
|
||||||
|
GtkCellRendererInfo *cellinfo = g_object_get_data (G_OBJECT (cell), CELLINFO_KEY);
|
||||||
|
|
||||||
if (color)
|
if (color)
|
||||||
{
|
{
|
||||||
if (!cell->cell_background_set)
|
if (!cell->cell_background_set)
|
||||||
@ -370,9 +385,9 @@ set_cell_bg_color (GtkCellRenderer *cell,
|
|||||||
g_object_notify (G_OBJECT (cell), "cell_background_set");
|
g_object_notify (G_OBJECT (cell), "cell_background_set");
|
||||||
}
|
}
|
||||||
|
|
||||||
cell->cell_background.red = color->red;
|
cellinfo->cell_background.red = color->red;
|
||||||
cell->cell_background.green = color->green;
|
cellinfo->cell_background.green = color->green;
|
||||||
cell->cell_background.blue = color->blue;
|
cellinfo->cell_background.blue = color->blue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -459,6 +474,7 @@ gtk_cell_renderer_render (GtkCellRenderer *cell,
|
|||||||
GtkCellRendererState flags)
|
GtkCellRendererState flags)
|
||||||
{
|
{
|
||||||
gboolean selected = FALSE;
|
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_IS_CELL_RENDERER (cell));
|
||||||
g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->render != NULL);
|
g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->render != NULL);
|
||||||
@ -470,9 +486,9 @@ gtk_cell_renderer_render (GtkCellRenderer *cell,
|
|||||||
GdkColor color;
|
GdkColor color;
|
||||||
GdkGC *gc;
|
GdkGC *gc;
|
||||||
|
|
||||||
color.red = cell->cell_background.red;
|
color.red = cellinfo->cell_background.red;
|
||||||
color.green = cell->cell_background.green;
|
color.green = cellinfo->cell_background.green;
|
||||||
color.blue = cell->cell_background.blue;
|
color.blue = cellinfo->cell_background.blue;
|
||||||
|
|
||||||
gc = gdk_gc_new (window);
|
gc = gdk_gc_new (window);
|
||||||
gdk_gc_set_rgb_fg_color (gc, &color);
|
gdk_gc_set_rgb_fg_color (gc, &color);
|
||||||
|
@ -69,10 +69,7 @@ struct _GtkCellRenderer
|
|||||||
guint visible : 1;
|
guint visible : 1;
|
||||||
guint is_expander : 1;
|
guint is_expander : 1;
|
||||||
guint is_expanded : 1;
|
guint is_expanded : 1;
|
||||||
|
|
||||||
guint cell_background_set : 1;
|
guint cell_background_set : 1;
|
||||||
|
|
||||||
GdkColor cell_background;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkCellRendererClass
|
struct _GtkCellRendererClass
|
||||||
|
@ -62,6 +62,15 @@ enum {
|
|||||||
|
|
||||||
static gpointer parent_class;
|
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
|
GtkType
|
||||||
gtk_cell_renderer_pixbuf_get_type (void)
|
gtk_cell_renderer_pixbuf_get_type (void)
|
||||||
@ -92,7 +101,11 @@ gtk_cell_renderer_pixbuf_get_type (void)
|
|||||||
static void
|
static void
|
||||||
gtk_cell_renderer_pixbuf_init (GtkCellRendererPixbuf *cellpixbuf)
|
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
|
static void
|
||||||
@ -169,15 +182,19 @@ static void
|
|||||||
gtk_cell_renderer_pixbuf_finalize (GObject *object)
|
gtk_cell_renderer_pixbuf_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
GtkCellRendererPixbuf *cellpixbuf = GTK_CELL_RENDERER_PIXBUF (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);
|
g_object_unref (cellpixbuf->pixbuf);
|
||||||
|
|
||||||
if (cellpixbuf->stock_id)
|
if (cellinfo->stock_id)
|
||||||
g_free (cellpixbuf->stock_id);
|
g_free (cellinfo->stock_id);
|
||||||
|
|
||||||
if (cellpixbuf->stock_detail)
|
if (cellinfo->stock_detail)
|
||||||
g_free (cellpixbuf->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);
|
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
|
||||||
}
|
}
|
||||||
@ -189,6 +206,7 @@ gtk_cell_renderer_pixbuf_get_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkCellRendererPixbuf *cellpixbuf = GTK_CELL_RENDERER_PIXBUF (object);
|
GtkCellRendererPixbuf *cellpixbuf = GTK_CELL_RENDERER_PIXBUF (object);
|
||||||
|
GtkCellRendererPixbufInfo *cellinfo = g_object_get_data (object, CELLINFO_KEY);
|
||||||
|
|
||||||
switch (param_id)
|
switch (param_id)
|
||||||
{
|
{
|
||||||
@ -205,13 +223,13 @@ gtk_cell_renderer_pixbuf_get_property (GObject *object,
|
|||||||
cellpixbuf->pixbuf_expander_closed ? G_OBJECT (cellpixbuf->pixbuf_expander_closed) : NULL);
|
cellpixbuf->pixbuf_expander_closed ? G_OBJECT (cellpixbuf->pixbuf_expander_closed) : NULL);
|
||||||
break;
|
break;
|
||||||
case PROP_STOCK_ID:
|
case PROP_STOCK_ID:
|
||||||
g_value_set_string (value, cellpixbuf->stock_id);
|
g_value_set_string (value, cellinfo->stock_id);
|
||||||
break;
|
break;
|
||||||
case PROP_STOCK_SIZE:
|
case PROP_STOCK_SIZE:
|
||||||
g_value_set_enum (value, cellpixbuf->stock_size);
|
g_value_set_enum (value, cellinfo->stock_size);
|
||||||
break;
|
break;
|
||||||
case PROP_STOCK_DETAIL:
|
case PROP_STOCK_DETAIL:
|
||||||
g_value_set_string (value, cellpixbuf->stock_detail);
|
g_value_set_string (value, cellinfo->stock_detail);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||||
@ -228,6 +246,7 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
|
|||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GtkCellRendererPixbuf *cellpixbuf = GTK_CELL_RENDERER_PIXBUF (object);
|
GtkCellRendererPixbuf *cellpixbuf = GTK_CELL_RENDERER_PIXBUF (object);
|
||||||
|
GtkCellRendererPixbufInfo *cellinfo = g_object_get_data (object, CELLINFO_KEY);
|
||||||
|
|
||||||
switch (param_id)
|
switch (param_id)
|
||||||
{
|
{
|
||||||
@ -256,19 +275,19 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
|
|||||||
cellpixbuf->pixbuf_expander_closed = pixbuf;
|
cellpixbuf->pixbuf_expander_closed = pixbuf;
|
||||||
break;
|
break;
|
||||||
case PROP_STOCK_ID:
|
case PROP_STOCK_ID:
|
||||||
if (cellpixbuf->stock_id)
|
if (cellinfo->stock_id)
|
||||||
g_free (cellpixbuf->stock_id);
|
g_free (cellinfo->stock_id);
|
||||||
cellpixbuf->stock_id = g_strdup (g_value_get_string (value));
|
cellinfo->stock_id = g_strdup (g_value_get_string (value));
|
||||||
g_object_notify (G_OBJECT (object), "stock_id");
|
g_object_notify (G_OBJECT (object), "stock_id");
|
||||||
break;
|
break;
|
||||||
case PROP_STOCK_SIZE:
|
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");
|
g_object_notify (G_OBJECT (object), "stock_size");
|
||||||
break;
|
break;
|
||||||
case PROP_STOCK_DETAIL:
|
case PROP_STOCK_DETAIL:
|
||||||
if (cellpixbuf->stock_detail)
|
if (cellinfo->stock_detail)
|
||||||
g_free (cellpixbuf->stock_detail);
|
g_free (cellinfo->stock_detail);
|
||||||
cellpixbuf->stock_detail = g_strdup (g_value_get_string (value));
|
cellinfo->stock_detail = g_strdup (g_value_get_string (value));
|
||||||
g_object_notify (G_OBJECT (object), "stock_detail");
|
g_object_notify (G_OBJECT (object), "stock_detail");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -276,7 +295,7 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cellpixbuf->pixbuf && cellpixbuf->stock_id)
|
if (cellpixbuf->pixbuf && cellinfo->stock_id)
|
||||||
{
|
{
|
||||||
g_object_unref (cellpixbuf->pixbuf);
|
g_object_unref (cellpixbuf->pixbuf);
|
||||||
cellpixbuf->pixbuf = NULL;
|
cellpixbuf->pixbuf = NULL;
|
||||||
@ -306,13 +325,15 @@ static void
|
|||||||
gtk_cell_renderer_pixbuf_create_stock_pixbuf (GtkCellRendererPixbuf *cellpixbuf,
|
gtk_cell_renderer_pixbuf_create_stock_pixbuf (GtkCellRendererPixbuf *cellpixbuf,
|
||||||
GtkWidget *widget)
|
GtkWidget *widget)
|
||||||
{
|
{
|
||||||
|
GtkCellRendererPixbufInfo *cellinfo = g_object_get_data (G_OBJECT (cellpixbuf), CELLINFO_KEY);
|
||||||
|
|
||||||
if (cellpixbuf->pixbuf)
|
if (cellpixbuf->pixbuf)
|
||||||
g_object_unref (G_OBJECT (cellpixbuf->pixbuf));
|
g_object_unref (G_OBJECT (cellpixbuf->pixbuf));
|
||||||
|
|
||||||
cellpixbuf->pixbuf = gtk_widget_render_icon (widget,
|
cellpixbuf->pixbuf = gtk_widget_render_icon (widget,
|
||||||
cellpixbuf->stock_id,
|
cellinfo->stock_id,
|
||||||
cellpixbuf->stock_size,
|
cellinfo->stock_size,
|
||||||
cellpixbuf->stock_detail);
|
cellinfo->stock_detail);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -325,12 +346,13 @@ gtk_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
|
|||||||
gint *height)
|
gint *height)
|
||||||
{
|
{
|
||||||
GtkCellRendererPixbuf *cellpixbuf = (GtkCellRendererPixbuf *) cell;
|
GtkCellRendererPixbuf *cellpixbuf = (GtkCellRendererPixbuf *) cell;
|
||||||
|
GtkCellRendererPixbufInfo *cellinfo = g_object_get_data (G_OBJECT (cell), CELLINFO_KEY);
|
||||||
gint pixbuf_width = 0;
|
gint pixbuf_width = 0;
|
||||||
gint pixbuf_height = 0;
|
gint pixbuf_height = 0;
|
||||||
gint calc_width;
|
gint calc_width;
|
||||||
gint calc_height;
|
gint calc_height;
|
||||||
|
|
||||||
if (!cellpixbuf->pixbuf && cellpixbuf->stock_id)
|
if (!cellpixbuf->pixbuf && cellinfo->stock_id)
|
||||||
gtk_cell_renderer_pixbuf_create_stock_pixbuf (cellpixbuf, widget);
|
gtk_cell_renderer_pixbuf_create_stock_pixbuf (cellpixbuf, widget);
|
||||||
|
|
||||||
if (cellpixbuf->pixbuf)
|
if (cellpixbuf->pixbuf)
|
||||||
@ -387,6 +409,7 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
|
|||||||
|
|
||||||
{
|
{
|
||||||
GtkCellRendererPixbuf *cellpixbuf = (GtkCellRendererPixbuf *) cell;
|
GtkCellRendererPixbuf *cellpixbuf = (GtkCellRendererPixbuf *) cell;
|
||||||
|
GtkCellRendererPixbufInfo *cellinfo = g_object_get_data (G_OBJECT (cell), CELLINFO_KEY);
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GdkRectangle pix_rect;
|
GdkRectangle pix_rect;
|
||||||
GdkRectangle draw_rect;
|
GdkRectangle draw_rect;
|
||||||
@ -403,9 +426,9 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer *cell,
|
|||||||
pixbuf = cellpixbuf->pixbuf_expander_closed;
|
pixbuf = cellpixbuf->pixbuf_expander_closed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pixbuf && !cellpixbuf->stock_id)
|
if (!pixbuf && !cellinfo->stock_id)
|
||||||
return;
|
return;
|
||||||
else if (!pixbuf && cellpixbuf->stock_id)
|
else if (!pixbuf && cellinfo->stock_id)
|
||||||
stock_pixbuf = TRUE;
|
stock_pixbuf = TRUE;
|
||||||
|
|
||||||
gtk_cell_renderer_pixbuf_get_size (cell, widget, cell_area,
|
gtk_cell_renderer_pixbuf_get_size (cell, widget, cell_area,
|
||||||
|
@ -45,10 +45,6 @@ struct _GtkCellRendererPixbuf
|
|||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GdkPixbuf *pixbuf_expander_open;
|
GdkPixbuf *pixbuf_expander_open;
|
||||||
GdkPixbuf *pixbuf_expander_closed;
|
GdkPixbuf *pixbuf_expander_closed;
|
||||||
|
|
||||||
gchar *stock_id;
|
|
||||||
GtkIconSize stock_size;
|
|
||||||
gchar *stock_detail;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkCellRendererPixbufClass
|
struct _GtkCellRendererPixbufClass
|
||||||
|
Loading…
Reference in New Issue
Block a user