[glib/glib-2-32] Fix the mimetype default fix
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-32] Fix the mimetype default fix
- Date: Sat, 14 Jul 2012 23:22:50 +0000 (UTC)
commit e58a2996ba6f0c46862f2bcd24b0796e1cf48454
Author: Alexander Larsson <alexl redhat com>
Date: Thu Jun 28 15:38:06 2012 +0200
Fix the mimetype default fix
We need to ignore the defaults.list item only when there
was a mimetype handler found in a previous mimetype, not
if one was found for the same mimetype as the one that
is listed in defaults.list (same for the new-style defaults).
gio/gdesktopappinfo.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index 708b710..6752100 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -3223,6 +3223,7 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type,
char **mime_types;
char **default_entries;
char **removed_associations;
+ gboolean already_found_handler;
int i, j, k;
GPtrArray *array;
char **anc;
@@ -3274,6 +3275,11 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type,
{
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;
@@ -3284,7 +3290,7 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type,
/* 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);
@@ -3310,7 +3316,7 @@ get_all_desktop_entries_for_mime_type (const char *base_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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]