[GTK 3] Avoid repeated g_log_set_writer_func in tests
Since GLib 2.73.0 it can only be called once per process.
Based on commit 78c153ae in GTK 4, but combining the icontheme test's two custom log writers into one log writer that serves both purposes, to avoid the need for a subprocess.
Co-authored-by: @matthiasc
Resolves: #5119 (closed)