summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Untz <vuntz@gnome.org>2013-01-07 09:02:08 +0100
committerVincent Untz <vuntz@gnome.org>2013-01-07 09:02:08 +0100
commitf0a269e1d65843822915faa1bb020da8b6b9954c (patch)
tree9aab155ae8bd3c2eb1ab6146ef5cfc3a9dc98a13
parentee609e13bbdab6385721b2f27c84f34a049c2fb4 (diff)
update-desktop-database: List only once a desktop file per mime type
If a desktop file is registering the same mime type more than once (useless but okay), the desktop file was listed more than once for that mime type in mimeinfo.cache. It's easy to avoid, so make sure we only have a desktop file once per mime type.
-rw-r--r--src/update-desktop-database.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/update-desktop-database.c b/src/update-desktop-database.c
index ffc1440..7f48357 100644
--- a/src/update-desktop-database.c
+++ b/src/update-desktop-database.c
@@ -83,6 +83,13 @@ cache_desktop_file (const char *desktop_file,
desktop_files = (GList *) g_hash_table_lookup (mime_types_map, mime_type);
+ /* do not add twice a desktop file mentioning the mime type more than once
+ * (no need to use g_list_find() because we cache all mime types registered
+ * by a desktop file before moving to another desktop file) */
+ if (desktop_files &&
+ strcmp (desktop_file, (const char *) desktop_files->data) == 0)
+ return;
+
desktop_files = g_list_prepend (desktop_files, g_strdup (desktop_file));
g_hash_table_insert (mime_types_map, g_strdup (mime_type), desktop_files);
}