[gtk+] gtkcolorsel: Do not use deprecated GdkColor api



commit abb7f40fb848b2ec8d66a72cb1a2f4ac80273290
Author: Javier JardÃn <jjardon gnome org>
Date:   Tue Jan 3 17:52:34 2012 +0100

    gtkcolorsel: Do not use deprecated GdkColor api

 gtk/gtkcolorsel.c |   29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c
index 85de544..8347bd2 100644
--- a/gtk/gtkcolorsel.c
+++ b/gtk/gtkcolorsel.c
@@ -607,7 +607,19 @@ gtk_color_selection_set_property (GObject         *object,
                                            g_value_get_boolean (value));
       break;
     case PROP_CURRENT_COLOR:
-      gtk_color_selection_set_current_color (colorsel, g_value_get_boxed (value));
+      {
+        GdkColor *color;
+        GdkRGBA rgba;
+
+        color = g_value_get_boxed (value);
+
+        rgba.red = SCALE (color->red);
+        rgba.green = SCALE (color->green);;
+        rgba.blue = SCALE (color->blue);
+        rgba.alpha = 1.0;
+
+        gtk_color_selection_set_current_rgba (colorsel, &rgba);
+      }
       break;
     case PROP_CURRENT_ALPHA:
       gtk_color_selection_set_current_alpha (colorsel, g_value_get_uint (value));
@@ -629,7 +641,6 @@ gtk_color_selection_get_property (GObject     *object,
                                   GParamSpec  *pspec)
 {
   GtkColorSelection *colorsel = GTK_COLOR_SELECTION (object);
-  GdkColor color;
 
   switch (prop_id)
     {
@@ -640,8 +651,18 @@ gtk_color_selection_get_property (GObject     *object,
       g_value_set_boolean (value, gtk_color_selection_get_has_palette (colorsel));
       break;
     case PROP_CURRENT_COLOR:
-      gtk_color_selection_get_current_color (colorsel, &color);
-      g_value_set_boxed (value, &color);
+      {
+        GdkColor color;
+        GdkRGBA rgba;
+
+        gtk_color_selection_get_current_rgba (colorsel, &rgba);
+
+        color.red = UNSCALE (rgba.red);
+        color.green = UNSCALE (rgba.green);
+        color.blue = UNSCALE (rgba.blue);
+
+        g_value_set_boxed (value, &color);
+      }
       break;
     case PROP_CURRENT_ALPHA:
       g_value_set_uint (value, gtk_color_selection_get_current_alpha (colorsel));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]