#include <gtk/gtk.h>

gboolean
timeout_callback (gpointer button)
{
	gtk_widget_set_sensitive (GTK_WIDGET (button), TRUE);
	return FALSE;
}

static void
button_clicked (GtkButton *button, gpointer data)
{
	gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE);
	g_timeout_add(1000, timeout_callback, button);
}

void 
test()
{
	GtkWidget *win;
	GtkWidget *btn;

	win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	btn = gtk_button_new_from_stock (GTK_STOCK_APPLY);
	gtk_container_add (GTK_CONTAINER (win), btn);

	g_signal_connect(btn, "clicked", G_CALLBACK (button_clicked), NULL);
	g_signal_connect(win, "delete_event", G_CALLBACK (gtk_main_quit), NULL);
	gtk_widget_show_all (win);
	gtk_main();
}

int
main (int argc, char **argv)
{
	gtk_init(&argc, &argv);
	test();
	return 0;
}
