Use set_lines if available

Fallback to workaround only if set_lines
is not available.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>