glib r7589 - in branches/glib-2-18/gio: . xdgmime



Author: matthiasc
Date: Fri Oct 10 05:14:06 2008
New Revision: 7589
URL: http://svn.gnome.org/viewvc/glib?rev=7589&view=rev

Log:
        Bug 555711 â Wrong fallback order of mimetype icons

        * gcontenttype.c: Don't prefer generic icons over
        default mimetype icons.

        * xdgmime/xdgmimecache.c (xdg_mime_cache_get_icon):
        * xdgmime/xdgmime.c (xdg_mime_get_icon): Don't fall back
        to generic icons.
        Patch by Krysztof KosiÅski



Modified:
   branches/glib-2-18/gio/ChangeLog
   branches/glib-2-18/gio/gcontenttype.c
   branches/glib-2-18/gio/xdgmime/xdgmime.c
   branches/glib-2-18/gio/xdgmime/xdgmimecache.c

Modified: branches/glib-2-18/gio/gcontenttype.c
==============================================================================
--- branches/glib-2-18/gio/gcontenttype.c	(original)
+++ branches/glib-2-18/gio/gcontenttype.c	Fri Oct 10 05:14:06 2008
@@ -747,6 +747,7 @@
 {
   char *mimetype_icon, *generic_mimetype_icon, *q;
   char *xdg_mimetype_icon, *legacy_mimetype_icon;
+  char *xdg_mimetype_generic_icon;
   char *icon_names[4];
   int n = 0;
   const char *p;
@@ -756,6 +757,7 @@
   
   G_LOCK (gio_xdgmime);
   xdg_mimetype_icon = g_strdup (xdg_mime_get_icon (type));
+  xdg_mimetype_generic_icon = g_strdup (xdg_mime_get_generic_icon (type));
   G_UNLOCK (gio_xdgmime);
 
   mimetype_icon = g_strdup (type);
@@ -780,6 +782,10 @@
 
   icon_names[n++] = mimetype_icon;
   icon_names[n++] = legacy_mimetype_icon;
+
+  if (xdg_mimetype_generic_icon)
+    icon_names[n++] = xdg_mimetype_generic_icon;
+
   icon_names[n++] = generic_mimetype_icon;
   
   themed_icon = g_themed_icon_new_from_names (icon_names, n);

Modified: branches/glib-2-18/gio/xdgmime/xdgmime.c
==============================================================================
--- branches/glib-2-18/gio/xdgmime/xdgmime.c	(original)
+++ branches/glib-2-18/gio/xdgmime/xdgmime.c	Fri Oct 10 05:14:06 2008
@@ -913,12 +913,7 @@
   if (_caches)
     return _xdg_mime_cache_get_icon (mime);
 
-  icon = _xdg_mime_icon_list_lookup (icon_list, mime);
-
-  if (!icon)
-    icon = xdg_mime_get_generic_icon (mime);
-
-  return icon;
+  return _xdg_mime_icon_list_lookup (icon_list, mime);
 }
 
 const char *

Modified: branches/glib-2-18/gio/xdgmime/xdgmimecache.c
==============================================================================
--- branches/glib-2-18/gio/xdgmime/xdgmimecache.c	(original)
+++ branches/glib-2-18/gio/xdgmime/xdgmimecache.c	Fri Oct 10 05:14:06 2008
@@ -953,14 +953,7 @@
 const char *
 _xdg_mime_cache_get_icon (const char *mime)
 {
-  const char *icon;
- 
-  icon = cache_lookup_icon (mime, 32);
- 
-  if (icon == NULL)
-    icon = _xdg_mime_cache_get_generic_icon (mime);
-
-  return icon;
+  return cache_lookup_icon (mime, 32);
 }
 
 static void



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