Your best bet is to make a table, e.g. in your case if it is 4x4 you can move widgets around in whatever layout you want.
Here's the bit for the buttons:
Code:
GtkWidget* table=gtk_table_new(4, 4, FALSE);
gtk_widget_show(table);
GtkWidget* butt1=gtk_button_new_with_label("B1");
gtk_widget_show(butt1);
gtk_table_attach(GTK_TABLE(table), butt1, 0, 1, 0, 1, GTK_FILL|GTK_SHRINK|GTK_EXPAND, GTK_FILL|GTK_SHRINK|GTK_EXPAND, 2, 2);
GtkWidget* butt2=gtk_button_new_with_label("B2");
gtk_widget_show(butt2);
gtk_table_attach(GTK_TABLE(table), butt2, 0, 1, 1, 2, GTK_FILL|GTK_SHRINK|GTK_EXPAND, GTK_FILL|GTK_SHRINK|GTK_EXPAND, 2, 2);
GtkWidget* butt3=gtk_button_new_with_label("B3");
gtk_widget_show(butt3);
gtk_table_attach(GTK_TABLE(table), butt3, 0, 1, 2, 3, GTK_FILL|GTK_SHRINK|GTK_EXPAND, GTK_FILL|GTK_SHRINK|GTK_EXPAND, 2, 2);
GtkWidget* butt4=gtk_button_new_with_label("B4");
gtk_widget_show(butt4);
gtk_table_attach(GTK_TABLE(table), butt4, 0, 1, 3, 4, GTK_FILL|GTK_SHRINK|GTK_EXPAND, GTK_FILL|GTK_SHRINK|GTK_EXPAND, 2, 2);
Of course you'll need to add the usual gtk code around this and tell it where to put the table.
If you want to then relocate a button (the easiest would be your last option) the code is:
Code:
gtk_container_child_set_property(GTK_CONTAINER(table), butt3, "left-attach", 1);
gtk_container_child_set_property(GTK_CONTAINER(table), butt3, "right-attach", 2);
gtk_container_child_set_property(GTK_CONTAINER(table), butt3, "top-attach", 1);
gtk_container_child_set_property(GTK_CONTAINER(table), butt3, "bottom-attach", 2);
Might need to do something then to force it to refresh the layout -- not sure haven't tested it -- nonetheless that should do the trick