main-window: Handle the back key before everything else

Determining whether a key press event should be handled as a back key
is straightforward. Let's do it before checking if the event should be
handled by the search entry, which is more involved and depends on the
state of the widgets and who has the current focus. This way we can
guarantee that the back key is never going to be eaten up by the
toolbar or something else.

Other than that this keeps the code in sync with gnome-documents.