Make gallery stuff work also for cross-compilation

Galleries are needed in a cross-compilation only when targeting DESKTOP
platforms, which people don't do very often, so the problem had not been
noticed for a while.

Change-Id: Ieb0f010505af230db0661f02345ac6ace3b52957