#include <gtk/gtk.h>

#include <stdlib.h>

int main(int argc, char** argv)
{
	gtk_init (&argc, &argv);

 
	GtkWidget *grid = gtk_grid_new ();

	for (unsigned i = 0; i < 8; ++i) {
		for (unsigned j = 0; j < 8; ++j) {
			char *string = g_strdup_printf ("%u, %u", i, j);

			GtkWidget *button = gtk_button_new_with_label (string);
			gtk_grid_attach (GTK_GRID (grid), button, i, j, 1, 1);

			free (string);
		}
	}

	GtkWidget *scroller = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_overlay_scrolling (GTK_SCROLLED_WINDOW (scroller), FALSE);
	//gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroller), GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS);
	gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (scroller), TRUE);
	gtk_scrolled_window_set_propagate_natural_width  (GTK_SCROLLED_WINDOW (scroller), TRUE);
	gtk_container_add (GTK_CONTAINER (scroller), grid);

	GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_container_add (GTK_CONTAINER (window), scroller);
	gtk_widget_show_all (window);


	g_signal_connect (window, "delete-event", &gtk_main_quit, NULL);
	gtk_main ();
}
