Standardized GTK3 menu icon resolution so stock-style menu icons are first mapped to the bundled zc-menu-* names (which are backed by data/icons/menu/...), but only for menu-sized icon requests. This keeps non-menu button icons unaffected while making menu icons consistent.

Updated menu construction paths to resolve both zc-menu-* and legacy gtk-* stock names through one custom mapping before loading icons from the bundled menu icon assets, with fallback to light theme assets and then theme icon names. This affects both quick/user menus and standard icon menu items.
This commit is contained in:
2026-02-18 00:00:59 -07:00
parent ebf695abdf
commit bdfabcf800
2 changed files with 131 additions and 4 deletions

View File

@@ -62,6 +62,53 @@ struct file_req
int flags; /* FRF_* flags */
};
#if HAVE_GTK3
static const char *
gtkutil_menu_custom_icon_from_stock (const char *stock_name)
{
static const struct
{
const char *stock;
const char *custom_icon;
} icon_map[] = {
{ "gtk-new", "zc-menu-new" },
{ "gtk-index", "zc-menu-network-list" },
{ "gtk-revert-to-saved", "zc-menu-load-plugin" },
{ "gtk-redo", "zc-menu-detach" },
{ "gtk-close", "zc-menu-close" },
{ "gtk-quit", "zc-menu-quit" },
{ "gtk-disconnect", "zc-menu-disconnect" },
{ "gtk-connect", "zc-menu-connect" },
{ "gtk-jump-to", "zc-menu-join" },
{ "gtk-preferences", "zc-menu-preferences" },
{ "gtk-clear", "zc-menu-clear" },
{ "gtk-copy", "zc-menu-copy" },
{ "gtk-delete", "zc-menu-delete" },
{ "gtk-add", "zc-menu-add" },
{ "gtk-remove", "zc-menu-remove" },
{ "gtk-spell-check", "zc-menu-spell-check" },
{ "gtk-save", "zc-menu-save" },
{ "gtk-refresh", "zc-menu-refresh" },
{ "gtk-justify-left", "zc-menu-search" },
{ "gtk-find", "zc-menu-find" },
{ "gtk-help", "zc-menu-help" },
{ "gtk-about", "zc-menu-about" },
};
size_t i;
if (!stock_name)
return NULL;
for (i = 0; i < G_N_ELEMENTS (icon_map); i++)
{
if (strcmp (stock_name, icon_map[i].stock) == 0)
return icon_map[i].custom_icon;
}
return NULL;
}
#endif
#if HAVE_GTK3
const char *
gtkutil_icon_name_from_stock (const char *stock_name)
@@ -197,7 +244,16 @@ gtkutil_image_new_from_stock (const char *stock, GtkIconSize size)
{
#if HAVE_GTK3
GtkWidget *image;
const char *icon_name = gtkutil_icon_name_from_stock (stock);
const char *icon_name;
icon_name = gtkutil_icon_name_from_stock (stock);
if (size == GTK_ICON_SIZE_MENU)
{
const char *menu_icon_name = gtkutil_menu_custom_icon_from_stock (stock);
if (menu_icon_name)
icon_name = menu_icon_name;
}
image = gtkutil_menu_icon_image_new (icon_name, size);
if (image)