A quit function is a callback to
be invoked when gtk_main_quit()
is called. In other words, the callback runs just before
gtk_main() returns. The
callback should be a
GtkFunction, defined as follows:
typedef gint (*GtkFunction) (gpointer data);
|
Quit functions are added with
gtk_quit_add() (Figure 29). When
adding a quit function, you must specify a main loop
level, as returned by
gtk_main_level(). The second and third arguments
specify a callback and callback data.
The callback's return value indicates whether the
callback should be invoked again. As long as the callback
returns TRUE, it will be
repeatedly invoked. As soon as it returns FALSE, it is disconnected. When all
quit functions have returned
FALSE, gtk_main() can
return.
gtk_quit_add() returns an ID
number that can be used to remove the quit function with
gtk_quit_remove(). You can also
remove a quit function by passing its callback data to
gtk_quit_remove_by_data().