From d3d05261e6a394736757cebb5aad9b9267e7cf53 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 25 Feb 2010 14:22:08 +0000 Subject: [PATCH] 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. --- clutter/clutter-script-parser.c | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/clutter/clutter-script-parser.c b/clutter/clutter-script-parser.c index 83730bb..715968e 100644 --- a/clutter/clutter-script-parser.c +++ b/clutter/clutter-script-parser.c @@ -1698,26 +1698,6 @@ add_children (ClutterScript *script, 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 _clutter_script_check_unresolved (ClutterScript *script, ObjectInfo *oinfo) @@ -1824,18 +1804,10 @@ _clutter_script_construct_object (ClutterScript *script, if (G_UNLIKELY (oinfo->gtype == G_TYPE_INVALID)) return; - for (i = 0; i < n_clutter_toplevels; i++) - { - const gchar *t_name = clutter_toplevels[i].type_name; - GType t_type; - - 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; - } - } + oinfo->is_toplevel = + g_type_is_a (oinfo->gtype, G_TYPE_INITIALLY_UNOWNED) + ? FALSE + : TRUE; } if (oinfo->gtype == CLUTTER_TYPE_STAGE && oinfo->is_stage_default) -- 2.7.4