gtk2 test: create a helper method to count number of objects