[gtk+] Support resetting cell renderer colors with NULL again
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Support resetting cell renderer colors with NULL again
- Date: Mon, 25 Oct 2010 15:18:48 +0000 (UTC)
commit 503698f5874fef49d54f68f96306f4734f94833c
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Oct 25 11:17:24 2010 -0400
Support resetting cell renderer colors with NULL again
This functionality was lost when GdkRGBA was introduced.
Bug 632936
gtk/gtkcellrenderer.c | 44 ++++++++++++++++++++++++++------------------
gtk/gtkcellrenderertext.c | 38 ++++++++++++++++++++++++++++----------
2 files changed, 54 insertions(+), 28 deletions(-)
---
diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c
index 8da6f96..3656599 100644
--- a/gtk/gtkcellrenderer.c
+++ b/gtk/gtkcellrenderer.c
@@ -493,28 +493,36 @@ gtk_cell_renderer_set_property (GObject *object,
{
GdkRGBA rgba;
- if (!g_value_get_string (value))
- set_cell_bg_color (cell, NULL);
- else if (gdk_rgba_parse (g_value_get_string (value), &rgba))
- set_cell_bg_color (cell, &rgba);
- else
- g_warning ("Don't know color `%s'", g_value_get_string (value));
-
- g_object_notify (object, "cell-background-gdk");
+ if (!g_value_get_string (value))
+ set_cell_bg_color (cell, NULL);
+ else if (gdk_rgba_parse (g_value_get_string (value), &rgba))
+ set_cell_bg_color (cell, &rgba);
+ else
+ g_warning ("Don't know color `%s'", g_value_get_string (value));
+
+ g_object_notify (object, "cell-background-gdk");
}
break;
case PROP_CELL_BACKGROUND_GDK:
{
GdkColor *color;
- GdkRGBA rgba;
color = g_value_get_boxed (value);
- rgba.red = color->red / 65535.;
- rgba.green = color->green / 65535.;
- rgba.blue = color->blue / 65535.;
- rgba.alpha = 1;
-
- set_cell_bg_color (cell, &rgba);
+ if (color)
+ {
+ GdkRGBA rgba;
+
+ rgba.red = color->red / 65535.;
+ rgba.green = color->green / 65535.;
+ rgba.blue = color->blue / 65535.;
+ rgba.alpha = 1;
+
+ set_cell_bg_color (cell, &rgba);
+ }
+ else
+ {
+ set_cell_bg_color (cell, NULL);
+ }
}
break;
case PROP_CELL_BACKGROUND_RGBA:
@@ -539,9 +547,9 @@ set_cell_bg_color (GtkCellRenderer *cell,
{
if (!priv->cell_background_set)
{
- priv->cell_background_set = TRUE;
- g_object_notify (G_OBJECT (cell), "cell-background-set");
- }
+ priv->cell_background_set = TRUE;
+ g_object_notify (G_OBJECT (cell), "cell-background-set");
+ }
priv->cell_background = *rgba;
}
diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c
index 0313d16..f5945cc 100644
--- a/gtk/gtkcellrenderertext.c
+++ b/gtk/gtkcellrenderertext.c
@@ -1206,28 +1206,46 @@ gtk_cell_renderer_text_set_property (GObject *object,
case PROP_BACKGROUND_GDK:
{
GdkColor *color;
- GdkRGBA rgba;
color = g_value_get_boxed (value);
- rgba.red = color->red / 65535.;
- rgba.green = color->green / 65535.;
- rgba.blue = color->blue / 65535.;
+ if (color)
+ {
+ GdkRGBA rgba;
+
+ rgba.red = color->red / 65535.;
+ rgba.green = color->green / 65535.;
+ rgba.blue = color->blue / 65535.;
+ rgba.alpha = 1;
- set_bg_color (celltext, &rgba);
+ set_bg_color (celltext, &rgba);
+ }
+ else
+ {
+ set_bg_color (celltext, NULL);
+ }
}
break;
case PROP_FOREGROUND_GDK:
{
GdkColor *color;
- GdkRGBA rgba;
color = g_value_get_boxed (value);
- rgba.red = color->red / 65535.;
- rgba.green = color->green / 65535.;
- rgba.blue = color->blue / 65535.;
+ if (color)
+ {
+ GdkRGBA rgba;
+
+ rgba.red = color->red / 65535.;
+ rgba.green = color->green / 65535.;
+ rgba.blue = color->blue / 65535.;
+ rgba.alpha = 1;
- set_fg_color (celltext, &rgba);
+ set_fg_color (celltext, &rgba);
+ }
+ else
+ {
+ set_fg_color (celltext, NULL);
+ }
}
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]