Wrong fallback order of mimetype icons in GIO

Bug #280867 reported by Krzysztof Kosinski
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
GLib
Fix Released
Low
glib2.0 (Ubuntu)
Fix Released
Low
Ubuntu Desktop Bugs

Bug Description

Beginning with the version of GIO present in Intrepid Beta, the icons for mimetypes have a wrong fallback order. This is caused by the following snippet in glib2.0-2.18.1/gio/gcontenttype.c, function g_content_type_get_icon:

  G_LOCK (gio_xdgmime);
  xdg_mimetype_icon = g_strdup (xdg_mime_get_icon (type));
  G_UNLOCK (gio_xdgmime);

  (...)

  if (xdg_mimetype_icon)
    icon_names[n++] = xdg_mimetype_icon;

  icon_names[n++] = mimetype_icon;
  icon_names[n++] = legacy_mimetype_icon;
  icon_names[n++] = generic_mimetype_icon;

xdg_mime_get_icon is supposed to get the custom name of the icon for the type specified by the user and defined in /usr/share/mime/icons. The problem is that xdg_mime_get_icon automatically falls back to the generic icon if there is no custom override defined by the user. As a result all mimetypes that have a generic icon assigned completely ignore specific mime icons from the theme (e.g. application-x-rar) and use the generic icon instead (e.g. package-x-generic). This is described in more detail in bug #279911 and bug #278113. Please note that this problem is completely different from bug #217997, because we're speaking about generic icons overriding specific icons from the same theme, not generic icons from current theme overriding hicolor icons.

The fix is to remove this fallback mechanism from xdg_mime_get_icon, and modify the above snippet to also use xdg_mime_get_generic_icon and use the correct fallback order (1. XDG override, 2. specific mimetype icon, 3. legacy specific gnome-mime- icon, 4. XDG generic icon, 5. generic mimetype icon (e.g. application-x-generic). The attached patch does this. Note that xdg_mime_get_icon is only used in gcontenttype.c and only once, so the change won't introduce any regressions.

Revision history for this message
Krzysztof Kosinski (tweenk) wrote :
Revision history for this message
Krzysztof Kosinski (tweenk) wrote :
Changed in glib:
status: Unknown → New
Changed in glib2.0:
assignee: nobody → desktop-bugs
importance: Undecided → Low
status: New → Triaged
Changed in glib:
status: New → Fix Released
Revision history for this message
Pedro Villavicencio (pedro) wrote :

fixed upstream, thanks for reporting.

Changed in glib2.0:
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package glib2.0 - 2.18.2-0ubuntu1

---------------
glib2.0 (2.18.2-0ubuntu1) intrepid; urgency=low

  * New upstream version:
    - Bugs fixed:
    553724 python interpreter path not patched in correctly
    553857 gbacktrace.h requires signal.h
    554790 g_convert() misbehaves with winiconv versions
    555314 mem leak in gmarkup
    554970 segfault when update-desktop-database is not available...
    555121 Improved build-time handling of gio module-dir
    555711 Wrong fallback order of mimetype icons (lp: #280867)
    556334 Warning when building without selinux support

 -- Sebastien Bacher <email address hidden> Sat, 18 Oct 2008 14:52:07 +0200

Changed in glib2.0:
status: Fix Committed → Fix Released
Changed in glib:
importance: Unknown → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.