78 + if os.path.isfile("%s/%s.%s" % (THEME_PATH, potential_icon, ICON_EXTENSION)):
This is still a fstat() for each result, and that's expensive. How about just having a static dict that would map the languages to a mimetype(/content type), doing a lookup in that dict and using g_content_type_get_icon().
78 + if os.path. isfile( "%s/%s. %s" % (THEME_PATH, potential_icon, ICON_EXTENSION)):
This is still a fstat() for each result, and that's expensive. How about just having a static dict that would map the languages to a mimetype(/content type), doing a lookup in that dict and using g_content_ type_get_ icon().