[glib/glib-2-28] appinfo: Do not override system default handler with less specific one



commit ffbd230d6dc48974cbb0b73de9501f6d4ff7e3db
Author: Vincent Untz <vuntz gnome org>
Date:   Sun Feb 20 10:41:17 2011 +0100

    appinfo: Do not override system default handler with less specific one
    
    We were considering explicitly configured defaults for parent types
    after we already got results for the specific type we're interested in.
    
    This resulted in the explicit default for text/plain to override all
    system defaults for subtypes of text/plain, for example. The explicit
    default should not apply to subtypes that have a system default.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=642797

 gio/gdesktopappinfo.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index 61ef54c..227bacc 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -3059,14 +3059,19 @@ 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);
-
-          if (entry != NULL)
+          /* Pick the explicit default application if we got no result earlier
+           * (ie, for more specific mime types)
+           */
+          if (desktop_entries == NULL)
             {
-              /* Save the default entry if it's the first one we encounter */
-              if (default_entry == NULL)
-                default_entry = g_strdup (entry);
+              entry = g_hash_table_lookup (dir->mimeapps_list_defaults_map, mime_type);
+
+              if (entry != NULL)
+                {
+                  /* Save the default entry if it's the first one we encounter */
+                  if (default_entry == NULL)
+                    default_entry = g_strdup (entry);
+                }
             }
 
 	  /* Then added associations from mimeapps.list */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]