Switched menu resource loading to use bundled PNG assets (instead of SVG paths) for zc-menu-* icons, so menu icon resolution is consistent and no longer depends on SVG/icon-theme availability on different platforms (including Win32 builds).

Updated the GResource manifest so all menu icons now come from data/icons/menu/{light,dark} PNG files and are embedded with to-pixdata preprocessing, ensuring the app uses one unified internal icon set across platforms.

    Generated and added PNG assets for both light and dark menu icon variants under data/icons/menu/ to back the new resource paths used by the GTK menu code.

    Fixed menu icon resource detection to fall back from PNG to SVG when probing zc-menu-* entries, so menu item icon lookup no longer fails just because one format is unavailable at runtime.

    Updated GTK menu icon loading to use gdk_pixbuf_new_from_resource (instead of ..._at_scale) and added explicit fallback order across variant/light and PNG/SVG resources, which addresses the “red no-entry square” missing-icon behavior you reported.

    Kept compatibility with your previous menu resource setup while making loading more resilient on Win32 and other environments where resource/pixbuf behavior differs.
This commit is contained in:
2026-02-18 01:16:03 -07:00
parent dbc517de99
commit 6ce7de23a3
55 changed files with 81 additions and 58 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

View File

@@ -21,58 +21,58 @@
<file alias="tree_server.png" preprocess="to-pixdata">icons/tree_server.png</file>
<file alias="tree_util.png" preprocess="to-pixdata">icons/tree_util.png</file>
<file alias="menu/light/new.svg">icons/menu/light/new.svg</file>
<file alias="menu/light/network-list.svg">icons/menu/light/network-list.svg</file>
<file alias="menu/light/load-plugin.svg">icons/menu/light/load-plugin.svg</file>
<file alias="menu/light/detach.svg">icons/menu/light/detach.svg</file>
<file alias="menu/light/close.svg">icons/menu/light/close.svg</file>
<file alias="menu/light/quit.svg">icons/menu/light/quit.svg</file>
<file alias="menu/light/disconnect.svg">icons/menu/light/disconnect.svg</file>
<file alias="menu/light/connect.svg">icons/menu/light/connect.svg</file>
<file alias="menu/light/join.svg">icons/menu/light/join.svg</file>
<file alias="menu/light/chanlist.svg">icons/menu/light/chanlist.svg</file>
<file alias="menu/light/preferences.svg">icons/menu/light/preferences.svg</file>
<file alias="menu/light/clear.svg">icons/menu/light/clear.svg</file>
<file alias="menu/light/copy.svg">icons/menu/light/copy.svg</file>
<file alias="menu/light/delete.svg">icons/menu/light/delete.svg</file>
<file alias="menu/light/add.svg">icons/menu/light/add.svg</file>
<file alias="menu/light/remove.svg">icons/menu/light/remove.svg</file>
<file alias="menu/light/spell-check.svg">icons/menu/light/spell-check.svg</file>
<file alias="menu/light/save.svg">icons/menu/light/save.svg</file>
<file alias="menu/light/save-as.svg">icons/menu/light/save-as.svg</file>
<file alias="menu/light/refresh.svg">icons/menu/light/refresh.svg</file>
<file alias="menu/light/search.svg">icons/menu/light/search.svg</file>
<file alias="menu/light/find.svg">icons/menu/light/find.svg</file>
<file alias="menu/light/previous.svg">icons/menu/light/previous.svg</file>
<file alias="menu/light/next.svg">icons/menu/light/next.svg</file>
<file alias="menu/light/help.svg">icons/menu/light/help.svg</file>
<file alias="menu/light/about.svg">icons/menu/light/about.svg</file>
<file alias="menu/light/new.png" preprocess="to-pixdata">icons/menu/light/new.png</file>
<file alias="menu/light/network-list.png" preprocess="to-pixdata">icons/menu/light/network-list.png</file>
<file alias="menu/light/load-plugin.png" preprocess="to-pixdata">icons/menu/light/load-plugin.png</file>
<file alias="menu/light/detach.png" preprocess="to-pixdata">icons/menu/light/detach.png</file>
<file alias="menu/light/close.png" preprocess="to-pixdata">icons/menu/light/close.png</file>
<file alias="menu/light/quit.png" preprocess="to-pixdata">icons/menu/light/quit.png</file>
<file alias="menu/light/disconnect.png" preprocess="to-pixdata">icons/menu/light/disconnect.png</file>
<file alias="menu/light/connect.png" preprocess="to-pixdata">icons/menu/light/connect.png</file>
<file alias="menu/light/join.png" preprocess="to-pixdata">icons/menu/light/join.png</file>
<file alias="menu/light/chanlist.png" preprocess="to-pixdata">icons/menu/light/chanlist.png</file>
<file alias="menu/light/preferences.png" preprocess="to-pixdata">icons/menu/light/preferences.png</file>
<file alias="menu/light/clear.png" preprocess="to-pixdata">icons/menu/light/clear.png</file>
<file alias="menu/light/copy.png" preprocess="to-pixdata">icons/menu/light/copy.png</file>
<file alias="menu/light/delete.png" preprocess="to-pixdata">icons/menu/light/delete.png</file>
<file alias="menu/light/add.png" preprocess="to-pixdata">icons/menu/light/add.png</file>
<file alias="menu/light/remove.png" preprocess="to-pixdata">icons/menu/light/remove.png</file>
<file alias="menu/light/spell-check.png" preprocess="to-pixdata">icons/menu/light/spell-check.png</file>
<file alias="menu/light/save.png" preprocess="to-pixdata">icons/menu/light/save.png</file>
<file alias="menu/light/save-as.png" preprocess="to-pixdata">icons/menu/light/save-as.png</file>
<file alias="menu/light/refresh.png" preprocess="to-pixdata">icons/menu/light/refresh.png</file>
<file alias="menu/light/search.png" preprocess="to-pixdata">icons/menu/light/search.png</file>
<file alias="menu/light/find.png" preprocess="to-pixdata">icons/menu/light/find.png</file>
<file alias="menu/light/previous.png" preprocess="to-pixdata">icons/menu/light/previous.png</file>
<file alias="menu/light/next.png" preprocess="to-pixdata">icons/menu/light/next.png</file>
<file alias="menu/light/help.png" preprocess="to-pixdata">icons/menu/light/help.png</file>
<file alias="menu/light/about.png" preprocess="to-pixdata">icons/menu/light/about.png</file>
<file alias="menu/dark/new.svg">icons/menu/dark/new.svg</file>
<file alias="menu/dark/network-list.svg">icons/menu/dark/network-list.svg</file>
<file alias="menu/dark/load-plugin.svg">icons/menu/dark/load-plugin.svg</file>
<file alias="menu/dark/detach.svg">icons/menu/dark/detach.svg</file>
<file alias="menu/dark/close.svg">icons/menu/dark/close.svg</file>
<file alias="menu/dark/quit.svg">icons/menu/dark/quit.svg</file>
<file alias="menu/dark/disconnect.svg">icons/menu/dark/disconnect.svg</file>
<file alias="menu/dark/connect.svg">icons/menu/dark/connect.svg</file>
<file alias="menu/dark/join.svg">icons/menu/dark/join.svg</file>
<file alias="menu/dark/chanlist.svg">icons/menu/dark/chanlist.svg</file>
<file alias="menu/dark/preferences.svg">icons/menu/dark/preferences.svg</file>
<file alias="menu/dark/clear.svg">icons/menu/dark/clear.svg</file>
<file alias="menu/dark/copy.svg">icons/menu/dark/copy.svg</file>
<file alias="menu/dark/delete.svg">icons/menu/dark/delete.svg</file>
<file alias="menu/dark/add.svg">icons/menu/dark/add.svg</file>
<file alias="menu/dark/remove.svg">icons/menu/dark/remove.svg</file>
<file alias="menu/dark/spell-check.svg">icons/menu/dark/spell-check.svg</file>
<file alias="menu/dark/save.svg">icons/menu/dark/save.svg</file>
<file alias="menu/dark/save-as.svg">icons/menu/dark/save-as.svg</file>
<file alias="menu/dark/refresh.svg">icons/menu/dark/refresh.svg</file>
<file alias="menu/dark/search.svg">icons/menu/dark/search.svg</file>
<file alias="menu/dark/find.svg">icons/menu/dark/find.svg</file>
<file alias="menu/dark/previous.svg">icons/menu/dark/previous.svg</file>
<file alias="menu/dark/next.svg">icons/menu/dark/next.svg</file>
<file alias="menu/dark/help.svg">icons/menu/dark/help.svg</file>
<file alias="menu/dark/about.svg">icons/menu/dark/about.svg</file>
<file alias="menu/dark/new.png" preprocess="to-pixdata">icons/menu/dark/new.png</file>
<file alias="menu/dark/network-list.png" preprocess="to-pixdata">icons/menu/dark/network-list.png</file>
<file alias="menu/dark/load-plugin.png" preprocess="to-pixdata">icons/menu/dark/load-plugin.png</file>
<file alias="menu/dark/detach.png" preprocess="to-pixdata">icons/menu/dark/detach.png</file>
<file alias="menu/dark/close.png" preprocess="to-pixdata">icons/menu/dark/close.png</file>
<file alias="menu/dark/quit.png" preprocess="to-pixdata">icons/menu/dark/quit.png</file>
<file alias="menu/dark/disconnect.png" preprocess="to-pixdata">icons/menu/dark/disconnect.png</file>
<file alias="menu/dark/connect.png" preprocess="to-pixdata">icons/menu/dark/connect.png</file>
<file alias="menu/dark/join.png" preprocess="to-pixdata">icons/menu/dark/join.png</file>
<file alias="menu/dark/chanlist.png" preprocess="to-pixdata">icons/menu/dark/chanlist.png</file>
<file alias="menu/dark/preferences.png" preprocess="to-pixdata">icons/menu/dark/preferences.png</file>
<file alias="menu/dark/clear.png" preprocess="to-pixdata">icons/menu/dark/clear.png</file>
<file alias="menu/dark/copy.png" preprocess="to-pixdata">icons/menu/dark/copy.png</file>
<file alias="menu/dark/delete.png" preprocess="to-pixdata">icons/menu/dark/delete.png</file>
<file alias="menu/dark/add.png" preprocess="to-pixdata">icons/menu/dark/add.png</file>
<file alias="menu/dark/remove.png" preprocess="to-pixdata">icons/menu/dark/remove.png</file>
<file alias="menu/dark/spell-check.png" preprocess="to-pixdata">icons/menu/dark/spell-check.png</file>
<file alias="menu/dark/save.png" preprocess="to-pixdata">icons/menu/dark/save.png</file>
<file alias="menu/dark/save-as.png" preprocess="to-pixdata">icons/menu/dark/save-as.png</file>
<file alias="menu/dark/refresh.png" preprocess="to-pixdata">icons/menu/dark/refresh.png</file>
<file alias="menu/dark/search.png" preprocess="to-pixdata">icons/menu/dark/search.png</file>
<file alias="menu/dark/find.png" preprocess="to-pixdata">icons/menu/dark/find.png</file>
<file alias="menu/dark/previous.png" preprocess="to-pixdata">icons/menu/dark/previous.png</file>
<file alias="menu/dark/next.png" preprocess="to-pixdata">icons/menu/dark/next.png</file>
<file alias="menu/dark/help.png" preprocess="to-pixdata">icons/menu/dark/help.png</file>
<file alias="menu/dark/about.png" preprocess="to-pixdata">icons/menu/dark/about.png</file>
</gresource>
</gresources>

View File

@@ -220,8 +220,14 @@ gtkutil_menu_icon_pixbuf_new (const char *icon_name)
if (!icon_name || !g_str_has_prefix (icon_name, "zc-menu-"))
return NULL;
resource_path = g_strdup_printf ("/icons/menu/light/%s.png", icon_name + strlen ("zc-menu-"));
pixbuf = gdk_pixbuf_new_from_resource (resource_path, NULL);
if (!pixbuf)
{
g_free (resource_path);
resource_path = g_strdup_printf ("/icons/menu/light/%s.svg", icon_name + strlen ("zc-menu-"));
pixbuf = gdk_pixbuf_new_from_resource_at_scale (resource_path, -1, -1, TRUE, NULL);
pixbuf = gdk_pixbuf_new_from_resource (resource_path, NULL);
}
g_free (resource_path);
return pixbuf;
@@ -326,14 +332,25 @@ gtkutil_menu_icon_image_new (const char *icon_name, GtkIconSize size)
return NULL;
variant = gtkutil_menu_icon_theme_variant ();
resource_path = g_strdup_printf ("/icons/menu/%s/%s.png", variant, icon_name + strlen ("zc-menu-"));
if (!g_resources_get_info (resource_path, G_RESOURCE_LOOKUP_FLAGS_NONE, NULL, NULL, NULL))
{
g_free (resource_path);
resource_path = g_strdup_printf ("/icons/menu/light/%s.png", icon_name + strlen ("zc-menu-"));
}
pixbuf = gdk_pixbuf_new_from_resource (resource_path, NULL);
if (!pixbuf)
{
g_free (resource_path);
resource_path = g_strdup_printf ("/icons/menu/%s/%s.svg", variant, icon_name + strlen ("zc-menu-"));
if (!g_resources_get_info (resource_path, G_RESOURCE_LOOKUP_FLAGS_NONE, NULL, NULL, NULL))
{
g_free (resource_path);
resource_path = g_strdup_printf ("/icons/menu/light/%s.svg", icon_name + strlen ("zc-menu-"));
}
pixbuf = gdk_pixbuf_new_from_resource_at_scale (resource_path, -1, -1, TRUE, NULL);
pixbuf = gdk_pixbuf_new_from_resource (resource_path, NULL);
}
if (pixbuf)
{
image = gtk_image_new_from_pixbuf (pixbuf);

View File

@@ -74,8 +74,14 @@ menu_icon_exists_in_resource (const char *icon_name)
if (!icon_name || !g_str_has_prefix (icon_name, "zc-menu-"))
return FALSE;
resource_path = g_strdup_printf ("/icons/menu/light/%s.png", icon_name + strlen ("zc-menu-"));
found = g_resources_get_info (resource_path, G_RESOURCE_LOOKUP_FLAGS_NONE, NULL, NULL, NULL);
if (!found)
{
g_free (resource_path);
resource_path = g_strdup_printf ("/icons/menu/light/%s.svg", icon_name + strlen ("zc-menu-"));
found = g_resources_get_info (resource_path, G_RESOURCE_LOOKUP_FLAGS_NONE, NULL, NULL, NULL);
}
g_free (resource_path);
return found;