Avoid invisible browser entries

This commit is contained in:
Přemysl Eric Janouch 2023-06-04 10:35:49 +02:00
parent 8f0576d6bc
commit 6277a32fe6
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 8 additions and 4 deletions

View File

@ -640,11 +640,15 @@ materialize_icon(FivBrowser *self, Entry *entry)
// of using GLib to look up icons for us, derive a list from a guessed // of using GLib to look up icons for us, derive a list from a guessed
// MIME type, with "-symbolic" prefixes and fallbacks, // MIME type, with "-symbolic" prefixes and fallbacks,
// and use gtk_icon_theme_choose_icon() instead. // and use gtk_icon_theme_choose_icon() instead.
// TODO(p): Make sure we have /some/ icon for every entry.
// TODO(p): We might want to populate these on an as-needed basis. // TODO(p): We might want to populate these on an as-needed basis.
GtkIconInfo *icon_info = gtk_icon_theme_lookup_by_gicon( GtkIconTheme *theme = gtk_icon_theme_get_default();
gtk_icon_theme_get_default(), entry->icon, self->item_height / 2, GtkIconInfo *icon_info = gtk_icon_theme_lookup_by_gicon(theme, entry->icon,
GTK_ICON_LOOKUP_FORCE_SYMBOLIC); self->item_height / 2, GTK_ICON_LOOKUP_FORCE_SYMBOLIC);
if (!icon_info) {
// This icon is included within GTK+.
icon_info = gtk_icon_theme_lookup_icon(theme, "text-x-generic",
self->item_height / 2, GTK_ICON_LOOKUP_FORCE_SYMBOLIC);
}
if (!icon_info) if (!icon_info)
return; return;