Index: glib/gutils.c
===================================================================
--- glib/gutils.c	(revision 6869)
+++ glib/gutils.c	(working copy)
@@ -1429,6 +1429,7 @@
 static  gchar   *g_user_data_dir = NULL;
 static  gchar  **g_system_data_dirs = NULL;
 static  gchar   *g_user_cache_dir = NULL;
+static  gchar   *g_user_thumbnail_dir = NULL;
 static  gchar   *g_user_config_dir = NULL;
 static  gchar  **g_system_config_dirs = NULL;
 
@@ -2167,6 +2168,49 @@
   return cache_dir;
 }
 
+/**
+ * g_get_user_thumbnail_dir:
+ *
+ * Returns a base directory in which to store the user's thumbnail cache.
+ *
+ * On UNIX platforms this is determined using the mechanisms described in
+ * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
+ * XDG Base Directory Specification</ulink> and the Thumbnail Managing
+ * Specification.
+ *
+ * Return value: a string owned by GLib that must not be modified
+ *               or freed.
+ * Since: 2.17.1
+ **/
+G_CONST_RETURN gchar*
+g_get_user_thumbnail_dir (void)
+{
+  gchar *thumbnail_dir;
+
+  if (!g_user_thumbnail_dir)
+    {
+      g_get_any_init ();
+
+      thumbnail_dir = g_build_filename (g_get_user_cache_dir (), "thumbnails", NULL);
+
+      if (!g_file_test (thumbnail_dir, G_FILE_TEST_IS_DIR) && g_home_dir) {
+        gchar *old_style_thumbnail_dir;	      
+        old_style_thumbnail_dir = g_build_filename (g_home_dir, ".thumbnails", NULL);
+        if (g_file_test (old_style_thumbnail_dir, G_FILE_TEST_IS_DIR)) {
+          g_free (thumbnail_dir);
+          thumbnail_dir = old_style_thumbnail_dir;
+        }
+      else
+        g_free (old_style_thumbnail_dir);
+      }
+      g_user_thumbnail_dir = thumbnail_dir;
+    }
+  else
+    thumbnail_dir = g_user_thumbnail_dir;
+
+  return thumbnail_dir;
+}
+
 #ifdef HAVE_CARBON
 
 static gchar *
Index: glib/gutils.h
===================================================================
--- glib/gutils.h	(revision 6869)
+++ glib/gutils.h	(working copy)
@@ -130,6 +130,7 @@
 G_CONST_RETURN gchar*    g_get_user_data_dir      (void);
 G_CONST_RETURN gchar*    g_get_user_config_dir    (void);
 G_CONST_RETURN gchar*    g_get_user_cache_dir     (void);
+G_CONST_RETURN gchar*    g_get_user_thumbnail_dir (void);
 G_CONST_RETURN gchar* G_CONST_RETURN * g_get_system_data_dirs   (void);
 
 #ifdef G_OS_WIN32
