From 85747da97238dc101f92cd8241aa7aea44f35789 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Javier=20Jard=C3=B3n?= Date: Mon, 6 Jun 2011 16:47:40 +0100 Subject: [PATCH] tests: use GdkRGBA instead GdkColor --- tests/prop-editor.c | 20 ++++++++++---------- tests/testcombo.c | 10 +++++----- tests/testtreemenu.c | 10 +++++----- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/prop-editor.c b/tests/prop-editor.c index 41c61f8af..df983dc52 100644 --- a/tests/prop-editor.c +++ b/tests/prop-editor.c @@ -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)); } diff --git a/tests/testcombo.c b/tests/testcombo.c index b1bb7f94b..2a9c527b4 100644 --- a/tests/testcombo.c +++ b/tests/testcombo.c @@ -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; } diff --git a/tests/testtreemenu.c b/tests/testtreemenu.c index 1abab01bd..703c6d7cc 100644 --- a/tests/testtreemenu.c +++ b/tests/testtreemenu.c @@ -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; } -- 2.43.2