#include <gtk/gtk.h>


static void
b_clicked (GtkButton *button,
	   GtkNotebook *notebook)
{
	/* This is supposed to trigger a
	   "child-notify::position". */
	gtk_notebook_reorder_child (notebook,
				    GTK_WIDGET (button),
				    0);
}

static void
whatever_notify (GtkWidget *object,
		 GParamSpec *spec,
		 gpointer data)
{
	g_print ("This is never called\n");
}

int
main ()
{
	GtkWidget *window, *notebook, *button;

	gtk_init (NULL, NULL);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	notebook = gtk_notebook_new ();

	button = gtk_button_new_with_label ("One button");
	gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
				  button,
				  NULL);
	gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (notebook),
					  button, TRUE);
	g_signal_connect (notebook, "child-notify",
			  G_CALLBACK (whatever_notify),
			  NULL);
	g_signal_connect (button, "child-notify",
			  G_CALLBACK (whatever_notify),
			  NULL);

	button = gtk_button_new_with_label ("Click me to reorder");
	gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
				  button,
				  NULL);
	g_signal_connect (button, "clicked",
			  G_CALLBACK (b_clicked),
			  notebook);
	gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (notebook),
					  button, TRUE);

	gtk_container_add (GTK_CONTAINER (window),
			   notebook);

	gtk_widget_show_all (window);

	gtk_main();

	return 0;
}
