[gtk+] gail: Use GdkRGBA instead GdkColor



commit 02285b232ccc18fe6db745346046c9690fb382eb
Author: Javier Jardón <jjardon gnome org>
Date:   Mon Jun 6 16:47:10 2011 +0100

    gail: Use GdkRGBA instead GdkColor

 modules/other/gail/gailtextcell.c          |   12 ++++++------
 modules/other/gail/libgail-util/gailmisc.c |   22 ++++++++++++++--------
 2 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/modules/other/gail/gailtextcell.c b/modules/other/gail/gailtextcell.c
index 2201917..3dce3fc 100644
--- a/modules/other/gail/gailtextcell.c
+++ b/modules/other/gail/gailtextcell.c
@@ -451,7 +451,7 @@ static PangoLayout*
 create_pango_layout(GtkCellRendererText *gtk_renderer,
                     GtkWidget           *widget)
 {
-  GdkColor *foreground_gdk;
+  GdkRGBA *foreground_rgba;
   PangoAttrList *attr_list, *attributes;
   PangoLayout *layout;
   PangoUnderline uline, underline;
@@ -467,7 +467,7 @@ create_pango_layout(GtkCellRendererText *gtk_renderer,
                 "text", &renderer_text,
                 "attributes", &attributes,
                 "foreground-set", &foreground_set,
-                "foreground-gdk", &foreground_gdk,
+                "foreground-gdk", &foreground_rgba,
                 "strikethrough-set", &strikethrough_set,
                 "strikethrough", &strikethrough,
                 "font-desc", &font_desc,
@@ -488,9 +488,9 @@ create_pango_layout(GtkCellRendererText *gtk_renderer,
 
   if (foreground_set)
     {
-      add_attr (attr_list, pango_attr_foreground_new (foreground_gdk->red,
-                                                      foreground_gdk->green,
-                                                      foreground_gdk->blue));
+      add_attr (attr_list, pango_attr_foreground_new (foreground_rgba->red * 65535,
+                                                      foreground_rgba->green * 65535,
+                                                      foreground_rgba->blue * 65535));
     }
 
   if (strikethrough_set)
@@ -540,7 +540,7 @@ create_pango_layout(GtkCellRendererText *gtk_renderer,
   pango_font_description_free (font_desc);
   pango_attr_list_unref (attributes);
   g_free (renderer_text);
-  gdk_color_free (foreground_gdk);
+  gdk_rgba_free (foreground_rgba);
 
   return layout;
 }
diff --git a/modules/other/gail/libgail-util/gailmisc.c b/modules/other/gail/libgail-util/gailmisc.c
index e1ad192..fd0917a 100644
--- a/modules/other/gail/libgail-util/gailmisc.c
+++ b/modules/other/gail/libgail-util/gailmisc.c
@@ -720,12 +720,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
       g_object_get (tag, "foreground-set", &val_set, NULL);
       if (val_set)
         {
-          GdkColor *c;
+          GdkRGBA *rgba;
           gchar *value;
 
-          g_object_get (tag, "foreground-gdk", &c, NULL);
-          value = g_strdup_printf ("%u,%u,%u", c->red, c->green, c->blue);
-          gdk_color_free (c);
+          g_object_get (tag, "foreground-rgba", &rgba, NULL);
+          value = g_strdup_printf ("%u,%u,%u",
+                                   (guint) rgba->red * 65535,
+                                   (guint) rgba->green * 65535,
+                                   (guint) rgba->blue * 65535);
+          gdk_rgba_free (rgba);
           attrib_set = gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_FG_COLOR, value);
         }
       temp_tags = temp_tags->next;
@@ -740,12 +743,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer,
       g_object_get (tag, "background-set", &val_set, NULL);
       if (val_set)
         {
-          GdkColor *c;
+          GdkRGBA *rgba;
           gchar *value;
 
-          g_object_get (tag, "background-gdk", &c, NULL);
-          value = g_strdup_printf ("%u,%u,%u", c->red, c->green, c->blue);
-          gdk_color_free (c);
+          g_object_get (tag, "background-rgba", &rgba, NULL);
+          value = g_strdup_printf ("%u,%u,%u",
+                                   (guint) rgba->red * 65535,
+                                   (guint) rgba->green * 65535,
+                                   (guint) rgba->blue * 65535);
+          gdk_rgba_free (rgba);
           attrib_set = gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_BG_COLOR, value);
         }
       temp_tags = temp_tags->next;



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