Hey Diego,
Thanks for the suggestion. it worked to some extent. Now I dont
get any error or warning but my GUI freezes now. I display a message box
in my program and I have put the code for GUI is in a separate thread.
I do something like this in the thread function:
gdk_threads_enter();
GtkWidget *dialog;
gint result = 0;
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, "No new hard drive was found.
Please check cable connections and jumper setting on the hard drive. Check
out Hardware Guide for details.\n");
gtk_dialog_add_buttons(GTK_DIALOG(dialog), "View Hardware Guide",
GTK_RESPONSE_HGUIDE, NULL);
gtk_dialog_add_buttons(GTK_DIALOG(dialog), GTK_STOCK_OK,
GTK_RESPONSE_ACCEPT,
NULL);
/*-- Display the widgets --*/
gtk_widget_show_all(dialog);
result = gtk_dialog_run (GTK_DIALOG (dialog));
switch (result)
{
case GTK_RESPONSE_ACCEPT:
printf("OK BUTTON PRESSED\n");
gtk_widget_destroy(dialog);
break;
case GTK_RESPONSE_HGUIDE:
printf("HGUIDE BUTTON PRESSED\n");
gtk_widget_destroy(dialog);
break;
default:
printf("WINDOW WAS KILLED\n");
gtk_widget_destroy(dialog);
break;
}
gdk_threads_leave();
And I never see the result of clicking any button. The program seems to
freeze after showing the message box.
Can you suggest anything?
regards,
Bharat
--------------------------------------------------------------------------------
On Wed, 28 May 2003, Diego Zuccato wrote:
> Bharat Bhushan wrote:
>
> > I am developing this GUI in GTK+ and it seems gtk doesnt refresh the GUI
> > until a callback function returns. I saw some newsgroup and found that
> > other people have also had this problem.
> > I tried to fix this problem by running a separate whic practically does
> > following:
> You're tking it the wrong way. If your callbacks are slow, then create
> THEM as separate threads, but remember to GDK_THREADS_ENTER() and
> GDK_THREADS_LEAVE() where needed. This way, the actual callback is more
> or less just a pthread_create() call.
>
> Hope that helps.
>
> BYtE,
> Diego.
>
_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list