mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-23 12:20:08 +00:00
gtk4-builder-tool: Rewrite Gtk{H,V}Seperator
One less UI element to worry about when migrating from GTK3. Signed-off-by: Guido Günther <agx@sigxcpu.org>
This commit is contained in:
parent
1ad5943cd8
commit
c86e45c432
8
testsuite/tools/simplify-data-3to4/separator.expected
Normal file
8
testsuite/tools/simplify-data-3to4/separator.expected
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<object class="GtkSeparator">
|
||||
<property name="orientation">vertical</property>
|
||||
</object>
|
||||
<object class="GtkSeparator"/>
|
||||
</interface>
|
9
testsuite/tools/simplify-data-3to4/separator.ui
Normal file
9
testsuite/tools/simplify-data-3to4/separator.ui
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkVSeparator">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<object class="GtkHSeparator">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</interface>
|
@ -1935,6 +1935,36 @@ rewrite_scale (Element *element,
|
||||
}
|
||||
}
|
||||
|
||||
static Element *
|
||||
write_separator_prop (Element *element,
|
||||
Element *parent,
|
||||
const char *name,
|
||||
const char *value)
|
||||
{
|
||||
|
||||
if (element)
|
||||
g_free (element->data);
|
||||
else
|
||||
{
|
||||
element = add_element (parent, "property");
|
||||
set_attribute_value (element, "name", name);
|
||||
}
|
||||
element->data = g_strdup (value);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
static void
|
||||
rewrite_separator (Element *element,
|
||||
MyParserData *data)
|
||||
{
|
||||
if (g_str_equal (get_class_name (element), "GtkVSeparator"))
|
||||
write_separator_prop (NULL, element, "orientation", "vertical");
|
||||
|
||||
if (!g_str_equal (get_class_name (element), "GtkSeparator"))
|
||||
set_attribute_value (element, "class", "GtkSeparator");
|
||||
}
|
||||
|
||||
static void
|
||||
rewrite_requires (Element *element,
|
||||
MyParserData *data)
|
||||
@ -2287,6 +2317,11 @@ rewrite_element_3to4 (Element *element,
|
||||
g_str_equal (get_class_name (element), "GtkScale"))
|
||||
rewrite_scale (element, data);
|
||||
|
||||
if (element_is_object_or_template (element) &&
|
||||
(g_str_equal (get_class_name (element), "GtkHSeparator") ||
|
||||
g_str_equal (get_class_name (element), "GtkVSeparator")))
|
||||
rewrite_separator(element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "property"))
|
||||
maybe_rename_property (element, data);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user