mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
clutter: Drop g_object_newv from ClutterScriptParser
Build an additional set of (GStrv, GValue[]) and pass it to the non-deprecated g_object_new_with_properties().
This commit is contained in:
parent
cbf6e74915
commit
3d23ecc456
@ -2208,8 +2208,9 @@ _clutter_script_construct_object (ClutterScript *script,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
g_autoptr (GPtrArray) param_names = NULL;
|
||||||
|
GArray *param_values;
|
||||||
GList *properties = oinfo->properties;
|
GList *properties = oinfo->properties;
|
||||||
GParameter *parameters;
|
|
||||||
|
|
||||||
/* every other object: first, we get the construction parameters */
|
/* every other object: first, we get the construction parameters */
|
||||||
oinfo->properties =
|
oinfo->properties =
|
||||||
@ -2219,10 +2220,22 @@ _clutter_script_construct_object (ClutterScript *script,
|
|||||||
properties,
|
properties,
|
||||||
¶ms);
|
¶ms);
|
||||||
|
|
||||||
parameters = (GParameter *) (void *) params->data;
|
/* Convert GParameter → (GStrv, GValue[]) */
|
||||||
oinfo->object = g_object_newv (oinfo->gtype,
|
param_names = g_ptr_array_sized_new (params->len);
|
||||||
params->len,
|
param_values = g_array_sized_new (TRUE, FALSE, sizeof (GValue), params->len);
|
||||||
parameters);
|
for (i = 0; i < params->len; i++)
|
||||||
|
{
|
||||||
|
GParameter *param = &g_array_index (params, GParameter, i);
|
||||||
|
|
||||||
|
g_ptr_array_add (param_names, (gchar *) param->name);
|
||||||
|
g_array_append_val (param_values, param->value);
|
||||||
|
}
|
||||||
|
g_ptr_array_add (param_names, NULL);
|
||||||
|
|
||||||
|
oinfo->object = g_object_new_with_properties (oinfo->gtype,
|
||||||
|
params->len,
|
||||||
|
(const gchar **) param_names->pdata,
|
||||||
|
(const GValue *) param_values->data);
|
||||||
|
|
||||||
/* by sinking the floating reference, we make sure that the reference
|
/* by sinking the floating reference, we make sure that the reference
|
||||||
* count is correct whether the object is referenced from somewhere
|
* count is correct whether the object is referenced from somewhere
|
||||||
@ -2238,6 +2251,7 @@ _clutter_script_construct_object (ClutterScript *script,
|
|||||||
g_value_unset (¶m->value);
|
g_value_unset (¶m->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_array_free (param_values, FALSE);
|
||||||
g_array_free (params, TRUE);
|
g_array_free (params, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user