mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
decompiler: Support sub-templates
Support GtkBuilderListItemFactory syntax by decompiling the nested XML, rather than preserving it as a string literal.
This commit is contained in:
parent
25d9826aea
commit
21d5ce86e9
6 changed files with 60 additions and 20 deletions
11
tests/samples/list_factory_dec.blp
Normal file
11
tests/samples/list_factory_dec.blp
Normal file
|
@ -0,0 +1,11 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
ListView {
|
||||
factory: BuilderListItemFactory list_item_factory {
|
||||
template ListItem {
|
||||
child: Label {
|
||||
label: bind template.item as <$MyObject>.name;
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
|
@ -1,8 +1,11 @@
|
|||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
Gtk.BuilderListItemFactory {
|
||||
template ListItem {
|
||||
child: Gtk.Label label {};
|
||||
child: Adw.Bin {
|
||||
Gtk.Label label {}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,11 @@ corresponding .blp file and regenerate this file with blueprint-compiler.
|
|||
<interface>
|
||||
<template class="GtkListItem">
|
||||
<property name="child">
|
||||
<object class="GtkLabel" id="label"></object>
|
||||
<object class="AdwBin">
|
||||
<child>
|
||||
<object class="GtkLabel" id="label"></object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</template>
|
||||
</interface>]]></property>
|
||||
|
|
12
tests/samples/subscope_dec.blp
Normal file
12
tests/samples/subscope_dec.blp
Normal file
|
@ -0,0 +1,12 @@
|
|||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
BuilderListItemFactory {
|
||||
template ListItem {
|
||||
child: Adw.Bin {
|
||||
Label label {}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Label label {}
|
|
@ -212,14 +212,8 @@ class TestSamples(unittest.TestCase):
|
|||
SKIP_DECOMPILE = [
|
||||
# Not implemented yet
|
||||
"action_widgets",
|
||||
# Not implemented yet
|
||||
"gtkcolumnview",
|
||||
# Comments are not preserved in either direction
|
||||
"comments",
|
||||
# Not implemented yet
|
||||
"list_factory",
|
||||
# Not implemented yet
|
||||
"subscope",
|
||||
]
|
||||
|
||||
if sample in REQUIRE_ADW_1_4 and not self.have_adw_1_4:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue