1
votes

I'm using Glade to design a GUI for my program and I wanted to add a custom icon to a button.

So, I created the button, set Button Content to Label with optional image. Then, I created an GtkImage widget and set the button to use that image:

enter image description here

Now, the image shows up fine in Glade's designer:

enter image description here

but not in the preview:

enter image description here

It just shows the missing resource icon.

I looked at this question on Ask Ubuntu and this one here on SO. However, neither of them provide explanations/solutions for why this is happening this way in Glade, just programmatic solutions.

Does anyone know why this is/how to make the icons show up in the preview?

2

2 Answers

1
votes

The proper way to use custom icons is to install them into the icons folder (system being /usr/share/icons/hicolor/*) and then always reference your icon by icon-name which GtkImage takes. What is happening here is likely a path issue where glade is trying to look for the file and cannot find it which of course would not happen when the standard paths are used.

1
votes

What version of Glade are you using? You might have run into this pre-3.18 bug (https://bugzilla.gnome.org/show_bug.cgi?id=727914). In any case you should try to build the newest version of Glade using JHBuild (https://developer.gnome.org/jhbuild/stable/getting-started.html). That way you always have access to the newest widgets.