diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index c95be78..400cdfd 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -2073,6 +2073,10 @@ typedef struct {
   MimeInfoCacheDirItem defaults_list_diritem;
   /* map key = MIME Type, value = desktop file name */
   MimeInfoCacheDirItemMapPad _defaults_list_diritem_pad[1];
+  /* {enviro-}defaults.list: dir item with single map of defaults */
+  MimeInfoCacheDirItem env_defaults_list_diritem;
+  /* map key = MIME Type, value = desktop file name */
+  MimeInfoCacheDirItemMapPad _env_defaults_list_diritem_pad[1];
   /* mimeapps.list: dir item with two maps: added and removed apps */
   MimeInfoCacheDirItem mimeapps_list_diritem;
   /* map key = MIME Type, value = desktop file name */
@@ -2093,6 +2097,8 @@ typedef struct {
 static MimeInfoCache *mime_info_cache = NULL;
 G_LOCK_DEFINE_STATIC (mime_info_cache);
 
+static MimeInfoCacheDirItemSpec *mime_info_cache_dir_item_spec_env_defaults_list_ptr = NULL;
+
 static MimeInfoCache * mime_info_cache_new (void);
 
 
@@ -2244,6 +2250,13 @@ mime_info_cache_dir_free (MimeInfoCacheDir *dir)
       
   }
   
+  if (mime_info_cache_dir_item_spec_env_defaults_list_ptr)
+    if (dir->env_defaults_list_diritem.map[0] != NULL)
+      {
+	g_hash_table_destroy (dir->env_defaults_list_diritem.map[0]);
+	dir->env_defaults_list_diritem.map[0] = NULL;
+      }
+
   if (dir->defaults_list_diritem.map[0] != NULL)
     {
       g_hash_table_destroy (dir->defaults_list_diritem.map[0]);
@@ -2315,6 +2328,34 @@ destroy_info_cache_value (GList *value)
 }
 
 static void
+mime_info_cache_init_desktop_defaults (void)
+{
+  if (!mime_info_cache_dir_item_spec_env_defaults_list_ptr)
+    {
+      const gchar *env;
+      gchar *filename;
+      env = g_getenv ("XDG_DESKTOP_PREFIX");
+      if (env)
+	{
+	  filename = g_strdup_printf ("%sdefaults.list", env);
+	  goto set_env;
+	}
+      else
+	{
+	  env = g_getenv ("DESKTOP_SESSION");
+	  if (!env)
+	    return;
+	  filename = g_strdup_printf ("%s-defaults.list", env);
+	}
+    set_env:
+      mime_info_cache_dir_item_spec_env_defaults_list_ptr =
+	g_memdup (&mime_info_cache_dir_item_spec_defaults_list,
+		  sizeof (MimeInfoCacheDirItemSpec) + 2 * sizeof (gchar*));
+      mime_info_cache_dir_item_spec_env_defaults_list_ptr->filename = filename;
+    }
+}
+
+static void
 mime_info_cache_init_dir_lists (void)
 {
   const char * const *dirs;
@@ -2336,6 +2377,10 @@ mime_info_cache_init_dir_lists (void)
 					   &mime_info_cache_dir_item_spec_mimeinfo_cache);
 	  mime_info_cache_dir_build_cache (dir, &dir->defaults_list_diritem,
 					   &mime_info_cache_dir_item_spec_defaults_list);
+	  mime_info_cache_init_desktop_defaults ();
+	  if (mime_info_cache_dir_item_spec_env_defaults_list_ptr)
+	    mime_info_cache_dir_build_cache (dir, &dir->env_defaults_list_diritem,
+					     mime_info_cache_dir_item_spec_env_defaults_list_ptr);
 	  mime_info_cache_dir_build_cache (dir, &dir->mimeapps_list_diritem,
 					   &mime_info_cache_dir_item_spec_mimeapps_list);
 	  mime_info_cache->dirs = g_list_append (mime_info_cache->dirs, dir);
@@ -2360,6 +2405,9 @@ mime_info_cache_update_dir_lists (void)
 				       &mime_info_cache_dir_item_spec_mimeinfo_cache);
       mime_info_cache_dir_build_cache (dir, &dir->defaults_list_diritem,
 				       &mime_info_cache_dir_item_spec_defaults_list);
+      if (mime_info_cache_dir_item_spec_env_defaults_list_ptr)
+	mime_info_cache_dir_build_cache (dir, &dir->env_defaults_list_diritem,
+					 mime_info_cache_dir_item_spec_env_defaults_list_ptr);
       mime_info_cache_dir_build_cache (dir, &dir->mimeapps_list_diritem,
 				       &mime_info_cache_dir_item_spec_mimeapps_list);
       
@@ -2540,6 +2588,12 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type,
 	    removed_entries = append_desktop_entry (removed_entries, removed_associations[j], NULL);
 
 	  /* Then system defaults (or old per-user config) (using removed associations from this dir or earlier) */
+	  if (mime_info_cache_dir_item_spec_env_defaults_list_ptr)
+	    {
+	      default_entries = g_hash_table_lookup (dir->env_defaults_list_diritem.map[0], mime_type);
+	      for (j = 0; default_entries != NULL && default_entries[j] != NULL; j++)
+		desktop_entries = append_desktop_entry (desktop_entries, default_entries[j], removed_entries);
+	    }
 	  default_entries = g_hash_table_lookup (dir->defaults_list_diritem.map[0], mime_type);
 	  for (j = 0; default_entries != NULL && default_entries[j] != NULL; j++)
 	    desktop_entries = append_desktop_entry (desktop_entries, default_entries[j], removed_entries);
diff --git a/gio/gfile.c b/gio/gfile.c
index 9fd10ca..0af3e09 100644
--- a/gio/gfile.c
+++ b/gio/gfile.c
@@ -64,6 +64,9 @@
  * file content I/O is implemented as streaming operations (see #GInputStream and 
  * #GOutputStream).
  *
+ * Before any use of #GFile,
+ * g_type_init() must be called explicitly or implicitly.
+ *
  * To construct a #GFile, you can use: 
  * g_file_new_for_path() if you have a path.
  * g_file_new_for_uri() if you have a URI.
