Get rid of MANY sql queries when moving the mouse

... by caching the count of images in the current query.
(cherry picked from commit 232fcd346579decb7b78a20471a20f64b2f7f1e8)
Use a quite faster SQL query, down from 0.02" to something not mesurable.

Help a bit fixing the lighttable slowness when displaying images based
on tag.
(cherry picked from commit 36cc52ccca5141d60df988087e97ae3a562e254b)
Add index on meta_data.

Speed-up the lighttable as we are doing lot of queries on meta_data table.
(cherry picked from commit 985baf5fc14a1e6ea100d1e29bfc3979dd40f14a)
Silence the CMake Warning
(cherry picked from commit 15c38698da9a40ec3b9cd441434d1c10dffe71a8)
Allow valid UTF-8 sequences in the metadata editor

The offending code was added in response to bug #8744. GTK is documented to
expect valid UTF-8 sequences as input, and is free to crash on invalid input
otherwise. The original fix, however, simply replaced non-ASCII characters with
dots which is clearly not accept able for someone named like me. This change
instead skips this replacement when the string is a valid UTF-8 sequence.

The g_utf8_validate must be invoked without the size being passed. If we pass
around the expected size, then this function fails because it hits the first
NUL byte, a terminator, prior to hitting the length limit, and this is
documented to return false.
(cherry picked from commit cd87f987e5423a8124417afb95cf3c55362d6dbc)