char **mime_types;
char **default_entries;
char **removed_associations;
+ gboolean already_found_handler;
int i, j, k;
GPtrArray *array;
char **anc;
{
mime_type = mime_types[i];
+ /* This is true if we already found a handler for a more specific
+ mimetype. If its set we ignore any defaults for the less specific
+ mimetypes. */
+ already_found_handler = (desktop_entries != NULL);
+
/* Go through all apps listed in user and system dirs */
for (dir_list = mime_info_cache->dirs;
dir_list != NULL;
/* Pick the explicit default application if we got no result earlier
* (ie, for more specific mime types)
*/
- if (desktop_entries == NULL)
+ if (!already_found_handler)
{
entry = g_hash_table_lookup (dir->mimeapps_list_defaults_map, mime_type);
default_entries = g_hash_table_lookup (dir->defaults_list_map, mime_type);
for (j = 0; default_entries != NULL && default_entries[j] != NULL; j++)
{
- if (default_entry == NULL && old_default_entry == NULL && desktop_entries == NULL)
+ if (default_entry == NULL && old_default_entry == NULL && !already_found_handler)
old_default_entry = g_strdup (default_entries[j]);
desktop_entries = append_desktop_entry (desktop_entries, default_entries[j], removed_entries);