In GTK, you listen to signals sent by widgets. In other languages, such as Java (in which you may be more familiar with terminology), they are often called events.
If an event occurs, such as the "removal" of the widget, a corresponding signal arises, which you can apply to by connecting to g_signal_connect and the like.
I suggest you install devhelp for good documentation / online help for GTK.
, , .
#include <stdio.h>
#include <gtk/gtk.h>
#include <stdlib.h>
int
main (int argc, char **argv)
{
GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "delete_event", G_CALLBACK (gtk_window_iconify), NULL);
gtk_widget_show (window);
gtk_main ();
return EXIT_SUCCESS;
}