1
0
Fork 0

2008-05-09 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-script-private.h: Add a flag for the
	default stage.

	* clutter/clutter-script.c:
	(json_object_end): If the "type" member is "ClutterStage"
	and we have a "is-default" member set to true then this
	is the default stage.

	(clutter_script_construct_object): Special case the default
	stage instead of each ClutterStage.
	
	(object_info_free): Ditto as above.

	* tests/test-script.json: Test the creation of a non-default
	stage and the ::destroy handler to quit.
This commit is contained in:
Emmanuele Bassi 2008-05-09 13:58:04 +00:00
parent 4f9738d3a3
commit d7a8fa8b53
4 changed files with 40 additions and 8 deletions

View file

@ -1,3 +1,21 @@
2008-05-09 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-script-private.h: Add a flag for the
default stage.
* clutter/clutter-script.c:
(json_object_end): If the "type" member is "ClutterStage"
and we have a "is-default" member set to true then this
is the default stage.
(clutter_script_construct_object): Special case the default
stage instead of each ClutterStage.
(object_info_free): Ditto as above.
* tests/test-script.json: Test the creation of a non-default
stage and the ::destroy handler to quit.
2008-05-09 Emmanuele Bassi <ebassi@openedhand.com>
Bug #908 - Support transform from G_TYPE_INT to ClutterUnit

View file

@ -50,9 +50,10 @@ typedef struct {
guint merge_id;
guint is_toplevel : 1;
guint has_unresolved : 1;
guint is_unmerged : 1;
guint is_stage_default : 1;
guint is_toplevel : 1;
guint has_unresolved : 1;
guint is_unmerged : 1;
} ObjectInfo;
void object_info_free (gpointer data);

View file

@ -729,6 +729,17 @@ json_object_end (JsonParser *parser,
json_object_remove_member (object, "signals");
}
if (strcmp (oinfo->class_name, "ClutterStage") == 0 &&
json_object_has_member (object, "is-default"))
{
val = json_object_get_member (object, "is-default");
oinfo->is_stage_default = json_node_get_boolean (val);
json_object_remove_member (object, "is-default");
}
else
oinfo->is_stage_default = FALSE;
oinfo->is_toplevel = FALSE;
oinfo->is_unmerged = FALSE;
oinfo->has_unresolved = TRUE;
@ -1246,9 +1257,9 @@ clutter_script_construct_object (ClutterScript *script,
if (oinfo->object)
object = oinfo->object;
else if (oinfo->gtype == CLUTTER_TYPE_STAGE)
else if (oinfo->gtype == CLUTTER_TYPE_STAGE && oinfo->is_stage_default)
{
/* the stage is a complex beast: we cannot create it using
/* the default stage is a complex beast: we cannot create it using
* g_object_newv() but we need clutter_script_construct_parameters()
* to add the GParamSpec to the PropertyInfo pspec member, so
* that we don't have to implement every complex property (like
@ -1459,7 +1470,7 @@ object_info_free (gpointer data)
oinfo->object = NULL;
}
if (oinfo->is_unmerged && oinfo->object)
if (oinfo->is_unmerged && oinfo->object && !oinfo->is_stage_default)
{
clutter_actor_destroy (CLUTTER_ACTOR (oinfo->object));
oinfo->object = NULL;

View file

@ -2,9 +2,11 @@
"My Scene" : {
"id" : "main-stage",
"type" : "ClutterStage",
"title" : "ClutterScript test",
"color" : "white",
"signals" : [
{ "name" : "key-press-event", "handler" : "clutter_main_quit" }
{ "name" : "key-press-event", "handler" : "clutter_main_quit" },
{ "name" : "destroy", "handler" : "clutter_main_quit" }
],
"children" : [
{
@ -16,7 +18,7 @@
"rotation" : [
{ "z-axis" : [ 45.0, [ 75, 75 ] ] }
],
"behaviours" : [ "fade-behaviour", "path-behaviour" ],
"behaviours" : [ "fade-behaviour", "path-behaviour" ]
},
{
"id" : "green-button",