+ if (!content_type) {
+ content_type = g_content_type_from_mime_type ("application/octet-stream");
+ }
+ icon = g_content_type_get_icon (content_type);
+ if (!G_THEMED_ICON (icon))
+ return NULL;
+
+ g_object_get (G_OBJECT (icon), "names", &icon_names, NULL);
+
+ for (cursor = icon_names; cursor; ++cursor) {
+ if (!g_ascii_strcasecmp (*cursor, "gnome-mime-message") ||
+ !g_ascii_strcasecmp (*cursor, "gnome-mime-message-rfc822")) {
+ icon_name = g_strdup ("stock_message-display");
+ break;
+ } else if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default(), *cursor)) {
+ icon_name = g_strdup (*cursor);
+ break;
+ }
+ }
+ g_strfreev (icon_names);
+
+ return icon_name;