script-parser: Remove top-level types list
The top-level types list was comically out of date, and it was only determining whether the type we were constructing was initially unowned or a full object. We can safely replace it with a simple type check.
This commit is contained in:
parent
c0be19eff6
commit
d3d05261e6
@ -1698,26 +1698,6 @@ add_children (ClutterScript *script,
|
|||||||
oinfo->children = unresolved;
|
oinfo->children = unresolved;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* top-level classes: these classes are the roots of the
|
|
||||||
* hiearchy; some of them must be unreferenced, whilst
|
|
||||||
* others are owned by other instances
|
|
||||||
*/
|
|
||||||
static const struct
|
|
||||||
{
|
|
||||||
const gchar *type_name;
|
|
||||||
guint is_toplevel : 1;
|
|
||||||
} clutter_toplevels[] = {
|
|
||||||
{ "ClutterActor", FALSE },
|
|
||||||
{ "ClutterAlpha", FALSE },
|
|
||||||
{ "ClutterBehaviour", TRUE },
|
|
||||||
{ "ClutterEffectTemplate", TRUE },
|
|
||||||
{ "ClutterModel", TRUE },
|
|
||||||
{ "ClutterScore", TRUE },
|
|
||||||
{ "ClutterTimeline", TRUE }
|
|
||||||
};
|
|
||||||
|
|
||||||
static guint n_clutter_toplevels = G_N_ELEMENTS (clutter_toplevels);
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
_clutter_script_check_unresolved (ClutterScript *script,
|
_clutter_script_check_unresolved (ClutterScript *script,
|
||||||
ObjectInfo *oinfo)
|
ObjectInfo *oinfo)
|
||||||
@ -1824,18 +1804,10 @@ _clutter_script_construct_object (ClutterScript *script,
|
|||||||
if (G_UNLIKELY (oinfo->gtype == G_TYPE_INVALID))
|
if (G_UNLIKELY (oinfo->gtype == G_TYPE_INVALID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < n_clutter_toplevels; i++)
|
oinfo->is_toplevel =
|
||||||
{
|
g_type_is_a (oinfo->gtype, G_TYPE_INITIALLY_UNOWNED)
|
||||||
const gchar *t_name = clutter_toplevels[i].type_name;
|
? FALSE
|
||||||
GType t_type;
|
: TRUE;
|
||||||
|
|
||||||
t_type = clutter_script_get_type_from_name (script, t_name);
|
|
||||||
if (g_type_is_a (oinfo->gtype, t_type))
|
|
||||||
{
|
|
||||||
oinfo->is_toplevel = clutter_toplevels[i].is_toplevel;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oinfo->gtype == CLUTTER_TYPE_STAGE && oinfo->is_stage_default)
|
if (oinfo->gtype == CLUTTER_TYPE_STAGE && oinfo->is_stage_default)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user