Problem with modal dialog in Gnome_App delete event handler.



Hi,

I am having a problem displaying a modal dialog in the signal handler
for the "delete_event" of a Gnome_App window. For instance, I need a
dialog to be displayed if the user is closing the application and has
not saved their work.

1.) If somebody has a good reason why this dialog should not be modal,
I'd like to know.

Here is the code of a modified gnome-hello-0-basic project, which
demonstrates my problem.I have only reproduced the code of the signal
handlers which I have changed.Pressing the button, and invoking the
hello_cb handler produces OK behaviour in the modality of the
dialog.Attempting to close the window, and thus invoking the quit_cb
handler, causes the dialog to be shown, but the modal aspect of it is
not working...I can click again and show a 2nd dialog !?

Any ideas ? Perhaps this is more of a gtk question and should go to that
list ?

/Lukas
Sweden.

static void 
gnome_question_callback(gint reply, gpointer data)
{
    g_print("In gnome_question_callback reply = %i\n",reply);   
}

static void
hello_cb (GtkWidget *widget, void *data)
{
  GtkWidget* modal_widget;
  g_print ("Hello GNOME\n");

  modal_widget = gnome_app_question_modal(app, "Is this modal?", 
					  gnome_question_callback, 
					  NULL);
  return;
}


static void
quit_cb (GtkWidget *widget, void *data)
{

  GtkWidget* modal_widget;
  // show modal dialog here
  g_print("doing modal dialog now !\n");
  modal_widget = gnome_app_question_modal(app, "Is this modal?", 
					  gnome_question_callback, 
					  NULL);
  g_print("After callback\n");
  return;
}



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