Index: gtk/gtkstyle.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkstyle.c,v
retrieving revision 1.186
diff -u -p -r1.186 gtkstyle.c
--- gtk/gtkstyle.c	5 Oct 2005 13:23:21 -0000	1.186
+++ gtk/gtkstyle.c	17 Nov 2005 17:50:20 -0000
@@ -37,6 +37,7 @@
 #include "gtkthemes.h"
 #include "gtkiconfactory.h"
 #include "gtksettings.h"	/* _gtk_settings_parse_convert() */
+#include "gtkhashtable.h"
 #include "gtkintl.h"
 #include "gtkalias.h"
 
@@ -50,6 +51,14 @@ typedef struct {
   GValue      value;
 } PropertyValue;
 
+#define GTK_STYLE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_STYLE, GtkStylePrivate))
+
+typedef struct _GtkStylePrivate GtkStylePrivate;
+
+struct _GtkStylePrivate {
+  GSList *logical_color_hashes;
+};
+
 /* --- prototypes --- */
 static void	 gtk_style_init			(GtkStyle	*style);
 static void	 gtk_style_class_init		(GtkStyleClass	*klass);
@@ -534,7 +543,8 @@ gtk_style_class_init (GtkStyleClass *kla
   klass->draw_layout = gtk_default_draw_layout;
   klass->draw_resize_grip = gtk_default_draw_resize_grip;
 
-  
+  g_type_class_add_private (object_class, sizeof (GtkStylePrivate));
+
   /**
    * GtkStyle::realize:
    * @style: the object which received the signal
@@ -596,6 +606,7 @@ static void
 gtk_style_finalize (GObject *object)
 {
   GtkStyle *style = GTK_STYLE (object);
+  GtkStylePrivate *priv = GTK_STYLE_GET_PRIVATE (style);
 
   g_return_if_fail (style->attach_count == 0);
 
@@ -625,18 +636,11 @@ gtk_style_finalize (GObject *object)
         }
     }
 
-  if (style->icon_factories)
-    {
-      GSList *tmp_list = style->icon_factories;
+  g_slist_foreach (style->icon_factories, (GFunc) g_object_unref, NULL);
+  g_slist_free (style->icon_factories);
 
-      while (tmp_list)
-	{
-	  g_object_unref (tmp_list->data);
-	  tmp_list = tmp_list->next;
-	}
-
-      g_slist_free (style->icon_factories);
-    }
+  g_slist_foreach (priv->logical_color_hashes, (GFunc) g_object_unref, NULL);
+  g_slist_free (priv->logical_color_hashes);
 
   pango_font_description_free (style->font_desc);
   
@@ -896,6 +900,51 @@ gtk_style_lookup_icon_set (GtkStyle   *s
 }
 
 /**
+ * gtk_style_lookup_logical_color:
+ * @style: a #GtkStyle
+ * @color_name: the name of the logical color to look up
+ * @color: the #GdkColor to fill in
+ *
+ * Looks up @color_name in the style's logical color mappings,
+ * filling in @color and returning %TRUE if found, otherwise
+ * returning %FALSE. Do not cache the found mapping, because
+ * it depends on the #GtkStyle and might change when a theme
+ * switch occurs.
+ *
+ * Return value: %TRUE if the mapping was found.
+ **/
+gboolean
+gtk_style_lookup_logical_color (GtkStyle   *style,
+                                const char *color_name,
+                                GdkColor   *color)
+{
+  GtkStylePrivate *priv = GTK_STYLE_GET_PRIVATE (style);
+  GSList *iter;
+
+  g_return_val_if_fail (GTK_IS_STYLE (style), FALSE);
+  g_return_val_if_fail (color_name != NULL, FALSE);
+  g_return_val_if_fail (color != NULL, FALSE);
+
+  iter = priv->logical_color_hashes;
+  while (iter != NULL)
+    {
+      GdkColor *mapping = g_hash_table_lookup (GTK_HASH_TABLE (iter->data)->hash,
+                                               color_name);
+      if (mapping)
+        {
+          color->red = mapping->red;
+          color->green = mapping->green;
+          color->blue = mapping->blue;
+          return TRUE;
+        }
+
+      iter = g_slist_next (iter);
+    }
+
+  return FALSE;
+}
+
+/**
  * gtk_draw_hline:
  * @style: a #GtkStyle
  * @window: a #GdkWindow
@@ -1613,6 +1662,7 @@ static void
 gtk_style_real_init_from_rc (GtkStyle   *style,
 			     GtkRcStyle *rc_style)
 {
+  GtkStylePrivate *priv = GTK_STYLE_GET_PRIVATE (style);
   gint i;
 
   /* cache _should_ be still empty */
@@ -1638,19 +1688,12 @@ gtk_style_real_init_from_rc (GtkStyle   
   if (rc_style->ythickness >= 0)
     style->ythickness = rc_style->ythickness;
 
-  if (rc_style->icon_factories)
-    {
-      GSList *iter;
+  style->icon_factories = g_slist_copy (rc_style->icon_factories);
+  g_slist_foreach (style->icon_factories, (GFunc) g_object_ref, NULL);
 
-      style->icon_factories = g_slist_copy (rc_style->icon_factories);
-      
-      iter = style->icon_factories;
-      while (iter != NULL)
-        {
-          g_object_ref (iter->data);
-          iter = g_slist_next (iter);
-        }
-    }
+  priv->logical_color_hashes =
+    g_slist_copy (_gtk_rc_style_get_logical_color_hashes (rc_style));
+  g_slist_foreach (priv->logical_color_hashes, (GFunc) g_object_ref, NULL);
 }
 
 static gint
Index: gtk/gtkstyle.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkstyle.h,v
retrieving revision 1.48
diff -u -p -r1.48 gtkstyle.h
--- gtk/gtkstyle.h	20 Mar 2005 07:01:22 -0000	1.48
+++ gtk/gtkstyle.h	17 Nov 2005 17:50:21 -0000
@@ -452,6 +452,10 @@ void	  gtk_style_apply_default_backgroun
 					      gint	    width, 
 					      gint	    height);
 
+gboolean  gtk_style_lookup_logical_color     (GtkStyle     *style,
+                                              const gchar  *color_name,
+                                              GdkColor     *color);
+
 GtkIconSet* gtk_style_lookup_icon_set (GtkStyle            *style,
                                        const gchar         *stock_id);
 GdkPixbuf*  gtk_style_render_icon     (GtkStyle            *style,
Index: gtk/gtkrc.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkrc.c,v
retrieving revision 1.166
diff -u -p -r1.166 gtkrc.c
--- gtk/gtkrc.c	4 Nov 2005 12:24:36 -0000	1.166
+++ gtk/gtkrc.c	17 Nov 2005 17:50:22 -0000
@@ -55,6 +55,7 @@
 #include "gtkprivate.h"
 #include "gtksettings.h"
 #include "gtkwindow.h"
+#include "gtkhashtable.h"
 
 #include "gtkalias.h"
 
@@ -106,6 +107,15 @@ struct _GtkRcContext
   GtkStyle *default_style;
 };
 
+#define GTK_RC_STYLE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_RC_STYLE, GtkRcStylePrivate))
+
+typedef struct _GtkRcStylePrivate GtkRcStylePrivate;
+
+struct _GtkRcStylePrivate
+{
+  GSList *logical_color_hashes;
+};
+
 static GtkRcContext *gtk_rc_context_get              (GtkSettings     *settings);
 
 static guint       gtk_rc_style_hash                 (const gchar     *name);
@@ -180,6 +190,13 @@ static guint       gtk_rc_parse_stock   
 						      GScanner        *scanner,
                                                       GtkRcStyle      *rc_style,
                                                       GtkIconFactory  *factory);
+static guint       gtk_rc_parse_logical_color        (GScanner        *scanner,
+                                                      GtkRcStyle      *rc_style,
+                                                      GtkHashTable    *hash);
+static guint       gtk_rc_parse_color_full           (GScanner        *scanner,
+                                                      GdkColor        *color,
+                                                      GtkRcStyle      *style);
+
 static void        gtk_rc_clear_hash_node            (gpointer         key,
                                                       gpointer         data,
                                                       gpointer         user_data);
@@ -278,7 +295,8 @@ static const struct
   { "stock", GTK_RC_TOKEN_STOCK },
   { "im_module_file", GTK_RC_TOKEN_IM_MODULE_FILE },
   { "LTR", GTK_RC_TOKEN_LTR },
-  { "RTL", GTK_RC_TOKEN_RTL }
+  { "RTL", GTK_RC_TOKEN_RTL },
+  { "logical_color", GTK_RC_TOKEN_LOGICAL_COLOR }
 };
 
 static GHashTable *realized_style_ht = NULL;
@@ -955,6 +973,7 @@ gtk_rc_style_get_type (void)
 static void
 gtk_rc_style_init (GtkRcStyle *style)
 {
+  GtkRcStylePrivate *priv = GTK_RC_STYLE_GET_PRIVATE (style);
   guint i;
 
   style->name = NULL;
@@ -977,6 +996,8 @@ gtk_rc_style_init (GtkRcStyle *style)
 
   style->rc_style_lists = NULL;
   style->icon_factories = NULL;
+
+  priv->logical_color_hashes = NULL;
 }
 
 static void
@@ -992,6 +1013,8 @@ gtk_rc_style_class_init (GtkRcStyleClass
   klass->create_rc_style = gtk_rc_style_real_create_rc_style;
   klass->merge = gtk_rc_style_real_merge;
   klass->create_style = gtk_rc_style_real_create_style;
+
+  g_type_class_add_private (object_class, sizeof (GtkRcStylePrivate));
 }
 
 static void
@@ -999,10 +1022,12 @@ gtk_rc_style_finalize (GObject *object)
 {
   GSList *tmp_list1, *tmp_list2;
   GtkRcStyle *rc_style;
+  GtkRcStylePrivate *rc_priv;
   gint i;
 
   rc_style = GTK_RC_STYLE (object);
-  
+  rc_priv = GTK_RC_STYLE_GET_PRIVATE (rc_style);
+
   if (rc_style->name)
     g_free (rc_style->name);
   if (rc_style->font_desc)
@@ -1060,14 +1085,12 @@ gtk_rc_style_finalize (GObject *object)
       rc_style->rc_properties = NULL;
     }
 
-  tmp_list1 = rc_style->icon_factories;
-  while (tmp_list1)
-    {
-      g_object_unref (tmp_list1->data);
-      tmp_list1 = tmp_list1->next;
-    }
+  g_slist_foreach (rc_style->icon_factories, (GFunc) g_object_unref, NULL);
   g_slist_free (rc_style->icon_factories);
-  
+
+  g_slist_foreach (rc_priv->logical_color_hashes, (GFunc) g_object_unref, NULL);
+  g_slist_free (rc_priv->logical_color_hashes);
+
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
@@ -1126,6 +1149,14 @@ gtk_rc_style_real_create_rc_style (GtkRc
   return g_object_new (G_OBJECT_TYPE (style), NULL);
 }
 
+GSList *
+_gtk_rc_style_get_logical_color_hashes (GtkRcStyle *rc_style)
+{
+  GtkRcStylePrivate *priv = GTK_RC_STYLE_GET_PRIVATE (rc_style);
+
+  return priv->logical_color_hashes;
+}
+
 static gint
 gtk_rc_properties_cmp (gconstpointer bsearch_node1,
 		       gconstpointer bsearch_node2)
@@ -2086,6 +2117,7 @@ gtk_rc_init_style (GtkRcContext *context
     {
       GtkRcStyle *base_style = NULL;
       GtkRcStyle *proto_style;
+      GtkRcStylePrivate *proto_priv;
       GtkRcStyleClass *proto_style_class;
       GSList *tmp_styles;
       GType rc_style_type = GTK_TYPE_RC_STYLE;
@@ -2113,12 +2145,14 @@ gtk_rc_init_style (GtkRcContext *context
       
       proto_style_class = GTK_RC_STYLE_GET_CLASS (base_style);
       proto_style = proto_style_class->create_rc_style (base_style);
-      
+      proto_priv = GTK_RC_STYLE_GET_PRIVATE (proto_style);
+
       tmp_styles = rc_styles;
       while (tmp_styles)
 	{
 	  GtkRcStyle *rc_style = tmp_styles->data;
-          GSList *factories;
+          GtkRcStylePrivate *rc_priv = GTK_RC_STYLE_GET_PRIVATE (rc_style);
+          GSList *concat_list;
           
 	  proto_style_class->merge (proto_style, rc_style);	  
           
@@ -2126,23 +2160,16 @@ gtk_rc_init_style (GtkRcContext *context
 	  if (!g_slist_find (rc_style->rc_style_lists, rc_styles))
 	    rc_style->rc_style_lists = g_slist_prepend (rc_style->rc_style_lists, rc_styles);
 
-          factories = g_slist_copy (rc_style->icon_factories);
-          if (factories)
-            {
-              GSList *iter;
-              
-              iter = factories;
-              while (iter != NULL)
-                {
-                  g_object_ref (iter->data);
-                  iter = g_slist_next (iter);
-                }
-
-              proto_style->icon_factories = g_slist_concat (proto_style->icon_factories,
-                                                            factories);
+          concat_list = g_slist_copy (rc_style->icon_factories);
+          g_slist_foreach (concat_list, (GFunc) g_object_ref, NULL);
+          proto_style->icon_factories = g_slist_concat (proto_style->icon_factories,
+                                                        concat_list);
+
+          concat_list = g_slist_copy (rc_priv->logical_color_hashes);
+          g_slist_foreach (concat_list, (GFunc) g_object_ref, NULL);
+          proto_priv->logical_color_hashes = g_slist_concat (proto_priv->logical_color_hashes,
+                                                             concat_list);
 
-            }
-          
 	  tmp_styles = tmp_styles->next;
 	}
 
@@ -2519,10 +2546,12 @@ gtk_rc_parse_style (GtkRcContext *contex
   GtkRcStyle *rc_style;
   GtkRcStyle *orig_style;
   GtkRcStyle *parent_style;
+  GtkRcStylePrivate *rc_priv = NULL;
   guint token;
   gint i;
   GtkIconFactory *our_factory = NULL;
-  
+  GtkHashTable *our_hash = NULL;
+
   token = g_scanner_get_next_token (scanner);
   if (token != GTK_RC_TOKEN_STYLE)
     return GTK_RC_TOKEN_STYLE;
@@ -2537,12 +2566,6 @@ gtk_rc_parse_style (GtkRcContext *contex
   else
     orig_style = NULL;
 
-  /* If there's a list, its first member is always the factory belonging
-   * to this RcStyle
-   */
-  if (rc_style && rc_style->icon_factories)
-    our_factory = rc_style->icon_factories->data;
-  
   if (!rc_style)
     {
       rc_style = gtk_rc_style_new ();
@@ -2555,6 +2578,16 @@ gtk_rc_parse_style (GtkRcContext *contex
 	rc_style->color_flags[i] = 0;
     }
 
+  rc_priv = GTK_RC_STYLE_GET_PRIVATE (rc_style);
+
+  /* If there's a list, its first member is always the factory belonging
+   * to this RcStyle
+   */
+  if (rc_style->icon_factories)
+    our_factory = rc_style->icon_factories->data;
+  if (rc_priv->logical_color_hashes)
+    our_hash = rc_priv->logical_color_hashes->data;
+
   token = g_scanner_peek_next_token (scanner);
   if (token == G_TOKEN_EQUAL_SIGN)
     {
@@ -2570,8 +2603,9 @@ gtk_rc_parse_style (GtkRcContext *contex
       parent_style = gtk_rc_style_find (context, scanner->value.v_string);
       if (parent_style)
 	{
-          GSList *factories;
-          
+          GtkRcStylePrivate *parent_priv = GTK_RC_STYLE_GET_PRIVATE (parent_style);
+          GSList *concat_list;
+
 	  for (i = 0; i < 5; i++)
 	    {
 	      rc_style->color_flags[i] = parent_style->color_flags[i];
@@ -2625,16 +2659,28 @@ gtk_rc_parse_style (GtkRcContext *contex
                   rc_style->icon_factories = g_slist_prepend (rc_style->icon_factories,
                                                               our_factory);
                 }
-              
+
+              concat_list = g_slist_copy (parent_style->icon_factories);
+              g_slist_foreach (concat_list, (GFunc) g_object_ref, NULL);
               rc_style->icon_factories = g_slist_concat (rc_style->icon_factories,
-                                                         g_slist_copy (parent_style->icon_factories));
-              
-              factories = parent_style->icon_factories;
-              while (factories != NULL)
+                                                         concat_list);
+            }
+
+          /* Also append parent's color hashes, adding a ref to them */
+          if (parent_priv->logical_color_hashes != NULL)
+            {
+              /* See comment above .. */
+              if (our_hash == NULL)
                 {
-                  g_object_ref (factories->data);
-                  factories = factories->next;
+                  our_hash = _gtk_hash_table_new ();
+                  rc_priv->logical_color_hashes = g_slist_prepend (rc_priv->logical_color_hashes,
+                                                                   our_hash);
                 }
+
+              concat_list = g_slist_copy (parent_priv->logical_color_hashes);
+              g_slist_foreach (concat_list, (GFunc) g_object_ref, NULL);
+              rc_priv->logical_color_hashes = g_slist_concat (rc_priv->logical_color_hashes,
+                                                              concat_list);
             }
 	}
     }
@@ -2693,6 +2739,15 @@ gtk_rc_parse_style (GtkRcContext *contex
             }
           token = gtk_rc_parse_stock (context, scanner, rc_style, our_factory);
           break;
+        case GTK_RC_TOKEN_LOGICAL_COLOR:
+          if (our_hash == NULL)
+            {
+              our_hash = _gtk_hash_table_new ();
+              rc_priv->logical_color_hashes = g_slist_prepend (rc_priv->logical_color_hashes,
+                                                               our_hash);
+            }
+          token = gtk_rc_parse_logical_color (scanner, rc_style, our_hash);
+          break;
 	case G_TOKEN_IDENTIFIER:
 	  if (is_c_identifier (scanner->next_value.v_identifier) &&
 	      scanner->next_value.v_identifier[0] >= 'A' &&
@@ -2700,7 +2755,7 @@ gtk_rc_parse_style (GtkRcContext *contex
 	    {
 	      GtkRcProperty prop = { 0, 0, NULL, { 0, }, };
 	      gchar *name;
-	      
+
 	      g_scanner_get_next_token (scanner); /* eat type name */
 	      prop.type_name = g_quark_from_string (scanner->value.v_identifier);
 	      if (g_scanner_get_next_token (scanner) != ':' ||
@@ -2832,7 +2887,7 @@ gtk_rc_parse_bg (GScanner   *scanner,
     return G_TOKEN_EQUAL_SIGN;
 
   style->color_flags[state] |= GTK_RC_BG;
-  return gtk_rc_parse_color (scanner, &style->bg[state]);
+  return gtk_rc_parse_color_full (scanner, &style->bg[state], style);
 }
 
 static guint
@@ -2855,7 +2910,7 @@ gtk_rc_parse_fg (GScanner   *scanner,
     return G_TOKEN_EQUAL_SIGN;
   
   style->color_flags[state] |= GTK_RC_FG;
-  return gtk_rc_parse_color (scanner, &style->fg[state]);
+  return gtk_rc_parse_color_full (scanner, &style->fg[state], style);
 }
 
 static guint
@@ -2878,7 +2933,7 @@ gtk_rc_parse_text (GScanner   *scanner,
     return G_TOKEN_EQUAL_SIGN;
   
   style->color_flags[state] |= GTK_RC_TEXT;
-  return gtk_rc_parse_color (scanner, &style->text[state]);
+  return gtk_rc_parse_color_full (scanner, &style->text[state], style);
 }
 
 static guint
@@ -2901,7 +2956,7 @@ gtk_rc_parse_base (GScanner   *scanner,
     return G_TOKEN_EQUAL_SIGN;
 
   style->color_flags[state] |= GTK_RC_BASE;
-  return gtk_rc_parse_color (scanner, &style->base[state]);
+  return gtk_rc_parse_color_full (scanner, &style->base[state], style);
 }
 
 static guint
@@ -3353,10 +3408,45 @@ gtk_rc_parse_priority (GScanner	        
   return G_TOKEN_NONE;
 }
 
+static gboolean
+lookup_logical_color (GtkRcStyle *style,
+                      const char *color_name,
+                      GdkColor   *color)
+{
+  GtkRcStylePrivate *priv = GTK_RC_STYLE_GET_PRIVATE (style);
+  GSList *iter;
+
+  iter = priv->logical_color_hashes;
+  while (iter != NULL)
+    {
+      GdkColor *match = g_hash_table_lookup (GTK_HASH_TABLE (iter->data)->hash,
+                                             color_name);
+      if (match)
+        {
+          color->red = match->red;
+          color->green = match->green;
+          color->blue = match->blue;
+          return TRUE;
+        }
+
+      iter = g_slist_next (iter);
+    }
+
+  return FALSE;
+}
+
 guint
 gtk_rc_parse_color (GScanner *scanner,
 		    GdkColor *color)
 {
+    return gtk_rc_parse_color_full (scanner, color, NULL);
+}
+
+static guint
+gtk_rc_parse_color_full (GScanner *scanner,
+                         GdkColor *color,
+                         GtkRcStyle *style)
+{
   guint token;
 
   g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR);
@@ -3414,13 +3504,16 @@ gtk_rc_parse_color (GScanner *scanner,
     case G_TOKEN_STRING:
       if (!gdk_color_parse (scanner->value.v_string, color))
 	{
-	  g_scanner_warn (scanner, "Invalid color constant '%s'",
-			  scanner->value.v_string);
-	  return G_TOKEN_STRING;
+          if (!(style && lookup_logical_color (style, scanner->value.v_string, color)))
+            {
+              g_scanner_warn (scanner, "Invalid color constant '%s'",
+                              scanner->value.v_string);
+              return G_TOKEN_STRING;
+            }
 	}
-      else
-	return G_TOKEN_NONE;
-      
+
+      return G_TOKEN_NONE;
+
     default:
       return G_TOKEN_STRING;
     }
@@ -3632,8 +3725,8 @@ gtk_rc_parse_path_pattern (GtkRcContext 
 }
 
 static guint
-gtk_rc_parse_stock_id (GScanner	 *scanner,
-                       gchar    **stock_id)
+gtk_rc_parse_hash_key (GScanner  *scanner,
+                       gchar    **hash_key)
 {
   guint token;
   
@@ -3646,12 +3739,12 @@ gtk_rc_parse_stock_id (GScanner	 *scanne
   if (token != G_TOKEN_STRING)
     return G_TOKEN_STRING;
   
-  *stock_id = g_strdup (scanner->value.v_string);
+  *hash_key = g_strdup (scanner->value.v_string);
   
   token = g_scanner_get_next_token (scanner);
   if (token != G_TOKEN_RIGHT_BRACE)
     {
-      g_free (*stock_id);
+      g_free (*hash_key);
       return G_TOKEN_RIGHT_BRACE;
     }
   
@@ -3861,7 +3954,7 @@ gtk_rc_parse_stock (GtkRcContext   *cont
   if (token != GTK_RC_TOKEN_STOCK)
     return GTK_RC_TOKEN_STOCK;
   
-  token = gtk_rc_parse_stock_id (scanner, &stock_id);
+  token = gtk_rc_parse_hash_key (scanner, &stock_id);
   if (token != G_TOKEN_NONE)
     return token;
   
@@ -3916,6 +4009,47 @@ gtk_rc_parse_stock (GtkRcContext   *cont
     }
   
   g_free (stock_id);
+
+  return G_TOKEN_NONE;
+}
+
+static guint
+gtk_rc_parse_logical_color (GScanner     *scanner,
+                            GtkRcStyle   *rc_style,
+                            GtkHashTable *hash)
+{
+  gchar *color_id = NULL;
+  guint token;
+  GdkColor *color;
+
+  token = g_scanner_get_next_token (scanner);
+  if (token != GTK_RC_TOKEN_LOGICAL_COLOR)
+    return GTK_RC_TOKEN_LOGICAL_COLOR;
+
+  token = gtk_rc_parse_hash_key (scanner, &color_id);
+  if (token != G_TOKEN_NONE)
+    return token;
+
+  token = g_scanner_get_next_token (scanner);
+  if (token != G_TOKEN_EQUAL_SIGN)
+    {
+      g_free (color_id);
+      return G_TOKEN_EQUAL_SIGN;
+    }
+
+  color = g_new (GdkColor, 1);
+  token = gtk_rc_parse_color_full (scanner, color, rc_style);
+  if (token != G_TOKEN_NONE)
+    {
+      g_free (color_id);
+      g_free (color);
+      return token;
+    }
+
+  /* Because the hash is created with destroy functions,
+   * g_hash_table_insert will free any old values for us,
+   * if a mapping with the specified key already exists. */
+  g_hash_table_insert (hash->hash, color_id, color);
 
   return G_TOKEN_NONE;
 }
Index: gtk/gtkrc.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkrc.h,v
retrieving revision 1.43
diff -u -p -r1.43 gtkrc.h
--- gtk/gtkrc.h	20 Mar 2005 07:01:22 -0000	1.43
+++ gtk/gtkrc.h	17 Nov 2005 17:50:22 -0000
@@ -209,6 +209,7 @@ typedef enum {
   GTK_RC_TOKEN_STOCK,
   GTK_RC_TOKEN_LTR,
   GTK_RC_TOKEN_RTL,
+  GTK_RC_TOKEN_LOGICAL_COLOR,
   GTK_RC_TOKEN_LAST
 } GtkRcTokenType;
 
@@ -236,6 +237,8 @@ struct _GtkRcProperty
 const GtkRcProperty* _gtk_rc_style_lookup_rc_property (GtkRcStyle *rc_style,
 						       GQuark      type_name,
 						       GQuark      property_name);
+
+GSList     * _gtk_rc_style_get_logical_color_hashes (GtkRcStyle *rc_style);
 
 const gchar* _gtk_rc_context_get_default_font_name (GtkSettings *settings);
 
Index: gtk/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/Makefile.am,v
retrieving revision 1.287
diff -u -p -r1.287 Makefile.am
--- gtk/Makefile.am	12 Nov 2005 20:08:12 -0000	1.287
+++ gtk/Makefile.am	17 Nov 2005 17:50:22 -0000
@@ -392,6 +392,8 @@ gtk_c_sources =                 \
 	gtkframe.c		\
 	gtkgamma.c		\
 	gtkgc.c			\
+	gtkhashtable.c		\
+	gtkhashtable.h		\
 	gtkhandlebox.c		\
 	gtkhbbox.c		\
 	gtkhbox.c		\
Index: gtk/gtk.symbols
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtk.symbols,v
retrieving revision 1.71
diff -u -p -r1.71 gtk.symbols
--- gtk/gtk.symbols	11 Nov 2005 12:48:29 -0000	1.71
+++ gtk/gtk.symbols	17 Nov 2005 17:50:23 -0000
@@ -1066,6 +1066,7 @@ gtk_style_copy
 gtk_style_detach
 gtk_style_get_type G_GNUC_CONST
 gtk_style_lookup_icon_set
+gtk_style_lookup_logical_color
 gtk_style_new
 gtk_style_render_icon
 gtk_style_set_background
