GTK3 has OpenGL support out of the box, there’s literally no reason whatsoever to try and resurrect a GTK2 application that will likely only work with unmaintained external libraries like GtkGLExt or GtkGLArea, and that will only work on X11 and with legacy GL.
With this little amount of code it’s impossible to give you a proper answer.
This is pretty much non-idiomatic code that tries to drive GTK as if it were SDL or GLFW. My suggestion would be to use SDL instead of a full blown desktop toolkit, unless you’re looking for an integrated UI that shows common controls—in which case, this is not how to use GTK, as it’s an event driven toolkit and it should be used as such.