tests: use GdkRGBA instead GdkColor

This commit is contained in:
Javier Jardón 2011-06-06 16:47:40 +01:00
parent 4a9bd917a0
commit 85747da972
3 changed files with 20 additions and 20 deletions

View File

@ -664,9 +664,9 @@ static void
color_modified (GtkColorButton *cb, gpointer data)
{
ObjectProperty *p = data;
GdkColor color;
GdkRGBA rgba;
gtk_color_button_get_color (cb, &color);
gtk_color_button_get_rgba (cb, &rgba);
if (is_child_property (p->spec))
{
@ -674,10 +674,10 @@ color_modified (GtkColorButton *cb, gpointer data)
GtkWidget *parent = gtk_widget_get_parent (widget);
gtk_container_child_set (GTK_CONTAINER (parent),
widget, p->spec->name, &color, NULL);
widget, p->spec->name, &rgba, NULL);
}
else
g_object_set (p->obj, p->spec->name, &color, NULL);
g_object_set (p->obj, p->spec->name, &rgba, NULL);
}
static void
@ -685,19 +685,19 @@ color_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkColorButton *cb = GTK_COLOR_BUTTON (data);
GValue val = { 0, };
GdkColor *color;
GdkColor cb_color;
GdkRGBA *color;
GdkRGBA cb_color;
g_value_init (&val, GDK_TYPE_COLOR);
g_value_init (&val, GDK_TYPE_RGBA);
get_property_value (object, pspec, &val);
color = g_value_get_boxed (&val);
gtk_color_button_get_color (cb, &cb_color);
gtk_color_button_get_rgba (cb, &cb_color);
if (color != NULL && !gdk_color_equal (color, &cb_color))
if (color != NULL && !gdk_rgba_equal (color, &cb_color))
{
block_controller (G_OBJECT (cb));
gtk_color_button_set_color (cb, color);
gtk_color_button_set_rgba (cb, color);
unblock_controller (G_OBJECT (cb));
}

View File

@ -31,13 +31,13 @@ static GdkPixbuf *
create_color_pixbuf (const char *color)
{
GdkPixbuf *pixbuf;
GdkColor col;
GdkRGBA rgba;
int x;
int num;
guchar *pixels, *p;
if (!gdk_color_parse (color, &col))
if (!gdk_rgba_parse (&rgba, color))
return NULL;
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
@ -50,9 +50,9 @@ create_color_pixbuf (const char *color)
gdk_pixbuf_get_height (pixbuf);
for (x = 0; x < num; x++) {
p[0] = col.red / 65535 * 255;
p[1] = col.green / 65535 * 255;
p[2] = col.blue / 65535 * 255;
p[0] = rgba.red * 255;
p[1] = rgba.green * 255;
p[2] = rgba.blue * 255;
p += 3;
}

View File

@ -11,14 +11,14 @@ static GdkPixbuf *
create_color_pixbuf (const char *color)
{
GdkPixbuf *pixbuf;
GdkColor col;
GdkRGBA rgba;
int x;
int num;
int rowstride;
guchar *pixels, *p;
if (!gdk_color_parse (color, &col))
if (!gdk_rgba_parse (color, &col))
return NULL;
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
@ -32,9 +32,9 @@ create_color_pixbuf (const char *color)
gdk_pixbuf_get_height (pixbuf);
for (x = 0; x < num; x++) {
p[0] = col.red / 65535 * 255;
p[1] = col.green / 65535 * 255;
p[2] = col.blue / 65535 * 255;
p[0] = col.red * 255;
p[1] = col.green * 255;
p[2] = col.blue * 255;
p += 3;
}