Index: docs/reference/glib/tmpl/keyfile.sgml
===================================================================
--- docs/reference/glib/tmpl/keyfile.sgml	(revisão 7657)
+++ docs/reference/glib/tmpl/keyfile.sgml	(cópia de trabalho)
@@ -87,7 +87,8 @@
 </para></listitem>
 <listitem><para>
 Key and Group names are case-sensitive, for example a group called
-<literal>[GROUP]</literal> is a different group from <literal>[group]</literal>.
+<literal>[GROUP]</literal> is a different group from <literal>[group]</literal>,
+unless you use #G_KEY_FILE_MATCH_INSENSITIVE flag.
 </para></listitem>
 <listitem><para>
 <filename>.ini</filename> files don't have a strongly typed boolean entry type, they only
@@ -155,6 +156,9 @@
 @G_KEY_FILE_KEEP_TRANSLATIONS: Use this flag if you plan to write the (possibly modified)
   contents of the key file back to a file; otherwise only the translations for the current
   language will be written back.
+@G_KEY_FILE_MATCH_INSENSITIVE: Use this flag if you want the Key and Group names to be case
+  insensitive. For instance, a group called <literal>[GROUP]</literal> is a different group
+  from <literal>[group]</literal>. With this flag on these groups would be the same. @Since: 2.20
 
 <!-- ##### FUNCTION g_key_file_new ##### -->
 <para>
Index: glib/gkeyfile.c
===================================================================
--- glib/gkeyfile.c	(revisão 7657)
+++ glib/gkeyfile.c	(cópia de trabalho)
@@ -81,6 +81,7 @@
   gchar list_separator;
 
   GKeyFileFlags flags;
+  GCompareFunc compare_func;
 
   gchar **locales;
 };
@@ -409,6 +410,11 @@
     }
   key_file->flags = flags;
 
+  if (flags & G_KEY_FILE_MATCH_INSENSITIVE)
+    key_file->compare_func = (GCompareFunc) g_ascii_strcasecmp;
+  else
+    key_file->compare_func = (GCompareFunc) strcmp;
+
   bytes_read = 0;
   do
     {
@@ -538,6 +544,11 @@
     }
   key_file->flags = flags;
 
+  if (flags & G_KEY_FILE_MATCH_INSENSITIVE)
+    key_file->compare_func = (GCompareFunc) g_ascii_strcasecmp;
+  else
+    key_file->compare_func = (GCompareFunc) strcmp;
+
   g_key_file_parse_data (key_file, data, length, &key_file_error);
   
   if (key_file_error)
@@ -813,6 +824,13 @@
 
   group_name = g_strndup (group_name_start, 
                           group_name_end - group_name_start);
+  if (key_file->flags & G_KEY_FILE_MATCH_INSENSITIVE)
+    {
+      gchar *tmp;
+      tmp = g_ascii_strdown (group_name, -1);
+      g_free (group_name);
+      group_name = tmp;
+    }
   
   if (!g_key_file_is_group_name (group_name))
     {
@@ -861,6 +879,13 @@
   g_warn_if_fail (key_len <= length);
 
   key = g_strndup (line, key_len - 1);
+  if (key_file->flags & G_KEY_FILE_MATCH_INSENSITIVE)
+    {
+      gchar *tmp;
+      tmp = g_ascii_strdown (key, -1);
+      g_free (key);
+      key = tmp;
+    }
 
   if (!g_key_file_is_key_name (key))
     {
@@ -884,9 +909,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)
         {
@@ -3262,7 +3287,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;
     }
 
@@ -3291,7 +3316,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;
     }
 
@@ -3698,9 +3723,9 @@
 {
   gchar *value_utf8;
 
-  if (strcmp (value, "true") == 0 || strcmp (value, "1") == 0)
+  if (key_file->compare_func (value, "true") == 0 || strcmp (value, "1") == 0)
     return TRUE;
-  else if (strcmp (value, "false") == 0 || strcmp (value, "0") == 0)
+  else if (key_file->compare_func (value, "false") == 0 || strcmp (value, "0") == 0)
     return FALSE;
 
   value_utf8 = _g_utf8_make_valid (value);
Index: glib/gkeyfile.h
===================================================================
--- glib/gkeyfile.h	(revisão 7657)
+++ glib/gkeyfile.h	(cópia de trabalho)
@@ -51,7 +51,8 @@
 {
   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);
