Split scanner dialog off into scan_dialog.[c|h]

Prepare to add some tests and benchmarks for the scanner string-handling
functions.
Add a test for scanner string functions

https://bugzilla.gnome.org/show_bug.cgi?id=726108
Improve scanner functions and fix tests

https://bugzilla.gnome.org/show_bug.cgi?id=726108