mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
builder: Simplify parameter collection
This avoids setting the GValue only to toss it at the end of the loop body. Instead, we can just do nothing if this property isn't interesting to us.
This commit is contained in:
parent
f5db501879
commit
e99ac8f6d8
@ -539,10 +539,19 @@ gtk_builder_get_parameters (GtkBuilder *builder,
|
|||||||
PropertyInfo *prop = g_ptr_array_index (properties, i);
|
PropertyInfo *prop = g_ptr_array_index (properties, i);
|
||||||
const char *property_name = prop->pspec->name;
|
const char *property_name = prop->pspec->name;
|
||||||
GValue property_value = G_VALUE_INIT;
|
GValue property_value = G_VALUE_INIT;
|
||||||
|
ObjectProperties *params;
|
||||||
|
|
||||||
if (prop->applied)
|
if (prop->applied)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if ((prop->pspec->flags & filter_flags) != 0)
|
||||||
|
params = filtered_parameters;
|
||||||
|
else
|
||||||
|
params = parameters;
|
||||||
|
|
||||||
|
if (!params)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (prop->value)
|
if (prop->value)
|
||||||
{
|
{
|
||||||
g_value_init (&property_value, G_PARAM_SPEC_VALUE_TYPE (prop->pspec));
|
g_value_init (&property_value, G_PARAM_SPEC_VALUE_TYPE (prop->pspec));
|
||||||
@ -616,19 +625,8 @@ gtk_builder_get_parameters (GtkBuilder *builder,
|
|||||||
* copy it to one of the two arrays, or unset it.
|
* copy it to one of the two arrays, or unset it.
|
||||||
*/
|
*/
|
||||||
g_assert (G_IS_VALUE (&property_value));
|
g_assert (G_IS_VALUE (&property_value));
|
||||||
|
object_properties_add (params, property_name, &property_value);
|
||||||
if ((prop->pspec->flags & filter_flags) != 0 && filtered_parameters)
|
prop->applied = TRUE;
|
||||||
{
|
|
||||||
object_properties_add (filtered_parameters, property_name, &property_value);
|
|
||||||
prop->applied = TRUE;
|
|
||||||
}
|
|
||||||
else if ((prop->pspec->flags & filter_flags) == 0 && parameters)
|
|
||||||
{
|
|
||||||
object_properties_add (parameters, property_name, &property_value);
|
|
||||||
prop->applied = TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
g_value_unset (&property_value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user