I tried your code on Linux with gtk+-2.6.7 (everything works as expected) and gtk+-2.8.3 (the shape-mask just doesn't seem to get applied). The reason for not working under gtk+-2.8.3 I don't know. But my guess is, that it maybe some "side-effect" of gtk+-2.8.3 internally using cairo for all its rendering. You may have to try a differnt approach (using cairo). A short excerpt from the gtk+-2.8.3 docs:
Cairo is a graphics library that supports vector graphics and image compositing that can be used with GDK. Since 2.8, GTK+ does most of its drawing using Cairo.
I'm afraid I cannot give you more hints than this, as I still have to learn about cairo-utilization myself.
EDIT: You might want to look at this page
with a nice sourcecode/screenshot table to get you started.