GtkDialog and `delete-event'



Hi.

Is there any way I could cleanly prevent a GtkDialog from being deleted?
The normal procedure is to connect gtk_true() to `delete-event', but it
won't work for GtkDialog (GtkFileSelection more precisely).  Apparently,
the GtkDialog's handler of that event prevents any other handlers from
being run, but I don't understand how.

This code doesn't work:

    g_signal_connect(dialog, "delete-event",
                     G_CALLBACK(gtk_true), NULL);

However, this does work:

    g_signal_handlers_block_matched(dialog, G_SIGNAL_MATCH_DATA,
                                    g_signal_lookup("delete-event", GTK_TYPE_WIDGET),
                                    0, NULL, NULL, NULL);
    g_signal_connect(dialog, "delete-event",
                     G_CALLBACK(gtk_true), NULL);

But this block looks like a hack to me.

Can you explain me why other signal handlers don't get called (I tried
to connect g_print() -- doesn't work).  GtkDialog's handler returns FALSE,
so GLib should propagate signal further, no?

And is there a good way to prevent the dialog from being deleted?

Paul


P.S.  I know that preventing windows from being deleted is a Bad Thing,
      but in my case it's OK, it would last only for a small fraction of
      second.  This is just to avoid random errors in my program later.




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