Index: gkeyfile.h
===================================================================
RCS file: /cvs/gnome/glib/glib/gkeyfile.h,v
retrieving revision 1.4
diff -u -r1.4 gkeyfile.h
--- gkeyfile.h	28 Nov 2004 19:12:04 -0000	1.4
+++ gkeyfile.h	28 Sep 2005 19:01:22 -0000
@@ -47,7 +47,9 @@
 {
   G_KEY_FILE_NONE              = 0,
   G_KEY_FILE_KEEP_COMMENTS     = 1 << 0,
-  G_KEY_FILE_KEEP_TRANSLATIONS = 1 << 1
+  G_KEY_FILE_KEEP_TRANSLATIONS = 1 << 1,
+  G_KEY_FILE_MATCH_INSENSITIVE = 1 << 2
+
 } GKeyFileFlags;
 
 GKeyFile *g_key_file_new                    (void);
Index: gkeyfile.c
===================================================================
RCS file: /cvs/gnome/glib/glib/gkeyfile.c,v
retrieving revision 1.35
diff -u -r1.35 gkeyfile.c
--- gkeyfile.c	14 Sep 2005 18:04:52 -0000	1.35
+++ gkeyfile.c	28 Sep 2005 19:01:23 -0000
@@ -62,6 +62,9 @@
 
 #include "galias.h"
 
+
+typedef gint  (*GKeyFileCompareFunc) (const gchar *str1, const gchar* str2);
+
 typedef struct _GKeyFileGroup GKeyFileGroup;
 
 struct _GKeyFile
@@ -80,6 +83,8 @@
   gchar list_separator;
 
   GKeyFileFlags flags;
+
+  GKeyFileCompareFunc compare_func;
 };
 
 typedef struct _GKeyFileKeyValuePair GKeyFileKeyValuePair;
@@ -181,6 +186,27 @@
 static void                  g_key_file_flush_parse_buffer     (GKeyFile               *key_file,
 								GError                **error);
 
+static gint
+_g_utf8_casecollate (const gchar *str1, const gchar *str2)
+{
+    gchar *str1_lc = NULL, *str2_lc = NULL;
+    gint rv;
+
+    if ( (str1 != NULL) && (str2 == NULL)) return  1;
+    if ( (str1 == NULL) && (str2 == NULL)) return  0;
+    if ( (str1 == NULL) && (str2 != NULL)) return -1;
+
+    str1_lc = g_utf8_casefold (str1, strlen(str1)); 
+    str2_lc = g_utf8_casefold (str2, strlen(str2));
+
+    rv = g_utf8_collate (str1_lc, str2_lc);
+
+    g_free (str1_lc);
+    g_free (str2_lc);
+
+    return rv;
+}
+
 
 GQuark
 g_key_file_error_quark (void)
@@ -358,7 +384,18 @@
   gssize bytes_read;
   struct stat stat_buf;
   gchar read_buf[4096];
-  
+
+  key_file->flags = flags;
+
+  if ((flags & G_KEY_FILE_MATCH_INSENSITIVE) == G_KEY_FILE_MATCH_INSENSITIVE)
+    {
+      key_file->compare_func = _g_utf8_casecollate;
+    }
+    else 
+    {
+      key_file->compare_func = g_utf8_collate;
+    }
+
   if (fstat (fd, &stat_buf) < 0)
     {
       g_set_error (error, G_FILE_ERROR,
@@ -388,7 +425,6 @@
       g_key_file_clear (key_file);
       g_key_file_init (key_file);
     }
-  key_file->flags = flags;
 
   bytes_read = 0;
   do
@@ -508,6 +544,17 @@
   g_return_val_if_fail (data != NULL, FALSE);
   g_return_val_if_fail (length != 0, FALSE);
 
+  key_file->flags = flags;
+
+  if ((flags & G_KEY_FILE_MATCH_INSENSITIVE) == G_KEY_FILE_MATCH_INSENSITIVE)
+    {
+      key_file->compare_func = _g_utf8_casecollate;
+    }
+    else 
+    {
+      key_file->compare_func = g_utf8_collate;
+    }
+
   if (length == (gsize)-1)
     length = strlen (data);
 
@@ -516,7 +563,6 @@
       g_key_file_clear (key_file);
       g_key_file_init (key_file);
     }
-  key_file->flags = flags;
 
   g_key_file_parse_data (key_file, data, length, &key_file_error);
   
@@ -797,9 +843,9 @@
 
   if (key_file->current_group
       && key_file->current_group->name
-      && strcmp (key_file->start_group->name,
+      && key_file->compare_func (key_file->start_group->name,
                  key_file->current_group->name) == 0
-      && strcmp (key, "Encoding") == 0)
+      && key_file->compare_func (key, "Encoding") == 0)
     {
       if (g_ascii_strcasecmp (value, "UTF-8") != 0)
         {
@@ -2912,7 +2958,7 @@
     {
       group = (GKeyFileGroup *) tmp->data;
 
-      if (group && group->name && strcmp (group->name, group_name) == 0)
+      if (group && group->name && key_file->compare_func (group->name, group_name) == 0)
         break;
 
       group = NULL;
@@ -2950,7 +2996,7 @@
 
       pair = (GKeyFileKeyValuePair *) key_node->data; 
 
-      if (pair->key && strcmp (pair->key, key) == 0)
+      if (pair->key && key_file->compare_func (pair->key, key) == 0)
         break;
     }
 
@@ -3259,9 +3305,9 @@
 {
   if (value)
     {
-      if (strcmp (value, "true") == 0 || strcmp (value, "1") == 0)
+      if (key_file->compare_func (value, "true") == 0 || key_file->compare_func (value, "1") == 0)
         return TRUE;
-      else if (strcmp (value, "false") == 0 || strcmp (value, "0") == 0)
+      else if (key_file->compare_func (value, "false") == 0 || key_file->compare_func (value, "0") == 0)
         return FALSE;
     }
 
