Changed g_critical to g_error for glib1.2 support