Emit a critical warning if features are not initialized

If you forgot to call clutter_init() then you currently end up with a
warning saying that the stage cannot be initialized because the backend
does not support multiple stages. Clearly not useful.

We can catch some of the missing initialization in the features API,
since we will likely end up asking for a feature at some point.
This commit is contained in:
Emmanuele Bassi 2010-03-18 14:15:33 +00:00
parent 54504b7ac4
commit d2bb57c3b2

View File

@ -131,7 +131,10 @@ gboolean
clutter_feature_available (ClutterFeatureFlags feature)
{
if (G_UNLIKELY (!__features))
{
g_critical ("Unable to check features. Have you initialized Clutter?");
return FALSE;
}
return (__features->flags & feature);
}
@ -148,6 +151,12 @@ clutter_feature_available (ClutterFeatureFlags feature)
ClutterFeatureFlags
clutter_feature_get_all (void)
{
if (G_UNLIKELY (!__features))
{
g_critical ("Unable to check features. Have you initialized Clutter?");
return FALSE;
}
return __features->flags;
}