From afc490aa180ad523621f6394a7e1b63c2453af9b Mon Sep 17 00:00:00 2001 From: deepend Date: Tue, 17 Feb 2026 21:19:22 -0700 Subject: [PATCH] Fixed GTK3 menu icon fallback handling so Windows no longer falls through to non-standard zc-menu-* icon IDs (which show as placeholders in many setups). The code now maps each custom menu icon key (new, connect, disconnect, save, help, etc.) to a concrete freedesktop icon name before calling gtk_image_new_from_icon_name(). Kept the existing preferred behavior intact: load bundled SVG menu icons from GResource first (light/dark variant), and only use fallback icon names when those resources are unavailable. --- src/fe-gtk/menu.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/fe-gtk/menu.c b/src/fe-gtk/menu.c index 86aa4297..50d9ccab 100644 --- a/src/fe-gtk/menu.c +++ b/src/fe-gtk/menu.c @@ -2134,6 +2134,7 @@ create_icon_menu (char *labeltext, void *stock_name, int is_stock) char *theme_name_lower = NULL; const char *theme_variant = "light"; char *resource_path; + const char *custom_fallback_icon = NULL; #endif #if !HAVE_GTK3 GtkWidget *img; @@ -2166,9 +2167,45 @@ create_icon_menu (char *labeltext, void *stock_name, int is_stock) g_free (theme_name); } + if (custom_icon) + { + if (g_str_equal (custom_icon, "new")) + custom_fallback_icon = "document-new"; + else if (g_str_equal (custom_icon, "load-plugin")) + custom_fallback_icon = "document-open"; + else if (g_str_equal (custom_icon, "detach")) + custom_fallback_icon = "view-restore"; + else if (g_str_equal (custom_icon, "close")) + custom_fallback_icon = "window-close"; + else if (g_str_equal (custom_icon, "quit")) + custom_fallback_icon = "application-exit"; + else if (g_str_equal (custom_icon, "disconnect")) + custom_fallback_icon = "network-offline"; + else if (g_str_equal (custom_icon, "connect")) + custom_fallback_icon = "network-transmit-receive"; + else if (g_str_equal (custom_icon, "join")) + custom_fallback_icon = "list-add"; + else if (g_str_equal (custom_icon, "chanlist")) + custom_fallback_icon = "view-list"; + else if (g_str_equal (custom_icon, "preferences")) + custom_fallback_icon = "preferences-system"; + else if (g_str_equal (custom_icon, "clear")) + custom_fallback_icon = "edit-clear"; + else if (g_str_equal (custom_icon, "save")) + custom_fallback_icon = "document-save"; + else if (g_str_equal (custom_icon, "search") || g_str_equal (custom_icon, "find")) + custom_fallback_icon = "edit-find"; + else if (g_str_equal (custom_icon, "help")) + custom_fallback_icon = "help-browser"; + else if (g_str_equal (custom_icon, "about")) + custom_fallback_icon = "help-about"; + } + if (!image) { icon_name = gtkutil_icon_name_from_stock (stock_name); + if (!icon_name && custom_fallback_icon) + icon_name = custom_fallback_icon; if (!icon_name) icon_name = stock_name; if (icon_name)