Incorrect icons displayed for mimetypes with icons in hicolor theme



mimetype icons which apps have installed the fallback "hicolor" theme
are being rejected in favour of generic fallbacks which are themed in
the current theme, such as text-x-preview.

It seems that the GIO backend is passing a large choice of mime-types
for icons into Nautilus, e.g. for this text-derrived type from gEDA:

"application-x-geda-schematic"
"gnome-mime-application-x-geda-schematic"
"application-x-generic"
"text-x-preview"
"text-x-generic"

My machine has the default Gnome icon theme set. Nautilus passes the
above list of names to gtk_icon_theme_choose_icon(), however the
fallback ordering is along the list nautilus presented, not into the
fallback themes.

This means, (continuing the example), for a gEDA schematic, Nautilus
will prefer to use the text-x-preview icon it can find in that theme,
than the very specific mimetype icon which the gEDA suite installed in
what is supposed to be the fallback theme.

I've hacked up a trial piece of code to try this another way, searching
for each mime-type / content-type name one by one, only continuing to
the more generic names if no icon was found.

Seems to fix the issue for me, but I'm not 100% sure whether it is
"right".

Do we need / want a way to extend gtk_icon_theme_choose_icon() to
explore fallback themes for the first icon name provided before moving
onto the second, third, etc...

Best regards,

Peter Clifton

--- libnautilus-private/nautilus-icon-info.c	2008-03-29 09:40:43.000000000 +0000
+++ ../nautilus-icon-info.c	2008-04-16 03:01:46.000000000 +0100
@@ -387,6 +387,7 @@
 		GtkIconTheme *icon_theme;
 		GtkIconInfo *gtkicon_info;
 		const char *filename;
+		int i;
 
 		if (themed_icon_cache == NULL) {
 			themed_icon_cache =
@@ -399,7 +400,13 @@
 		names = g_themed_icon_get_names (G_THEMED_ICON (icon));
 
 		icon_theme = gtk_icon_theme_get_default ();
-		gtkicon_info = gtk_icon_theme_choose_icon (icon_theme, (const char **)names, size, 0);
+	
+		gtkicon_info = NULL;
+		for (i = 0; names[i] != NULL; i++) {
+			gtkicon_info = gtk_icon_theme_lookup_icon (icon_theme, names[i], size, 0);
+			if (gtkicon_info != NULL)
+				break;
+		}
 
 		if (gtkicon_info == NULL) {
 			return nautilus_icon_info_new_for_pixbuf (NULL);


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