diff --git a/docs/reference/glib/tmpl/date.sgml b/docs/reference/glib/tmpl/date.sgml
index ca82020..b3ae1d9 100644
--- a/docs/reference/glib/tmpl/date.sgml
+++ b/docs/reference/glib/tmpl/date.sgml
@@ -137,13 +137,23 @@ length of the sleep.
 @Returns: 
 
 
-<!-- ##### STRUCT GTimeSpec ##### -->
+<!-- ##### FUNCTION g_get_monotonic_time ##### -->
 <para>
 
 </para>
 
-@tv_sec: 
-@tv_nsec: 
+@void: 
+@Returns: 
+
+
+<!-- ##### FUNCTION g_get_real_time ##### -->
+<para>
+
+</para>
+
+@void: 
+@Returns: 
+
 
 <!-- ##### STRUCT GDate ##### -->
 <para>
diff --git a/docs/reference/glib/tmpl/glib-unused.sgml b/docs/reference/glib/tmpl/glib-unused.sgml
index 7b57189..2fbb3f8 100644
--- a/docs/reference/glib/tmpl/glib-unused.sgml
+++ b/docs/reference/glib/tmpl/glib-unused.sgml
@@ -234,6 +234,60 @@ the end of the string.
 @G_MATCH_EXACT: a pattern matching exactly one string.
 @G_MATCH_LAST: 
 
+<!-- ##### STRUCT GModule ##### -->
+<para>
+The #GModule struct is an opaque data structure to represent a
+<link linkend="glib-Dynamic-Loading-of-Modules">Dynamically-Loaded Module</link>.
+It should only be accessed via the following functions.
+</para>
+
+
+<!-- ##### USER_FUNCTION GModuleCheckInit ##### -->
+<para>
+Specifies the type of the module initialization function.
+<indexterm zone="g-module-check-init"><primary>g_module_check_init</primary></indexterm>
+If a module contains a function named g_module_check_init() it is called
+automatically when the module is loaded. It is passed the #GModule structure
+and should return %NULL on success or a string describing the initialization
+error.
+</para>
+
+@module: the #GModule corresponding to the module which has just been loaded.
+@Returns: %NULL on success, or a string describing the initialization error.
+
+<!-- ##### ENUM GModuleFlags ##### -->
+<para>
+Flags passed to g_module_open(). Note that these flags are
+not supported on all platforms.
+</para>
+
+@G_MODULE_BIND_LAZY: specifies that symbols are only resolved when needed.
+  The default action is to bind all symbols when the module is loaded.
+@G_MODULE_BIND_LOCAL: specifies that symbols in the module should
+  not be added to the global name space.  The default action on most
+  platforms is to place symbols in the module in the global name space,
+  which may cause conflicts with existing symbols.
+@G_MODULE_BIND_MASK: mask for all flags.
+
+<!-- ##### USER_FUNCTION GModuleUnload ##### -->
+<para>
+<indexterm zone="g-module-unload"><primary>g_module_unload</primary></indexterm>
+Specifies the type of the module function called when it is unloaded.
+If a module contains a function named g_module_unload() it is called
+automatically when the module is unloaded.
+It is passed the #GModule structure.
+</para>
+
+@module: the #GModule about to be unloaded.
+
+<!-- ##### STRUCT GTimeSpec ##### -->
+<para>
+
+</para>
+
+@tv_sec: 
+@tv_nsec: 
+
 <!-- ##### USER_FUNCTION GWarningFunc ##### -->
 <para>
 Specifies the type of function passed to g_set_warning_handler().
@@ -295,6 +349,20 @@ not work.
 </para>
 
 
+<!-- ##### MACRO G_MODULE_EXPORT ##### -->
+<para>
+Used to declare functions exported by modules. This is a no-op on Linux and
+Unices, but when compiling for Windows, it marks a symbol to be exported from
+the library or executable being built.
+</para>
+
+
+<!-- ##### MACRO G_MODULE_IMPORT ##### -->
+<para>
+Used to declare functions imported from modules.
+</para>
+
+
 <!-- ##### MACRO NAME_MAX ##### -->
 <para>
 Provided for UNIX emulation on Windows; equivalent to UNIX macro 
@@ -772,6 +840,110 @@ To use this function you must configure glib with the flag
 
 @mem: the memory to check.
 
+<!-- ##### FUNCTION g_module_build_path ##### -->
+<para>
+A portable way to build the filename of a module. The platform-specific
+prefix and suffix are added to the filename, if needed, and the result is
+added to the directory, using the correct separator character.
+</para>
+<para>
+The directory should specify the directory where the module can be found.
+It can be %NULL or an empty string to indicate that the module is in a standard
+platform-specific directory, though this is not recommended since the
+wrong module may be found.
+</para>
+<para>
+For example, calling g_module_build_path() on a Linux system with a @directory
+of <filename>/lib</filename> and a @module_name of "mylibrary" will return 
+<filename>/lib/libmylibrary.so</filename>. On a Windows system, using 
+<filename>\Windows</filename> as the directory it will return
+<filename>\Windows\mylibrary.dll</filename>.
+</para>
+
+@directory: the directory where the module is. This can be %NULL or the empty
+string to indicate that the standard platform-specific directories will be 
+used, though that is not recommended.
+@module_name: the name of the module.
+@Returns: the complete path of the module, including the standard library
+prefix and suffix. This should be freed when no longer needed.
+
+<!-- ##### FUNCTION g_module_close ##### -->
+<para>
+Closes a module.
+</para>
+
+@module: a #GModule to close.
+@Returns: %TRUE on success.
+
+<!-- ##### FUNCTION g_module_error ##### -->
+<para>
+Gets a string describing the last module error.
+</para>
+
+@void: 
+@Returns: a string describing the last module error.
+
+<!-- ##### FUNCTION g_module_make_resident ##### -->
+<para>
+Ensures that a module will never be unloaded.
+Any future g_module_close() calls on the module will be ignored.
+</para>
+
+@module: a #GModule to make permanently resident.
+
+<!-- ##### FUNCTION g_module_name ##### -->
+<para>
+Gets the filename from a #GModule.
+</para>
+
+@module: a #GModule.
+@Returns: the filename of the module, or "main" if the module is the main
+program itself.
+
+<!-- ##### FUNCTION g_module_open ##### -->
+<para>
+Opens a module. If the module has already been opened, its reference
+count is incremented. 
+</para>
+
+<para>
+First of all g_module_open() tries to open @file_name as a module. If
+that fails and @file_name has the ".la"-suffix (and is a libtool archive) 
+it tries to open the corresponding module. If that fails and it doesn't 
+have the proper module suffix for the platform (#G_MODULE_SUFFIX), this 
+suffix will be appended and the corresponding module will be opended. If 
+that fails and @file_name doesn't have the ".la"-suffix, this suffix is 
+appended and g_module_open() tries to open the corresponding module. If 
+eventually that fails as well, %NULL is returned.
+</para>
+
+@file_name: the name of the file containing the module, or %NULL to obtain
+  a #GModule representing the main program itself.
+@flags: the flags used for opening the module. This can be the logical
+OR of any of the #GModuleFlags.
+@Returns: a #GModule on success, or %NULL on failure.
+
+<!-- ##### FUNCTION g_module_supported ##### -->
+<para>
+Checks if modules are supported on the current platform.
+</para>
+
+@void: 
+@Returns: %TRUE if modules are supported.
+
+<!-- ##### FUNCTION g_module_symbol ##### -->
+<para>
+Gets a symbol pointer from a module, such as one exported by #G_MODULE_EXPORT.
+</para>
+<para>
+Note that a valid symbol can be %NULL.
+</para>
+
+@module: a #GModule.
+@symbol_name: the name of the symbol to find.
+@symbol: returns the pointer to the symbol value.
+@Returns: %TRUE on success.
+
 <!-- ##### FUNCTION g_regex_error_quark ##### -->
 <para>
 
@@ -937,6 +1109,46 @@ Turns the argument into a string literal by using the '#' stringizing operator.
 </para>
 
 
+<!-- ##### VARIABLE glib_binary_age ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### FUNCTION glib_check_version ##### -->
+<para>
+
+</para>
+
+@required_major: 
+@required_minor: 
+@required_micro: 
+@Returns: 
+
+<!-- ##### VARIABLE glib_interface_age ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### VARIABLE glib_major_version ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### VARIABLE glib_micro_version ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### VARIABLE glib_minor_version ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### MACRO lseek ##### -->
 <para>
 
diff --git a/docs/reference/glib/tmpl/i18n.sgml b/docs/reference/glib/tmpl/i18n.sgml
index ebcc7d5..1a15d32 100644
--- a/docs/reference/glib/tmpl/i18n.sgml
+++ b/docs/reference/glib/tmpl/i18n.sgml
@@ -237,3 +237,12 @@ Intltool has support for the NC_() macro since version 0.40.1.
 @Returns: 
 
 
+<!-- ##### FUNCTION g_get_locale_variants ##### -->
+<para>
+
+</para>
+
+@locale: 
+@Returns: 
+
+
diff --git a/docs/reference/glib/tmpl/main.sgml b/docs/reference/glib/tmpl/main.sgml
index 506bb7a..cc7ac2d 100644
--- a/docs/reference/glib/tmpl/main.sgml
+++ b/docs/reference/glib/tmpl/main.sgml
@@ -430,6 +430,28 @@ The Main Event Loop
 @func: 
 
 
+<!-- ##### FUNCTION g_main_context_invoke ##### -->
+<para>
+
+</para>
+
+@context: 
+@function: 
+@data: 
+
+
+<!-- ##### FUNCTION g_main_context_invoke_full ##### -->
+<para>
+
+</para>
+
+@context: 
+@priority: 
+@function: 
+@data: 
+@notify: 
+
+
 <!-- ##### FUNCTION g_main_context_get_thread_default ##### -->
 <para>
 
@@ -863,6 +885,33 @@ of the above functions.
 @fd: 
 
 
+<!-- ##### FUNCTION g_source_add_child_source ##### -->
+<para>
+
+</para>
+
+@source: 
+@child_source: 
+
+
+<!-- ##### FUNCTION g_source_remove_child_source ##### -->
+<para>
+
+</para>
+
+@source: 
+@child_source: 
+
+
+<!-- ##### FUNCTION g_source_get_time ##### -->
+<para>
+
+</para>
+
+@source: 
+@Returns: 
+
+
 <!-- ##### FUNCTION g_source_get_current_time ##### -->
 <para>
 
diff --git a/docs/reference/glib/tmpl/messages.sgml b/docs/reference/glib/tmpl/messages.sgml
index 245a775..2c4e8d8 100644
--- a/docs/reference/glib/tmpl/messages.sgml
+++ b/docs/reference/glib/tmpl/messages.sgml
@@ -117,18 +117,15 @@ documentation.
 @args: the parameters to insert into the format string.
 
 
-<!-- ##### FUNCTION g_message ##### -->
+<!-- ##### MACRO g_message ##### -->
 <para>
 A convenience function/macro to log a normal message.
 </para>
 
-@format: 
-@Varargs: 
-<!-- # Unused Parameters # -->
 @...: format string, followed by parameters to insert into the format string (as with printf())
 
 
-<!-- ##### FUNCTION g_warning ##### -->
+<!-- ##### MACRO g_warning ##### -->
 <para>
 A convenience function/macro to log a warning message.
 </para>
@@ -138,13 +135,10 @@ You can make warnings fatal at runtime by setting the %G_DEBUG environment
 variable (see <ulink url="glib-running.html">Running GLib Applications</ulink>).
 </para>
 
-@format: 
-@Varargs: 
-<!-- # Unused Parameters # -->
 @...: format string, followed by parameters to insert into the format string (as with printf())
 
 
-<!-- ##### FUNCTION g_critical ##### -->
+<!-- ##### MACRO g_critical ##### -->
 <para>
 Logs a "critical warning" (#G_LOG_LEVEL_CRITICAL). It's more or less
 application-defined what constitutes a critical vs. a regular
@@ -159,13 +153,10 @@ the %G_DEBUG environment variable (see
 <ulink url="glib-running.html">Running GLib Applications</ulink>).
 </para>
 
-@format: 
-@Varargs: 
-<!-- # Unused Parameters # -->
 @...: format string, followed by parameters to insert into the format string (as with printf())
 
 
-<!-- ##### FUNCTION g_error ##### -->
+<!-- ##### MACRO g_error ##### -->
 <para>
 A convenience function/macro to log an error message.
 Error messages are always fatal, resulting in a call to
@@ -175,22 +166,16 @@ expect. Using this function indicates a bug in your program, i.e. an
 assertion failure.
 </para>
 
-@format: 
-@Varargs: 
-<!-- # Unused Parameters # -->
 @...: format string, followed by parameters to insert into the format string (as with printf())
 
 
-<!-- ##### FUNCTION g_debug ##### -->
+<!-- ##### MACRO g_debug ##### -->
 <para>
 A convenience function/macro to log a debug message.
 </para>
 
-@format: 
-@Varargs: 
-@Since: 2.6
-<!-- # Unused Parameters # -->
 @...: format string, followed by parameters to insert into the format string (as with printf())
+@Since: 2.6
 
 
 <!-- ##### FUNCTION g_log_set_handler ##### -->
diff --git a/docs/reference/glib/tmpl/misc_utils.sgml b/docs/reference/glib/tmpl/misc_utils.sgml
index 6e9d790..91c1e7b 100644
--- a/docs/reference/glib/tmpl/misc_utils.sgml
+++ b/docs/reference/glib/tmpl/misc_utils.sgml
@@ -54,6 +54,15 @@ These are portable utility functions.
 @prgname: 
 
 
+<!-- ##### FUNCTION g_get_environ ##### -->
+<para>
+
+</para>
+
+@void: 
+@Returns: 
+
+
 <!-- ##### FUNCTION g_getenv ##### -->
 <para>
 
@@ -136,6 +145,15 @@ These are portable utility functions.
 @Returns: 
 
 
+<!-- ##### FUNCTION g_get_user_runtime_dir ##### -->
+<para>
+
+</para>
+
+@void: 
+@Returns: 
+
+
 <!-- ##### ENUM GUserDirectory ##### -->
 <para>
 
diff --git a/docs/reference/glib/tmpl/modules.sgml b/docs/reference/glib/tmpl/modules.sgml
index 51329d3..4534232 100644
--- a/docs/reference/glib/tmpl/modules.sgml
+++ b/docs/reference/glib/tmpl/modules.sgml
@@ -102,166 +102,6 @@ just_say_hello (const char *filename, GError **error)
 <!-- ##### SECTION Image ##### -->
 
 
-<!-- ##### STRUCT GModule ##### -->
-<para>
-The #GModule struct is an opaque data structure to represent a
-<link linkend="glib-Dynamic-Loading-of-Modules">Dynamically-Loaded Module</link>.
-It should only be accessed via the following functions.
-</para>
-
-
-<!-- ##### FUNCTION g_module_supported ##### -->
-<para>
-Checks if modules are supported on the current platform.
-</para>
-
-@void: 
-@Returns: %TRUE if modules are supported.
-
-
-<!-- ##### FUNCTION g_module_build_path ##### -->
-<para>
-A portable way to build the filename of a module. The platform-specific
-prefix and suffix are added to the filename, if needed, and the result is
-added to the directory, using the correct separator character.
-</para>
-<para>
-The directory should specify the directory where the module can be found.
-It can be %NULL or an empty string to indicate that the module is in a standard
-platform-specific directory, though this is not recommended since the
-wrong module may be found.
-</para>
-<para>
-For example, calling g_module_build_path() on a Linux system with a @directory
-of <filename>/lib</filename> and a @module_name of "mylibrary" will return 
-<filename>/lib/libmylibrary.so</filename>. On a Windows system, using 
-<filename>\Windows</filename> as the directory it will return
-<filename>\Windows\mylibrary.dll</filename>.
-</para>
-
-@directory: the directory where the module is. This can be %NULL or the empty
-string to indicate that the standard platform-specific directories will be 
-used, though that is not recommended.
-@module_name: the name of the module.
-@Returns: the complete path of the module, including the standard library
-prefix and suffix. This should be freed when no longer needed.
-
-
-<!-- ##### FUNCTION g_module_open ##### -->
-<para>
-Opens a module. If the module has already been opened, its reference
-count is incremented. 
-</para>
-
-<para>
-First of all g_module_open() tries to open @file_name as a module. If
-that fails and @file_name has the ".la"-suffix (and is a libtool archive) 
-it tries to open the corresponding module. If that fails and it doesn't 
-have the proper module suffix for the platform (#G_MODULE_SUFFIX), this 
-suffix will be appended and the corresponding module will be opended. If 
-that fails and @file_name doesn't have the ".la"-suffix, this suffix is 
-appended and g_module_open() tries to open the corresponding module. If 
-eventually that fails as well, %NULL is returned.
-</para>
-
-@file_name: the name of the file containing the module, or %NULL to obtain
-  a #GModule representing the main program itself.
-@flags: the flags used for opening the module. This can be the logical
-OR of any of the #GModuleFlags.
-@Returns: a #GModule on success, or %NULL on failure.
-
-
-<!-- ##### ENUM GModuleFlags ##### -->
-<para>
-Flags passed to g_module_open(). Note that these flags are
-not supported on all platforms.
-</para>
-
-@G_MODULE_BIND_LAZY: specifies that symbols are only resolved when needed.
-  The default action is to bind all symbols when the module is loaded.
-@G_MODULE_BIND_LOCAL: specifies that symbols in the module should
-  not be added to the global name space.  The default action on most
-  platforms is to place symbols in the module in the global name space,
-  which may cause conflicts with existing symbols.
-@G_MODULE_BIND_MASK: mask for all flags.
-
-<!-- ##### FUNCTION g_module_symbol ##### -->
-<para>
-Gets a symbol pointer from a module, such as one exported by #G_MODULE_EXPORT.
-</para>
-<para>
-Note that a valid symbol can be %NULL.
-</para>
-
-@module: a #GModule.
-@symbol_name: the name of the symbol to find.
-@symbol: returns the pointer to the symbol value.
-@Returns: %TRUE on success.
-
-
-<!-- ##### FUNCTION g_module_name ##### -->
-<para>
-Gets the filename from a #GModule.
-</para>
-
-@module: a #GModule.
-@Returns: the filename of the module, or "main" if the module is the main
-program itself.
-
-
-<!-- ##### FUNCTION g_module_make_resident ##### -->
-<para>
-Ensures that a module will never be unloaded.
-Any future g_module_close() calls on the module will be ignored.
-</para>
-
-@module: a #GModule to make permanently resident.
-
-
-<!-- ##### FUNCTION g_module_close ##### -->
-<para>
-Closes a module.
-</para>
-
-@module: a #GModule to close.
-@Returns: %TRUE on success.
-
-
-<!-- ##### FUNCTION g_module_error ##### -->
-<para>
-Gets a string describing the last module error.
-</para>
-
-@void: 
-@Returns: a string describing the last module error.
-
-
-<!-- ##### USER_FUNCTION GModuleCheckInit ##### -->
-<para>
-Specifies the type of the module initialization function.
-<indexterm zone="g-module-check-init"><primary>g_module_check_init</primary></indexterm>
-If a module contains a function named g_module_check_init() it is called
-automatically when the module is loaded. It is passed the #GModule structure
-and should return %NULL on success or a string describing the initialization
-error.
-</para>
-
-@module: the #GModule corresponding to the module which has just been loaded.
-@Returns: %NULL on success, or a string describing the initialization error.
-
-
-<!-- ##### USER_FUNCTION GModuleUnload ##### -->
-<para>
-<indexterm zone="g-module-unload"><primary>g_module_unload</primary></indexterm>
-Specifies the type of the module function called when it is unloaded.
-If a module contains a function named g_module_unload() it is called
-automatically when the module is unloaded.
-It is passed the #GModule structure.
-</para>
-
-@module: the #GModule about to be unloaded.
-
-
 <!-- ##### MACRO G_MODULE_SUFFIX ##### -->
 <para>
 Expands to the proper shared library suffix for the current platform
@@ -271,19 +111,3 @@ for some HP-UX versions this is "sl" and for Windows this is "dll".
 
 
 
-<!-- ##### MACRO G_MODULE_EXPORT ##### -->
-<para>
-Used to declare functions exported by modules. This is a no-op on Linux and
-Unices, but when compiling for Windows, it marks a symbol to be exported from
-the library or executable being built.
-</para>
-
-
-
-<!-- ##### MACRO G_MODULE_IMPORT ##### -->
-<para>
-Used to declare functions imported from modules.
-</para>
-
-
-
diff --git a/docs/reference/glib/tmpl/version.sgml b/docs/reference/glib/tmpl/version.sgml
index 027a0f4..dca4ac9 100644
--- a/docs/reference/glib/tmpl/version.sgml
+++ b/docs/reference/glib/tmpl/version.sgml
@@ -22,47 +22,6 @@ typically use the features described here.
 <!-- ##### SECTION Image ##### -->
 
 
-<!-- ##### VARIABLE glib_major_version ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### VARIABLE glib_minor_version ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### VARIABLE glib_micro_version ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### VARIABLE glib_binary_age ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### VARIABLE glib_interface_age ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### FUNCTION glib_check_version ##### -->
-<para>
-
-</para>
-
-@required_major: 
-@required_minor: 
-@required_micro: 
-@Returns: 
-
-
 <!-- ##### MACRO GLIB_MAJOR_VERSION ##### -->
 <para>
 The major version number of the GLib library.
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index f557538..5965196 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -2356,51 +2356,194 @@ g_app_info_get_all (void)
   return g_list_reverse (infos);
 }
 
-/* Cacheing of mimeinfo.cache and defaults.list files */
+/* Caching of mimeinfo.cache and defaults.list files */
 
+/**
+ * MimeInfoCacheDirItemConstructor:
+ * @table: where to add
+ * @mime_type: MIME type to be added
+ * @desktop_file_ids: names of desktop files, where the MIME type is present
+ *
+ * Creates element in #MimeInfoCacheDirItem.
+ **/
+
+typedef void (*MimeInfoCacheDirItemConstructor) (GHashTable* table,
+						 char *mime_type,
+						 char **desktop_file_ids);
+
+/**
+ * MimeInfoCacheDirItemDestructor:
+ * @value: item to be removed
+ *
+ * Destructs element from #MimeInfoCacheDirItem.
+ **/
+typedef void (*MimeInfoCacheDirItemDestructor) (gpointer value);
+
+/**
+ * MimeInfoCacheDirItemSpecGroup:
+ * @id: name of group in the #GKeyFile
+ * @constructor: Constructs #GHashTable item for particular MIME type and value
+ * @destructor: destructs #GHashTable item
+ *
+ * Description of particular group of #MimeInfoCacheDirItemSpec
+ * represents a particular group in the particular keyfile
+ **/
+typedef struct {
+  gchar* id;
+  void (*constructor)(GHashTable *table, char *mime_type, char **desktop_file_ids);
+  void (*destructor) (gpointer value);
+} MimeInfoCacheDirItemSpecGroup;
+
+/**
+ * MimeInfoCacheDirItemSpec:
+ * @filename: cache file name (file part only)
+ * @groups: array of groups description terminated with item with NULL id
+ *
+ * Description of particular file that is used for manipulation with
+ * #MimeInfoCacheDirItem.
+ *
+ **/
+typedef struct {
+  gchar *filename;
+  MimeInfoCacheDirItemSpecGroup groups[];
+} MimeInfoCacheDirItemSpec;
+
+/**
+ * MimeInfoCacheDirItem:
+ * @timestamp: timestamp of file that the cache reflects
+ * @map: array of maps for particular #GKeyFile groups, values are
+ *     elements specified by #MimeInfoCacheDirItemSpec
+ *
+ * Stores MIME Info Cache for particular cache file. The structure
+ * does not allocate any space for map. Always use
+ * #MimeInfoCacheDirItemMapPad to allocate space for map.
+ **/
+typedef struct {
+  time_t timestamp;
+  GHashTable *map[0];
+} MimeInfoCacheDirItem;
+
+/**
+ * MimeInfoCacheDirItemMapPad:
+ *
+ * Makes a space for storing #MimeInfoCacheDirItem map
+ * elements. Always use immediately after #MimeInfoCacheDirItem.
+**/
+typedef GHashTable *MimeInfoCacheDirItemMapPad;
+
+static void mimeinfo_cache_dir_add_desktop_entries (GHashTable *map,
+						     char       *mime_type,
+						     char      **new_desktop_file_ids);
+static void destroy_info_cache_value (GList *value);
+static const MimeInfoCacheDirItemSpec
+mime_info_cache_dir_item_spec_mimeinfo_cache =
+  {
+    .filename = "mimeinfo.cache",
+    .groups = {
+      {
+	.id = MIME_CACHE_GROUP,
+	.constructor = mimeinfo_cache_dir_add_desktop_entries,
+	.destructor = (MimeInfoCacheDirItemDestructor) destroy_info_cache_value
+      } , {
+	.id = NULL
+      }
+    }
+  };
+
+static const MimeInfoCacheDirItemSpec
+mime_info_cache_dir_item_spec_defaults_list =
+  {
+    .filename = "defaults.list",
+    .groups = {
+      {
+	.id = DEFAULT_APPLICATIONS_GROUP,
+	.constructor = (MimeInfoCacheDirItemConstructor) g_hash_table_replace,
+	.destructor = (MimeInfoCacheDirItemDestructor) g_strfreev
+      } , {
+	.id = NULL
+      }
+    }
+  };
+
+static const MimeInfoCacheDirItemSpec
+mime_info_cache_dir_item_spec_mimeapps_list =
+  {
+    .filename = "mimeapps.list",
+    .groups = {
+      {
+	.id = DEFAULT_APPLICATIONS_GROUP,
+	.constructor = (MimeInfoCacheDirItemConstructor) g_hash_table_replace,
+	.destructor = (MimeInfoCacheDirItemDestructor) g_free
+      } , {
+	.id = ADDED_ASSOCIATIONS_GROUP,
+	.constructor = (MimeInfoCacheDirItemConstructor) g_hash_table_replace,
+	.destructor = (MimeInfoCacheDirItemDestructor) g_strfreev
+      } , {
+	.id = REMOVED_ASSOCIATIONS_GROUP,
+	.constructor = (MimeInfoCacheDirItemConstructor) g_hash_table_replace,
+	.destructor = (MimeInfoCacheDirItemDestructor) g_strfreev
+      } , {
+	.id = NULL
+      }
+    }
+  };
+
+/**
+ * MimeInfoCacheDir:
+ * @path: directory path
+ * @mimeinfo_cache_diritem: dir item with single map of associations
+ *     for mimeinfo.cache
+ * @_mimeinfo_cache_diritem_pad: pad for maps, key = MIME Type, value
+ *     = #GList of desktop file names
+ * @defaults_list_diritem: dir item with single map of defaults for
+ *     defaults.list
+ * @_defaults_list_diritem_pad: pad for maps, key = MIME Type, value =
+ *     desktop file names array
+ * @mimeapps_list_diritem: dir item with three maps: default, added
+ *     and removed apps for mimeapps.list
+ * @_mimeapps_list_diritem_pad: pad for maps, map key = MIME Type,
+ *     value = desktop file name fop default, array of desktop file
+ *     names for added and removed apps
+ *
+ * Stores MIME Info Cache for particular directory.
+ **/
 typedef struct {
   char *path;
-  GHashTable *mime_info_cache_map;
-  GHashTable *defaults_list_map;
-  GHashTable *mimeapps_list_added_map;
-  GHashTable *mimeapps_list_removed_map;
-  GHashTable *mimeapps_list_defaults_map;
-  time_t mime_info_cache_timestamp;
-  time_t defaults_list_timestamp;
-  time_t mimeapps_list_timestamp;
+  MimeInfoCacheDirItem mimeinfo_cache_diritem;
+  MimeInfoCacheDirItemMapPad _mimeinfo_cache_diritem_pad[1];
+  MimeInfoCacheDirItem defaults_list_diritem;
+  MimeInfoCacheDirItemMapPad _defaults_list_diritem_pad[1];
+  MimeInfoCacheDirItem mimeapps_list_diritem;
+  MimeInfoCacheDirItemMapPad _mimeapps_list_diritem_pad[3];
 } MimeInfoCacheDir;
 
+/**
+ * MimeInfoCache:
+ * @dirs: list of #MimeInfoCacheDir items for particular directories
+ * @global_defaults_cache: global results of defaults.list lookup and
+ *     validation (unused?)
+ * @last_stat_time: last time when scan was done
+ * @should_ping_mime_monitor: should be changes monitored (unused?)
+ *
+ * Stores global MIME Info Cache.
+ **/
 typedef struct {
-  GList *dirs;                       /* mimeinfo.cache and defaults.list */
-  GHashTable *global_defaults_cache; /* global results of defaults.list lookup and validation */
+  GList *dirs;                       /*  */
+  GHashTable *global_defaults_cache;
   time_t last_stat_time;
   guint should_ping_mime_monitor : 1;
 } MimeInfoCache;
 
+/**
+ * mime_info_cache:
+ *
+ * Global entry for MIME Info Cache.
+ **/
 static MimeInfoCache *mime_info_cache = NULL;
 G_LOCK_DEFINE_STATIC (mime_info_cache);
 
-static void mime_info_cache_dir_add_desktop_entries (MimeInfoCacheDir  *dir,
-						     const char        *mime_type,
-						     char             **new_desktop_file_ids);
-
 static MimeInfoCache * mime_info_cache_new (void);
 
-static void
-destroy_info_cache_value (gpointer  key, 
-                          GList    *value, 
-                          gpointer  data)
-{
-  g_list_foreach (value, (GFunc)g_free, NULL);
-  g_list_free (value);
-}
-
-static void
-destroy_info_cache_map (GHashTable *info_cache_map)
-{
-  g_hash_table_foreach (info_cache_map, (GHFunc)destroy_info_cache_value, NULL);
-  g_hash_table_destroy (info_cache_map);
-}
 
 static gboolean
 mime_info_cache_dir_out_of_date (MimeInfoCacheDir *dir,
@@ -2443,174 +2586,9 @@ mime_info_cache_blow_global_cache (void)
 }
 
 static void
-mime_info_cache_dir_init (MimeInfoCacheDir *dir)
-{
-  GError *load_error;
-  GKeyFile *key_file;
-  gchar *filename, **mime_types;
-  int i;
-  struct stat buf;
-  
-  load_error = NULL;
-  mime_types = NULL;
-  
-  if (dir->mime_info_cache_map != NULL &&
-      !mime_info_cache_dir_out_of_date (dir, "mimeinfo.cache",
-					&dir->mime_info_cache_timestamp))
-    return;
-  
-  if (dir->mime_info_cache_map != NULL)
-    destroy_info_cache_map (dir->mime_info_cache_map);
-  
-  dir->mime_info_cache_map = g_hash_table_new_full (g_str_hash, g_str_equal,
-						    (GDestroyNotify) g_free,
-						    NULL);
-  
-  key_file = g_key_file_new ();
-  
-  filename = g_build_filename (dir->path, "mimeinfo.cache", NULL);
-  
-  if (g_stat (filename, &buf) < 0)
-    goto error;
-  
-  if (dir->mime_info_cache_timestamp > 0) 
-    mime_info_cache->should_ping_mime_monitor = TRUE;
-  
-  dir->mime_info_cache_timestamp = buf.st_mtime;
-  
-  g_key_file_load_from_file (key_file, filename, G_KEY_FILE_NONE, &load_error);
-  
-  g_free (filename);
-  filename = NULL;
-  
-  if (load_error != NULL)
-    goto error;
-  
-  mime_types = g_key_file_get_keys (key_file, MIME_CACHE_GROUP,
-				    NULL, &load_error);
-  
-  if (load_error != NULL)
-    goto error;
-  
-  for (i = 0; mime_types[i] != NULL; i++)
-    {
-      gchar **desktop_file_ids;
-      char *unaliased_type;
-      desktop_file_ids = g_key_file_get_string_list (key_file,
-						     MIME_CACHE_GROUP,
-						     mime_types[i],
-						     NULL,
-						     NULL);
-      
-      if (desktop_file_ids == NULL)
-	continue;
-
-      unaliased_type = _g_unix_content_type_unalias (mime_types[i]);
-      mime_info_cache_dir_add_desktop_entries (dir,
-					       unaliased_type,
-					       desktop_file_ids);
-      g_free (unaliased_type);
-    
-      g_strfreev (desktop_file_ids);
-    }
-  
-  g_strfreev (mime_types);
-  g_key_file_free (key_file);
-  
-  return;
- error:
-  g_free (filename);
-  g_key_file_free (key_file);
-  
-  if (mime_types != NULL)
-    g_strfreev (mime_types);
-  
-  if (load_error)
-    g_error_free (load_error);
-}
-
-static void
-mime_info_cache_dir_init_defaults_list (MimeInfoCacheDir *dir)
-{
-  GKeyFile *key_file;
-  GError *load_error;
-  gchar *filename, **mime_types;
-  char *unaliased_type;
-  char **desktop_file_ids;
-  int i;
-  struct stat buf;
-
-  load_error = NULL;
-  mime_types = NULL;
-
-  if (dir->defaults_list_map != NULL &&
-      !mime_info_cache_dir_out_of_date (dir, "defaults.list",
-					&dir->defaults_list_timestamp))
-    return;
-  
-  if (dir->defaults_list_map != NULL)
-    g_hash_table_destroy (dir->defaults_list_map);
-  dir->defaults_list_map = g_hash_table_new_full (g_str_hash, g_str_equal,
-						  g_free, (GDestroyNotify)g_strfreev);
-  
-
-  key_file = g_key_file_new ();
-  
-  filename = g_build_filename (dir->path, "defaults.list", NULL);
-  if (g_stat (filename, &buf) < 0)
-    goto error;
-
-  if (dir->defaults_list_timestamp > 0) 
-    mime_info_cache->should_ping_mime_monitor = TRUE;
-
-  dir->defaults_list_timestamp = buf.st_mtime;
-
-  g_key_file_load_from_file (key_file, filename, G_KEY_FILE_NONE, &load_error);
-  g_free (filename);
-  filename = NULL;
-
-  if (load_error != NULL)
-    goto error;
-
-  mime_types = g_key_file_get_keys (key_file, DEFAULT_APPLICATIONS_GROUP,
-				    NULL, NULL);
-  if (mime_types != NULL)
-    {
-      for (i = 0; mime_types[i] != NULL; i++)
-	{
-	  desktop_file_ids = g_key_file_get_string_list (key_file,
-							 DEFAULT_APPLICATIONS_GROUP,
-							 mime_types[i],
-							 NULL,
-							 NULL);
-	  if (desktop_file_ids == NULL)
-	    continue;
-	  
-	  unaliased_type = _g_unix_content_type_unalias (mime_types[i]);
-	  g_hash_table_replace (dir->defaults_list_map,
-				unaliased_type,
-				desktop_file_ids);
-	}
-      
-      g_strfreev (mime_types);
-    }
-
-  g_key_file_free (key_file);
-  return;
-  
- error:
-  g_free (filename);
-  g_key_file_free (key_file);
-  
-  if (mime_types != NULL)
-    g_strfreev (mime_types);
-  
-  if (load_error)
-    g_error_free (load_error);
-}
-
-static void
-mime_info_cache_dir_init_mimeapps_list (MimeInfoCacheDir *dir)
+mime_info_cache_dir_build_cache (MimeInfoCacheDir               *dir,
+				 MimeInfoCacheDirItem           *item,
+				 const MimeInfoCacheDirItemSpec *spec)
 {
   GKeyFile *key_file;
   GError *load_error;
@@ -2618,94 +2596,67 @@ mime_info_cache_dir_init_mimeapps_list (MimeInfoCacheDir *dir)
   char *unaliased_type;
   char **desktop_file_ids;
   char *desktop_id;
-  int i;
   struct stat buf;
+  int hn, i;
 
   load_error = NULL;
-  mime_types = NULL;
 
-  if (dir->mimeapps_list_added_map != NULL &&
-      !mime_info_cache_dir_out_of_date (dir, "mimeapps.list",
-					&dir->mimeapps_list_timestamp))
+  if (item->map[0] != NULL &&
+      !mime_info_cache_dir_out_of_date (dir, spec->filename,
+					&item->timestamp))
     return;
   
-  if (dir->mimeapps_list_added_map != NULL)
-    g_hash_table_destroy (dir->mimeapps_list_added_map);
-  dir->mimeapps_list_added_map = g_hash_table_new_full (g_str_hash, g_str_equal,
-							g_free, (GDestroyNotify)g_strfreev);
-  
-  if (dir->mimeapps_list_removed_map != NULL)
-    g_hash_table_destroy (dir->mimeapps_list_removed_map);
-  dir->mimeapps_list_removed_map = g_hash_table_new_full (g_str_hash, g_str_equal,
-							  g_free, (GDestroyNotify)g_strfreev);
+  for (hn = 0; spec->groups[hn].id != NULL; hn++)
+    {
+      if (item->map[hn] != NULL)
+	g_hash_table_destroy (item->map[hn]);
 
-  if (dir->mimeapps_list_defaults_map != NULL)
-    g_hash_table_destroy (dir->mimeapps_list_defaults_map);
-  dir->mimeapps_list_defaults_map = g_hash_table_new_full (g_str_hash, g_str_equal,
-                                                           g_free, g_free);
+      item->map[hn] = g_hash_table_new_full (g_str_hash, g_str_equal,
+					     g_free, spec->groups[hn].destructor);
+    }
 
   key_file = g_key_file_new ();
   
-  filename = g_build_filename (dir->path, "mimeapps.list", NULL);
+  filename = g_build_filename (dir->path, spec->filename, NULL);
   if (g_stat (filename, &buf) < 0)
     goto error;
 
-  if (dir->mimeapps_list_timestamp > 0) 
+  if (item->timestamp > 0)
     mime_info_cache->should_ping_mime_monitor = TRUE;
 
-  dir->mimeapps_list_timestamp = buf.st_mtime;
+  item->timestamp = buf.st_mtime;
 
   g_key_file_load_from_file (key_file, filename, G_KEY_FILE_NONE, &load_error);
+
   g_free (filename);
   filename = NULL;
 
   if (load_error != NULL)
     goto error;
 
-  mime_types = g_key_file_get_keys (key_file, ADDED_ASSOCIATIONS_GROUP,
-				    NULL, NULL);
-  if (mime_types != NULL)
+  for (hn = 0; spec->groups[hn].id != NULL; hn++)
     {
-      for (i = 0; mime_types[i] != NULL; i++)
-	{
-	  desktop_file_ids = g_key_file_get_string_list (key_file,
-							 ADDED_ASSOCIATIONS_GROUP,
-							 mime_types[i],
-							 NULL,
-							 NULL);
-	  if (desktop_file_ids == NULL)
-	    continue;
-	  
-	  unaliased_type = _g_unix_content_type_unalias (mime_types[i]);
-	  g_hash_table_replace (dir->mimeapps_list_added_map,
-				unaliased_type,
-				desktop_file_ids);
-	}
-      
-      g_strfreev (mime_types);
-    }
-
-  mime_types = g_key_file_get_keys (key_file, REMOVED_ASSOCIATIONS_GROUP,
-				    NULL, NULL);
-  if (mime_types != NULL)
-    {
-      for (i = 0; mime_types[i] != NULL; i++)
+      mime_types = g_key_file_get_keys (key_file, spec->groups[hn].id,
+					NULL, NULL);
+      if (mime_types != NULL)
 	{
-	  desktop_file_ids = g_key_file_get_string_list (key_file,
-							 REMOVED_ASSOCIATIONS_GROUP,
-							 mime_types[i],
-							 NULL,
-							 NULL);
-	  if (desktop_file_ids == NULL)
-	    continue;
+	  for (i = 0; mime_types[i] != NULL; i++)
+	    {
+	      desktop_file_ids = g_key_file_get_string_list (key_file,
+							     spec->groups[hn].id,
+							     mime_types[i],
+							     NULL,
+							     NULL);
+	      if (desktop_file_ids == NULL)
+		continue;
 	  
-	  unaliased_type = _g_unix_content_type_unalias (mime_types[i]);
-	  g_hash_table_replace (dir->mimeapps_list_removed_map,
-				unaliased_type,
-				desktop_file_ids);
+	      unaliased_type = _g_unix_content_type_unalias (mime_types[i]);
+	      spec->groups[hn].constructor (item->map[hn],
+					    unaliased_type,
+					    desktop_file_ids);
+	    }
+	  g_strfreev (mime_types);
 	}
-      
-      g_strfreev (mime_types);
     }
 
   mime_types = g_key_file_get_keys (key_file, DEFAULT_APPLICATIONS_GROUP,
@@ -2722,7 +2673,7 @@ mime_info_cache_dir_init_mimeapps_list (MimeInfoCacheDir *dir)
             continue;
 
           unaliased_type = _g_unix_content_type_unalias (mime_types[i]);
-          g_hash_table_replace (dir->mimeapps_list_defaults_map,
+          g_hash_table_replace (dir->mimeapps_list_diritem.map[0],
                                 unaliased_type,
                                 desktop_id);
         }
@@ -2737,9 +2688,6 @@ mime_info_cache_dir_init_mimeapps_list (MimeInfoCacheDir *dir)
   g_free (filename);
   g_key_file_free (key_file);
   
-  if (mime_types != NULL)
-    g_strfreev (mime_types);
-  
   if (load_error)
     g_error_free (load_error);
 }
@@ -2761,59 +2709,87 @@ mime_info_cache_dir_free (MimeInfoCacheDir *dir)
   if (dir == NULL)
     return;
   
-  if (dir->mime_info_cache_map != NULL)
+  if (dir->mimeinfo_cache_diritem.map[0] != NULL)
     {
-      destroy_info_cache_map (dir->mime_info_cache_map);
-      dir->mime_info_cache_map = NULL;
+      g_hash_table_destroy (dir->mimeinfo_cache_diritem.map[0]);
+      dir->mimeinfo_cache_diritem.map[0] = NULL;
       
   }
   
-  if (dir->defaults_list_map != NULL)
+  if (dir->defaults_list_diritem.map[0] != NULL)
     {
-      g_hash_table_destroy (dir->defaults_list_map);
-      dir->defaults_list_map = NULL;
+      g_hash_table_destroy (dir->defaults_list_diritem.map[0]);
+      dir->defaults_list_diritem.map[0] = NULL;
     }
   
-  if (dir->mimeapps_list_added_map != NULL)
+  if (dir->mimeapps_list_diritem.map[0] != NULL)
     {
-      g_hash_table_destroy (dir->mimeapps_list_added_map);
-      dir->mimeapps_list_added_map = NULL;
+      g_hash_table_destroy (dir->mimeapps_list_diritem.map[0]);
+      dir->mimeapps_list_diritem.map[0] = NULL;
     }
   
-  if (dir->mimeapps_list_removed_map != NULL)
+  if (dir->mimeapps_list_diritem.map[1] != NULL)
     {
-      g_hash_table_destroy (dir->mimeapps_list_removed_map);
-      dir->mimeapps_list_removed_map = NULL;
+      g_hash_table_destroy (dir->mimeapps_list_diritem.map[1]);
+      dir->mimeapps_list_diritem.map[1] = NULL;
     }
 
-  if (dir->mimeapps_list_defaults_map != NULL)
+  if (dir->mimeapps_list_diritem.map[2] != NULL)
     {
-      g_hash_table_destroy (dir->mimeapps_list_defaults_map);
-      dir->mimeapps_list_defaults_map = NULL;
+      g_hash_table_destroy (dir->mimeapps_list_diritem.map[2]);
+      dir->mimeapps_list_diritem.map[2] = NULL;
     }
 
   g_free (dir);
 }
 
 static void
-mime_info_cache_dir_add_desktop_entries (MimeInfoCacheDir  *dir,
-					 const char        *mime_type,
-					 char             **new_desktop_file_ids)
+mimeinfo_cache_dir_add_desktop_entries (GHashTable *map,
+					 char       *mime_type,
+					 char      **new_desktop_file_ids)
 {
   GList *desktop_file_ids;
   int i;
   
-  desktop_file_ids = g_hash_table_lookup (dir->mime_info_cache_map,
-					  mime_type);
-  
-  for (i = 0; new_desktop_file_ids[i] != NULL; i++)
+  desktop_file_ids = g_hash_table_lookup (map, mime_type);
+  if (desktop_file_ids)
     {
-      if (!g_list_find_custom (desktop_file_ids, new_desktop_file_ids[i], (GCompareFunc) strcmp))
+      for (i = 0; new_desktop_file_ids[i] != NULL; i++)
+	{
+	  if (g_list_find_custom (desktop_file_ids, new_desktop_file_ids[i],
+				  (GCompareFunc)strcmp))
+	    g_free (new_desktop_file_ids[i]);
+	  else
+	    {
+	      if (g_list_append (desktop_file_ids,
+				 new_desktop_file_ids[i]))
+		{
+		  /* We are appending to a non-empty GList => we can
+		     ignore the return value and skip
+		     g_hash_table_insert(), g_hash_table_steal() (to
+		     not call destructor). */
+		}
+	    }
+	}
+      g_free (mime_type);
+      /* free only new_desktop_file_ids, referred strings are in use */
+      g_free (new_desktop_file_ids);
+    }
+  else
+    {
+      /* done above: desktop_file_ids = NULL */
+      for (i = 0; new_desktop_file_ids[i] != NULL; i++)
 	desktop_file_ids = g_list_append (desktop_file_ids,
-					  g_strdup (new_desktop_file_ids[i]));
+					  new_desktop_file_ids[i]);
+      g_hash_table_insert (map, mime_type, desktop_file_ids);
     }
-  
-  g_hash_table_insert (dir->mime_info_cache_map, g_strdup (mime_type), desktop_file_ids);
+}
+
+static void
+destroy_info_cache_value (GList *value)
+{
+  g_list_foreach (value, (GFunc)g_free, NULL);
+  g_list_free (value);
 }
 
 static void
@@ -2834,10 +2810,12 @@ mime_info_cache_init_dir_lists (void)
       
       if (dir != NULL)
 	{
-	  mime_info_cache_dir_init (dir);
-	  mime_info_cache_dir_init_defaults_list (dir);
-	  mime_info_cache_dir_init_mimeapps_list (dir);
-	  
+	  mime_info_cache_dir_build_cache (dir, &dir->mimeinfo_cache_diritem,
+					   &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_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);
 	}
     }
@@ -2856,9 +2834,12 @@ mime_info_cache_update_dir_lists (void)
 
       /* No need to do this if we had file monitors... */
       mime_info_cache_blow_global_cache ();
-      mime_info_cache_dir_init (dir);
-      mime_info_cache_dir_init_defaults_list (dir);
-      mime_info_cache_dir_init_mimeapps_list (dir);
+      mime_info_cache_dir_build_cache (dir, &dir->mimeinfo_cache_diritem,
+				       &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_dir_build_cache (dir, &dir->mimeapps_list_diritem,
+				       &mime_info_cache_dir_item_spec_mimeapps_list);
       
       tmp = tmp->next;
     }
@@ -3039,7 +3020,7 @@ get_all_desktop_entries_for_mime_type (const char  *base_mime_type,
 	  dir = dir_list->data;
 
           /* Pick the explicit default application */
-          entry = g_hash_table_lookup (dir->mimeapps_list_defaults_map, mime_type);
+	  entry = g_hash_table_lookup (dir->mimeapps_list_diritem.map[0], mime_type);
 
           if (entry != NULL)
             {
@@ -3049,17 +3030,17 @@ get_all_desktop_entries_for_mime_type (const char  *base_mime_type,
             }
 
 	  /* Then added associations from mimeapps.list */
-	  default_entries = g_hash_table_lookup (dir->mimeapps_list_added_map, mime_type);
+	  default_entries = g_hash_table_lookup (dir->mimeapps_list_diritem.map[1], 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);
+	    desktop_entries = append_desktop_entry (desktop_entries, default_entries[j], removed_entries);
 
 	  /* Then removed associations from mimeapps.list */
-	  removed_associations = g_hash_table_lookup (dir->mimeapps_list_removed_map, mime_type);
+	  removed_associations = g_hash_table_lookup (dir->mimeapps_list_diritem.map[2], mime_type);
 	  for (j = 0; removed_associations != NULL && removed_associations[j] != NULL; j++)
 	    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) */
-	  default_entries = g_hash_table_lookup (dir->defaults_list_map, mime_type);
+	  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);
 	}
@@ -3071,7 +3052,7 @@ get_all_desktop_entries_for_mime_type (const char  *base_mime_type,
         {
 	  dir = dir_list->data;
 	
-	  list = g_hash_table_lookup (dir->mime_info_cache_map, mime_type);
+	  list = g_hash_table_lookup (dir->mimeinfo_cache_diritem.map[0], mime_type);
 	  for (tmp = list; tmp != NULL; tmp = tmp->next)
 	    desktop_entries = append_desktop_entry (desktop_entries, tmp->data, removed_entries);
         }
