mainWindow: Partly fix some animation glitches
These glitches are caused by the combination of HdyLeaflet and GtkRevealer both animating at the same (and sometimes different) times. The revealer might be part way through expanding before the leaflet decides it needs to fold, and the same when unfolding. Partly fixed by checking the widths of the leaflet's children, to predict whether it will need to fold. This makes sure the headerbar animation is synced with the leaflet's, but does not fix the other glitches. A more robust fix would be to look into HdyFlap, but that has not yet been merged into libhandy.