We use this pattern all over the place:
```
signals = [ foo.connect('bar', handler) ];
signals.forEach(id => foo.disconnect(id));
```
So we abstract it into a class that keeps track of the state automatically.
A space now emits four signals (supplying these arguments):
1. `select`, which runs on `ensureViewport`
2. `window-added` (metaWindow, index, row)
3. `window-removed` (metaWindow, index, row)
4. `monitor-changed`, currently not used
The minimap hooks into these signals updating as necessary. This is a lot
cleaner and goes a long way untangling the minimap from the navigator. One nice
effect is proper support of adding and removing windows when the minimap is
active.
It also works better on wayland as there's less reliance on synchronous updates.
There's a bug in SwitcherPopup where pushModal will sometimes fail on
`parent.show`. We therefor move most of the initialization to
`_initialSelection` which is run after the `pushModal` calls.
This also caused the issue where animations would randomly be blocked after a
navigation, which should be fixed now.
We're assessing all top level declarations from outside the original scope when
we're evaluating code. So everything should be `var`.
Classes are `let` bound so we should use var for `ClickOverlay` too, but there's
a bug in gnome-shell-mode making such statements not evaluate. We therefor wait
for that to be fixed.
Adds a `Space.monitor` property, hard coded to the primary monitor for the
moment. `move` needs to know about which space it's moving windows on.
It seems that we really don't have to worry about scaling, as it mutter should
take care of it automatically.
fixes#47
Functions which are called from signals is left alone for now since
`dynamic_function_ref` depends on looking up things in `window`. `debug` is
also still a global.
PreviewedWindowNavigator used `spaces.length` and the multimap used
`spaces.forEach` when using stable workspace order. That should be the last
usage of `spaces` as an array.
At the moment this doesn't improve things much as array indexing worked before.
And the multimap will still crash gnome-shell when going to removed workspaces.
This sets us up to use a hash map instead of an array of spaces, which is much
more robust since `workspace_index` isn't well suited as an identifier for a
workspace.