[libxfcegui4] xfce_iconbutton

Jasper Huijsmans jasper at moongroup.com
Tue Oct 8 19:22:18 CEST 2002


Hi Olivier,

You were working so hard on the xfce widgets I wanted to try and
contribute something to that effort.

xfce_iconbutton is a gtk_button with an automatically scaled icon. It's
based on GtkButton and I just add a gtk_image containing the icon.

It works for me, but the automatic scaling part turned out to be a lot
more complicated then I thought. I didn't want to reimplement all the
button functions myself, so I decided to just connect to the 
'size-allocate' signal. However if I set the image in the size-allocate
handler you get a race condition (new image => new size => new
image => etc.).


I 'solved' it by having a flag indicating if the icon was just scaled.
So effectively I never scale on every second size-allocate event. This
seems to work fine, but it also feels wrong.

I can either try to reimplement the gtk_image widget or the gtk_button
size_allocate function. Both are not entirely trivial.

Could you perhaps have a look and tell me what you think? There is an
example for it as well.

	Jasper

-- 
IRC channel: #xfce on irc.openprojects.net



More information about the Xfce4-dev mailing list