Re: GtkDialog problems again



On Mon, Aug 27, 2007 at 03:01:00PM +0200, omar crea jusan it wrote:
I need a dialog in my application that simply show a label (so without any
button) and then hide itself after some processing occurred.
The problem is that I can't send any :response signal to the dialog, so it
remains blocked in the loop after gtk_dialog_run has been called.
I tried to use the example posted in the GTK+ reference manual, but without
success.


Here is the code snippet:

appdata->dialogLabel = gtk_label_new(NULL);
    gtk_label_set_text(GTK_LABEL(appdata->dialogLabel),
          "Opening camera...");

    appdata->dialog = gtk_dialog_new_with_buttons("Open Camera",
          GTK_WINDOW(appdata->window),
          GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT,
          NULL);
    gtk_container_add(GTK_CONTAINER(GTK_DIALOG(appdata->dialog)->vbox),
appdata->dialogLabel);

    gtk_widget_show_all(appdata->dialog);
    // program stops here
    gint result = gtk_dialog_run(GTK_DIALOG(appdata->dialog));
    switch (result) {
       case GTK_RESPONSE_ACCEPT:
          gtk_widget_hide_all(appdata->dialog);
          break;
       default:
          gtk_dialog_response(GTK_DIALOG(appdata->dialog),
GTK_RESPONSE_DELETE_EVENT);
          start_pipeline(appdata);
          add_camera_tab(appdata);
          break;
    }
    gtk_widget_destroy(appdata->dialog);

....


I need that the dialog hides itself after start_pipeline() and add_camera_tab()
is called.

Make the dialog non-modal, i.e. do not use gtk_dialog_run(),
just show_all the dialog, connect to its "response" signal
(process any user response in the callback) and let the main
loop continue.

Otherwise I'm unsure what you are trying (things such as
calling gtk_widget_hide_all() and then immediately
gtk_widget_destroy() on the dialog do not make much sense to
me).

Yeti

--
http://gwyddion.net/



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