From 6277a32fe6b6ccf76882d2eb44c423517eaadf10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Sun, 4 Jun 2023 10:35:49 +0200 Subject: Avoid invisible browser entries --- fiv-browser.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fiv-browser.c b/fiv-browser.c index a8db692..3bda18e 100644 --- a/fiv-browser.c +++ b/fiv-browser.c @@ -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 // MIME type, with "-symbolic" prefixes and fallbacks, // 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. - GtkIconInfo *icon_info = gtk_icon_theme_lookup_by_gicon( - gtk_icon_theme_get_default(), entry->icon, self->item_height / 2, - GTK_ICON_LOOKUP_FORCE_SYMBOLIC); + GtkIconTheme *theme = gtk_icon_theme_get_default(); + GtkIconInfo *icon_info = gtk_icon_theme_lookup_by_gicon(theme, entry->icon, + 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) return; -- cgit v1.2.3