weird GNOME applet thread problem



I am writing a gnome applet to check how many mails are on a
(irrelevant) POP3 server.

I have all the applet code done, which basically consists of displaying
a GtkPixmap in the applet, an About box, and also using a
GnomePropertyBox to set preferences etc.

Everything here works fine until i introduce a thread (to later handle
the network code)...

I coded the separate thread (pthread) to simply loop and update the
pixmap in the applet (using gtk_pixmap_set()). This is simply a while
loop with a sleep at the bottom of the loop.

I get 2 different outcomes when i run this code:

* If i run the applet and then leave it alone, then the pixmap in the
applet is unchanged. Then if after some period i open the preferences
box, the text entries (and other widgets) in the preferences box are not
displayed properly (they appear as white rectangles AFTER i try changing
property box pages). In fact, the whole property box fails to be redrawn
properly.

A small image of this situation is at:
http://www.cse.unsw.edu.au/~s2206465/SONICMAIL/pbox-bad.jpg

* If i run the applet and open up the About box or the Preferences box
(using the applet right mouse button menu) BEFORE the end of the first
sleep period at the end of the thread loop, then the pixmap gets updated
and the property box gets displayed with no problems. 

See the following image for this (correct) situation:
http://www.cse.unsw.edu.au/~s2206465/SONICMAIL/pbox-good.jpg

The thread itself is not causing problems (if it DOESNT update the
pixmap in the applet, it all works fine). If anyone has any idea what
could be causing such behaviour, please let me know! 

Cameron.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]