Fix build with GTK < 2.24

Part of #1047.
Fix build with GLib < 2.32

Second part of #1047.
Fix build with GTK < 2.22 and GLIB < 2.32.

Add these back-compat to gtkcompat.h until the actual GTK version we want to depend on is figured out.

Based on SF #1047, and fixes that.
Fix racy glib assertion failure.

The info bar's unrealize signal can be emitted after the document's sci
is destroyed. Take a reference on the sci to avoid that.