I'm currently testing a GTK 2 version of a program on systems using GTK 2.6, namely Ubuntu 5.04 and Fedora Core 4. I have the issue there that I am unable to create image-only buttons without a label. On later GTK versions (tested with Ubuntu 6.06, Fedora 8 and 10) this works. It looks like this:
Ubuntu 5.04 and Fedora 4 Core:
Ubuntu 6.06 (and similar in Fedora 8 and 10):
I've downloaded GTK 2.6 to find a clue in its documentation, but so far I have not found out why this is happening.
The code I use for image-only buttons is this:
GtkWidget *button = gtk_button_new ();
gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_BUTTON)); // Example
What am I missing here?
(The program is supposed to also run on old and low-end systems, that's why I am bothering with this.)
EDIT
It seems that the behaviour which I had expected was introduced with version 2.8.14, that's why it worked on Ubuntu 6.06 which uses GTK 2.10. This was not obvious to me from reading the documentation.
Packing a stock image into a button by using gtk_container_add()
is a way to create labelless image-only buttons when using earlier versions.