Custom symbolic icons not working on my GTK4 app

I want to use custom icons for the tabs of a adw::ViewStack, but I’m having trouble displaying them in my application, even though gtk::IconTheme::has_icon says it exists.

I’ve made this minimal example, which does, in summary:

// register the resources
gio::resources_register_include!("compiled.gresource").expect("Failed to register resources.");

// adds the icon theme
let icon_theme = gtk::IconTheme::for_display(&WidgetExt::display(&window));

// and shows an image
let img = gtk::Image::from_icon_name("one-symbolic");

Here’s the resources XML:

<?xml version="1.0" encoding="UTF-8"?>
    <gresource prefix="/io/github/santiagocezar/maniatic-launcher/icons/scalable/actions/">
        <file compressed="true" preprocess="xml-stripblanks">one-symbolic.svg</file>
        <file compressed="true" preprocess="xml-stripblanks">two-symbolic.svg</file>
        <file compressed="true" preprocess="xml-stripblanks">mania-symbolic.svg</file>

But this is how it looks when I run it:

Made it work by installing librsvg, welp

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.