mutter/doc/cookbook/examples/script-ui.c
Elliot Smith 7900ac4dc7 cookbook: Added comments to script example
Commented the ClutterScript example so it can be used
inline as part of the recipe, rather than as an
example in the appendix (it's too simple to warrant
a separate appendix).
2010-08-27 11:21:30 +01:00

37 lines
762 B
C

#include <stdlib.h>
#include <clutter/clutter.h>
int
main (int argc, char *argv[])
{
clutter_init (&argc, &argv);
ClutterScript *ui = clutter_script_new ();
gchar *filename = "script-ui.json";
GError *error = NULL;
/* load a JSON file into the script */
clutter_script_load_from_file (ui, filename, &error);
if (error != NULL)
{
g_critical ("Error loading ClutterScript file %s\n%s", filename, error->message);
g_error_free (error);
exit (EXIT_FAILURE);
}
/* retrieve objects from the script */
ClutterActor *stage;
clutter_script_get_objects (ui,
"stage", &stage,
NULL);
clutter_actor_show (stage);
clutter_main ();
return EXIT_SUCCESS;
}