Merge branch 'arnaudb/better-substitution' into 'master'

Fix some gtk-builder-tool substitutions.

See merge request GNOME/gtk!1675
This commit is contained in:
Matthias Clasen 2020-04-12 22:53:54 +00:00
commit e3dba28666
3 changed files with 16 additions and 13 deletions

View File

@ -726,9 +726,12 @@ maybe_rename_property (Element *element, MyParserData *data)
const char *new_name; const char *new_name;
const char *alt_names[3]; const char *alt_names[3];
} props[] = { } props[] = {
/* the "replacement" property is placed *after* the "added" properties */
{ "GtkPopover", "modal", GTK_TYPE_POPOVER, PROP_KIND_OBJECT, "autohide", { NULL, NULL, NULL } }, { "GtkPopover", "modal", GTK_TYPE_POPOVER, PROP_KIND_OBJECT, "autohide", { NULL, NULL, NULL } },
{ "GtkWidget", "expand", GTK_TYPE_WIDGET, PROP_KIND_OBJECT, "hexpand", { "vexpand", NULL, NULL } }, { "GtkWidget", "expand", GTK_TYPE_WIDGET, PROP_KIND_OBJECT, "vexpand", { "hexpand", NULL, NULL } },
{ "GtkWidget", "margin", GTK_TYPE_WIDGET, PROP_KIND_OBJECT, "margin-left", { "margin-top", "margin-right", "margin-bottom" } }, { "GtkWidget", "margin", GTK_TYPE_WIDGET, PROP_KIND_OBJECT, "margin-bottom", { "margin-start", "margin-end", "margin-top" } },
{ "GtkWidget", "margin-left", GTK_TYPE_WIDGET, PROP_KIND_OBJECT, "margin-start", { NULL, NULL, NULL } },
{ "GtkWidget", "margin-right", GTK_TYPE_WIDGET, PROP_KIND_OBJECT, "margin-end", { NULL, NULL, NULL } },
{ "GtkHeaderBar", "show-close-button", GTK_TYPE_HEADER_BAR, PROP_KIND_OBJECT, "show-title-buttons", { NULL, NULL, NULL } } { "GtkHeaderBar", "show-close-button", GTK_TYPE_HEADER_BAR, PROP_KIND_OBJECT, "show-title-buttons", { NULL, NULL, NULL } }
}; };
int i, k, l; int i, k, l;
@ -753,12 +756,12 @@ maybe_rename_property (Element *element, MyParserData *data)
if (property_name == NULL) if (property_name == NULL)
return; return;
type = g_type_from_name (class_name); type = g_type_from_name (class_name);
canonical_name = g_strdup (property_name); canonical_name = g_strdup (property_name);
g_strdelimit (canonical_name, "_", '-'); g_strdelimit (canonical_name, "_", '-');
for (k = 0; k < G_N_ELEMENTS (props); k++) for (k = 0; k < G_N_ELEMENTS (props); k++)
{ {
if (g_type_is_a (type, props[k].type) && if (g_type_is_a (type, props[k].type) &&
@ -837,7 +840,7 @@ rewrite_stack_child (Element *child, MyParserData *data)
prop->children = g_list_append (prop->children, object); prop->children = g_list_append (prop->children, object);
prop->parent = new_object; prop->parent = new_object;
new_object->children = g_list_append (new_object->children, prop); new_object->children = g_list_append (new_object->children, prop);
g_list_free (child->children); g_list_free (child->children);
child->children = g_list_append (NULL, new_object); child->children = g_list_append (NULL, new_object);
@ -904,7 +907,7 @@ rewrite_assistant_child (Element *child, MyParserData *data)
prop->children = g_list_append (prop->children, object); prop->children = g_list_append (prop->children, object);
prop->parent = new_object; prop->parent = new_object;
new_object->children = g_list_append (new_object->children, prop); new_object->children = g_list_append (new_object->children, prop);
g_list_free (child->children); g_list_free (child->children);
child->children = g_list_append (NULL, new_object); child->children = g_list_append (NULL, new_object);
@ -1109,7 +1112,7 @@ rewrite_pack_type (Element *element,
{ {
Element *elt = l->data; Element *elt = l->data;
if (g_str_equal (elt->element_name, "child")) if (g_str_equal (elt->element_name, "child"))
rewrite_pack_type_child (elt, data); rewrite_pack_type_child (elt, data);
} }
} }
@ -1189,7 +1192,7 @@ rewrite_child_prop_to_prop (Element *element,
{ {
Element *elt = l->data; Element *elt = l->data;
if (g_str_equal (elt->element_name, "child")) if (g_str_equal (elt->element_name, "child"))
rewrite_child_prop_to_prop_child (elt, data, child_prop, prop); rewrite_child_prop_to_prop_child (elt, data, child_prop, prop);
} }
} }

View File

@ -8,12 +8,12 @@
<property name="label" translatable="yes">Hello World!</property> <property name="label" translatable="yes">Hello World!</property>
<property name="active">1</property> <property name="active">1</property>
<property name="receives_default">1</property> <property name="receives_default">1</property>
<property name="vexpand">1</property>
<property name="hexpand">1</property> <property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="margin-top">10</property> <property name="margin-top">10</property>
<property name="margin-right">10</property>
<property name="margin-bottom">10</property> <property name="margin-bottom">10</property>
<property name="margin-left">10</property>
<layout> <layout>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">0</property> <property name="top_attach">0</property>

View File

@ -7,8 +7,8 @@
<property name="window_position">center</property> <property name="window_position">center</property>
<child> <child>
<object class="GtkBox" id="box1"> <object class="GtkBox" id="box1">
<property name="margin_left">12</property> <property name="margin-start">12</property>
<property name="margin_right">12</property> <property name="margin-end">12</property>
<property name="margin_bottom">12</property> <property name="margin_bottom">12</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">12</property> <property name="spacing">12</property>