Hi, I have a GTK+ application, which programs a microprocessor via the serial port. Below is a description of my application. Please bear with my long description. I have taken great pains to clearly explain my problem in great detail.
The way the GUI is designed is that on the top part I have a 'Load' button and a 'Burn' button. Below there is a GtkTextViewer widget for logging the response from the microprocessor during the programming. Clicking on the 'Load' button opens up a file selection dialog so that user can browse for the file. Clicking on the 'Burn' programs the microprocessor. During burning, whatever messages are exchanged between the PC serial port and the microprocessor are logged into the textviewer widget. So far so good. My 'burning' code was triggered by the callback which was connected to the 'clicked' signal of the 'Burn' button. The burning takes a while for larger files so I can't keep the GUI held up for so long. The way I decided to remedy this problem was with the below steps: 1. Call g_thread_init() in the main function before gtk_init() is called. 2. In the callback for 'clicked' signal for the'Burn' button, I use g_thread_create() to create a new thread which will handle the burning of the micro processor. 3. I immediately return from the callback and control goes back to the main loop. MY PROBLEM: With the above approach, my application works for the first time. It just works perfectly. All the logs in the textviewer come up in sync with the actual process. Only when I press BURN for the second time, the textviwer does not show any logs, although I can see log statements in my console and it also performs its work of programming the microprocessor. However, when I click on the textviewer or press down arrow within it, all the pending log statements come in a single shot. Earlier without the thread approach, both 'Burning' and 'Verification' strings used to get logged immediately after the 'Burn' callback returned and that had to wait till the entire burn process was completed. Now I have solved one problem but another has cropped up. Please help me. Thanks in advance for your time and patience to have reached here! ;-) regards, Seemanta _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list