Re: signals of a GtkWindow



"Ludovic et Marie Nathalie Larue" <ludovic larue1 mageos com> writes:
Havoc Pennington wrote :

The delete_event signal corresponds to the "X" button on most window
managers.

If your WM has two options, "Close" and "Kill", the "Kill" means "kill
the app even if the app doesn't want to die", and there is no way to
recover from it. You can only recover from the delete_event.

I replaced the "destroy" by "delete_event" :
   gtk_signal_connect(GTK_OBJECT(gr->fenetre), "delete_event",
                    GTK_SIGNAL_FUNC(quitter), (gpointer) gr);
gr->fenetre is the window i want to close, and gr is a pointer to a struct i
created to pass more than one argument to the callback 'quitter'.

When i use the "destroy" signal, i have no problem, the callback does what i
want it to do.
But when i simply replace "destroy" by "delete_event", it doesn't work, it
is as though the pointer gr pointed to nothing. It is not the 'NULL'
pointer, but I can't access any field of my struct. They are not NULL
either, but i get an error when i want to use them.

What's wrong with the delete_event ?


The callback on delete event should be:

gint
delete_event_cb (GtkWidget *widget, GdkEventAny *event, gpointer data)
{


  /* return TRUE to stop window from being destroyed, FALSE to 
   * allow it to be destroyed
   */
  return TRUE;
}

Havoc





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