summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-05-22 09:05:58 -0400
committerMatthias Clasen <mclasen@redhat.com>2014-05-22 09:09:55 -0400
commit49cf5142ba9e9542e3e848f0fc55c4fd2eaa9f7f (patch)
tree2b0794b7842a9d9fe093db0389765ad3dd89b739 /demos
parentc3a9a20839955a98266463c6fad4f0190feaccc2 (diff)
downloadgtk+-49cf5142ba9e9542e3e848f0fc55c4fd2eaa9f7f.tar.gz
Deprecate GdkColor
It has been replaced by GdkRGBA. Time to make it official. http://bugzilla.gnome.org/show_bug.cgi?id=636695
Diffstat (limited to 'demos')
-rw-r--r--demos/gtk-demo/iconview_edit.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/demos/gtk-demo/iconview_edit.c b/demos/gtk-demo/iconview_edit.c
index 0487e5274a..25bc80f02d 100644
--- a/demos/gtk-demo/iconview_edit.c
+++ b/demos/gtk-demo/iconview_edit.c
@@ -52,20 +52,24 @@ set_cell_color (GtkCellLayout *cell_layout,
gpointer data)
{
gchar *text;
- GdkColor color;
+ GdkRGBA color;
guint32 pixel = 0;
GdkPixbuf *pixbuf;
gtk_tree_model_get (tree_model, iter, COL_TEXT, &text, -1);
- if (gdk_color_parse (text, &color))
+ if (!text)
+ return;
+
+ if (gdk_rgba_parse (&color, text))
pixel =
- (color.red >> 8) << 24 |
- (color.green >> 8) << 16 |
- (color.blue >> 8) << 8;
+ ((gint)(color.red * 255)) << 24 |
+ ((gint)(color.green * 255)) << 16 |
+ ((gint)(color.blue * 255)) << 8 |
+ ((gint)(color.alpha * 255));
g_free (text);
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 24, 24);
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, 24, 24);
gdk_pixbuf_fill (pixbuf, pixel);
g_object_set (cell, "pixbuf", pixbuf, NULL);