aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-06-04 10:35:49 +0200
committerPřemysl Eric Janouch <p@janouch.name>2023-06-04 10:36:42 +0200
commit6277a32fe6b6ccf76882d2eb44c423517eaadf10 (patch)
treef9390158faae4b322c17faff3d5fe2f299a2850a
parent8f0576d6bcd21948ed8fc0318f67a62eef28312b (diff)
downloadfiv-6277a32fe6b6ccf76882d2eb44c423517eaadf10.tar.gz
fiv-6277a32fe6b6ccf76882d2eb44c423517eaadf10.tar.xz
fiv-6277a32fe6b6ccf76882d2eb44c423517eaadf10.zip
Avoid invisible browser entries
-rw-r--r--fiv-browser.c12
1 files 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;