Added usage of branch, instead of usage of connection, when changing the
window state.

Signed-off-by: Jakob Brandsborg Ehmsen <jakobehmsen.github@gmail.com>