fix for gcc. simplify mainwin.cc a bit.