Re: threads and trayicon error



so the mistake in my code is use threads?I thought that maybe I used bad some function :\ I will try with this way (mentioned in the gtk2-perl faq), but it's weird that the trayicon changes good and after X (unknow) time crash and this icon becomes a line :\ with any reason


2008/9/30 Jörn Reder <joern zyn de>
anguila wrote:

> I use 2 threads, the first one, execute the cvnews.pl to get the news, and
> the second wait $wait_time_error (the time acces to get the info from the
> web) to join the first thread for update the trayicon online or offline.

I'd suggest not using threads for this purpose... too complicated and
error-prone. It's not allowed to call Gtk+ functions outside the thread
which started the main loop, so you need to start a pure worker thread
communicating with the main thread to update the GUI etc.

You already have a separate process for the http stuff, so it's easy to
install an I/O watcher on your pipe and response to the events instead
of struggling with threads.

That's very common and you find an example for this in Gtk Perl docs,
e.g. here:

 http://live.gnome.org/GTK2-Perl/FrequentlyAskedQuestions#head-20b1c1d3a92f0c61515cb88d15e06b686eba6cbc

 [ 18. How do I keep my GUI updating while doing a long file read? ]

Regards,

Jörn

--
Think before you code. And while you're doing it probably won't hurt. ;)

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list




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