Fix a LOOOOOT of errors in the code.

Fix a lot of compiling errors and warnings including issue #1, many of which may cause severe run time errors.
Also fix a lot of wrong usage of libraries and the language.

Detail below:

Fix const pointers conversion.
Static local functions and remove them from headers.
Static global variables.
Fix GTK type conversion.
Remove usage of deprecated gtk api.
Remove unused variables.