+ GtkWidget *button, *table = _data;
+ int rows, cols, x, y;
+ static int count;
+
+ if (table == NULL) {
+ /* magic way to reset the number of toggle buttons
+ * that we have already added - call this before you
+ * create the dialog */
+ count = 0;
+ return;
+ }
+ g_object_get(G_OBJECT(table), "n-columns", &cols, "n-rows", &rows, NULL);
+ if (count > rows * cols) {
+ gtk_table_resize(GTK_TABLE(table),rows+1,cols);
+ rows++;
+ }
+ x = count % cols;
+ y = count / cols;