forked from AuroraMiddleware/gtk
builder: Minor refactoring
Keep the GString in PropertyInfo around, instead of throwing it away and just keeping the char*.
This commit is contained in:
parent
15b9feda22
commit
20079a9960
@ -480,7 +480,7 @@ gtk_builder_get_parameters (GtkBuilder *builder,
|
||||
if (G_IS_PARAM_SPEC_OBJECT (prop->pspec) &&
|
||||
(G_PARAM_SPEC_VALUE_TYPE (prop->pspec) != GDK_TYPE_PIXBUF))
|
||||
{
|
||||
GObject *object = gtk_builder_get_object (builder, prop->data);
|
||||
GObject *object = gtk_builder_get_object (builder, prop->text->str);
|
||||
|
||||
if (object)
|
||||
{
|
||||
@ -493,14 +493,14 @@ gtk_builder_get_parameters (GtkBuilder *builder,
|
||||
{
|
||||
g_warning ("Failed to get construct only property "
|
||||
"%s of %s with value `%s'",
|
||||
prop->pspec->name, object_name, prop->data);
|
||||
prop->pspec->name, object_name, prop->text->str);
|
||||
continue;
|
||||
}
|
||||
/* Delay setting property */
|
||||
property = g_slice_new (DelayedProperty);
|
||||
property->pspec = prop->pspec;
|
||||
property->object = g_strdup (object_name);
|
||||
property->value = g_strdup (prop->data);
|
||||
property->value = g_strdup (prop->text->str);
|
||||
property->line = prop->line;
|
||||
property->col = prop->col;
|
||||
builder->priv->delayed_properties =
|
||||
@ -508,7 +508,7 @@ gtk_builder_get_parameters (GtkBuilder *builder,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (prop->bound && (!prop->data || *prop->data == '\0'))
|
||||
else if (prop->bound && (!prop->text || prop->text->len == 0))
|
||||
{
|
||||
/* Ignore properties with a binding and no value since they are
|
||||
* only there for to express the binding.
|
||||
@ -516,10 +516,10 @@ gtk_builder_get_parameters (GtkBuilder *builder,
|
||||
continue;
|
||||
}
|
||||
else if (!gtk_builder_value_from_string (builder, prop->pspec,
|
||||
prop->data, ¶meter.value, &error))
|
||||
prop->text->str, ¶meter.value, &error))
|
||||
{
|
||||
g_warning ("Failed to set property %s.%s to %s: %s",
|
||||
g_type_name (object_type), prop->pspec->name, prop->data,
|
||||
g_type_name (object_type), prop->pspec->name, prop->text->str,
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
|
@ -681,9 +681,8 @@ parse_property (ParserData *data,
|
||||
static void
|
||||
free_property_info (PropertyInfo *info)
|
||||
{
|
||||
g_free (info->data);
|
||||
g_string_free (info->text, TRUE);
|
||||
g_free (info->context);
|
||||
/* info->text is already freed */
|
||||
g_slice_free (PropertyInfo, info);
|
||||
}
|
||||
|
||||
@ -1157,8 +1156,6 @@ end_element (GMarkupParseContext *context,
|
||||
g_string_assign (prop_info->text, translated);
|
||||
}
|
||||
|
||||
prop_info->data = g_string_free (prop_info->text, FALSE);
|
||||
|
||||
object_info->properties = g_slist_prepend (object_info->properties, prop_info);
|
||||
}
|
||||
else
|
||||
|
@ -62,7 +62,6 @@ typedef struct {
|
||||
TagInfo tag;
|
||||
GParamSpec *pspec;
|
||||
GString *text;
|
||||
gchar *data;
|
||||
gboolean translatable:1;
|
||||
gboolean bound:1;
|
||||
gchar *context;
|
||||
|
Loading…
Reference in New Issue
Block a user