summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Untz <vuntz@gnome.org>2010-09-10 05:02:20 +0200
committerVincent Untz <vuntz@gnome.org>2010-09-10 05:02:20 +0200
commit7a16049bfbf3f9c63d15a4f62e25d222db121fb2 (patch)
treead282a6d261436ac60026307cfd9953f265692c2
parentf3c5a0da2e3d57871c7fdcb716e8e1274357a449 (diff)
Sort mime types alphabetically in update-desktop-database cache
This makes the cache easier to read, in case some people want to take a look.
-rw-r--r--src/update-desktop-database.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/update-desktop-database.c b/src/update-desktop-database.c
index e2c0d3c..4277fc2 100644
--- a/src/update-desktop-database.c
+++ b/src/update-desktop-database.c
@@ -313,6 +313,7 @@ sync_database (const char *dir, GError **error)
GError *sync_error;
char *temp_cache_file, *cache_file;
FILE *tmp_file;
+ GList *keys, *key;
temp_cache_file = NULL;
sync_error = NULL;
@@ -325,8 +326,16 @@ sync_database (const char *dir, GError **error)
}
fputs ("[MIME Cache]\n", tmp_file);
- g_hash_table_foreach (mime_types_map, (GHFunc) add_mime_type, tmp_file);
+ keys = g_hash_table_get_keys (mime_types_map);
+ keys = g_list_sort (keys, (GCompareFunc) g_strcmp0);
+
+ for (key = keys; key != NULL; key = key->next)
+ add_mime_type (key->data,
+ g_hash_table_lookup (mime_types_map, key->data),
+ tmp_file);
+
+ g_list_free (keys);
fclose (tmp_file);
cache_file = g_build_filename (dir, CACHE_FILENAME, NULL);