treeview: Handle the case where the cursor row gets deleted
treeview: Handle the case where the cursor row gets deleted

Previously, the cursor would just become invalid, which used to
reselect the first row in the treeview later on (without a
cursor-changed signal). This leads to a crash now with the recent
refactorings.

The patch is longer than I'd like it to be, but the situation is kinda
complicated, because we want to make sure to move the cursor to a good
row. It works like this:
1) From the deleted row, search forward for the first row that is not
   going to be deleted and is not a separator.
2) If no such row exists, search backwards for a row that is not a
   separator.
3) If no such node exists, clear the cursor.

jadahl/gtk,ahodesuka/gtk,msteinert/gtk,Sidnioulz/SandboxGtk,Adamovskiy/gtk,chergert/gtk,davidgumberg/gtk,chergert/gtk,Adamovskiy/gtk,Adamovskiy/gtk,davidgumberg/gtk,msteinert/gtk,msteinert/gtk,jadahl/gtk,Sidnioulz/SandboxGtk,jigpu/gtk,davidt/gtk,bratsche/gtk-,Adamovskiy/gtk,jessevdk/gtk,Adamovskiy/gtk,Lyude/gtk-,Distrotech/gtk2,chergert/gtk,jadahl/gtk,jadahl/gtk,ebassi/gtk,Adamovskiy/gtk,grubersjoe/adwaita,Distrotech/gtk2,jessevdk/gtk,chergert/gtk,jigpu/gtk,jessevdk/gtk,jigpu/gtk,ahodesuka/gtk,jessevdk/gtk,grubersjoe/adwaita,jigpu/gtk,jadahl/gtk,jigpu/gtk,davidt/gtk,jadahl/gtk,Distrotech/gtk2,ahodesuka/gtk,bratsche/gtk-,ebassi/gtk,alexlarsson/gtk,jadahl/gtk,alexlarsson/gtk,Adamovskiy/gtk,alexlarsson/gtk,msteinert/gtk,davidgumberg/gtk,ebassi/gtk,alexlarsson/gtk,chergert/gtk,Lyude/gtk-,ahodesuka/gtk,Lyude/gtk-,ahodesuka/gtk,davidgumberg/gtk,jessevdk/gtk,davidgumberg/gtk,grubersjoe/adwaita,Distrotech/gtk2,davidt/gtk,chergert/gtk,Sidnioulz/SandboxGtk,chergert/gtk,grubersjoe/adwaita,jessevdk/gtk,grubersjoe/adwaita,davidgumberg/gtk,Distrotech/gtk2,ebassi/gtk,alexlarsson/gtk,davidgumberg/gtk,Lyude/gtk-,Sidnioulz/SandboxGtk,jigpu/gtk,jigpu/gtk,grubersjoe/adwaita,jessevdk/gtk,ahodesuka/gtk,davidt/gtk,jigpu/gtk,Sidnioulz/SandboxGtk,davidgumberg/gtk,msteinert/gtk,Lyude/gtk-,alexlarsson/gtk,ahodesuka/gtk,davidt/gtk,Adamovskiy/gtk,Distrotech/gtk2,Lyude/gtk-,bratsche/gtk-,ahodesuka/gtk,ebassi/gtk,chergert/gtk,ebassi/gtk,Sidnioulz/SandboxGtk,alexlarsson/gtk,jadahl/gtk,Lyude/gtk-,alexlarsson/gtk,davidt/gtk,bratsche/gtk-,grubersjoe/adwaita,bratsche/gtk-,grubersjoe/adwaita,Lyude/gtk-,msteinert/gtk,bratsche/gtk-