mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
decompiler: Support GtkFileFilter tags
This commit is contained in:
parent
3ab2fbe5a0
commit
34e78de338
3 changed files with 39 additions and 3 deletions
|
@ -375,6 +375,31 @@ def decompile_state(ctx, gir, name, cdata, translatable="false"):
|
||||||
ctx.print_attribute(name, cdata, gtk_a11y.get_types(ctx.gir).get(name))
|
ctx.print_attribute(name, cdata, gtk_a11y.get_types(ctx.gir).get(name))
|
||||||
|
|
||||||
|
|
||||||
|
@decompiler("mime-types")
|
||||||
|
def decompile_mime_types(ctx, gir):
|
||||||
|
ctx.print("mime-types [")
|
||||||
|
|
||||||
|
@decompiler("mime-type", cdata=True)
|
||||||
|
def decompile_mime_type(ctx, gir, cdata):
|
||||||
|
ctx.print(f'"{cdata}",')
|
||||||
|
|
||||||
|
@decompiler("patterns")
|
||||||
|
def decompile_patterns(ctx, gir):
|
||||||
|
ctx.print("patterns [")
|
||||||
|
|
||||||
|
@decompiler("pattern", cdata=True)
|
||||||
|
def decompile_pattern(ctx, gir, cdata):
|
||||||
|
ctx.print(f'"{cdata}",')
|
||||||
|
|
||||||
|
@decompiler("suffixes")
|
||||||
|
def decompile_suffixes(ctx, gir):
|
||||||
|
ctx.print("suffixes [")
|
||||||
|
|
||||||
|
@decompiler("suffix", cdata=True)
|
||||||
|
def decompile_suffix(ctx, gir, cdata):
|
||||||
|
ctx.print(f'"{cdata}",')
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class UnsupportedError(Exception):
|
class UnsupportedError(Exception):
|
||||||
message: str = "unsupported feature"
|
message: str = "unsupported feature"
|
||||||
|
|
|
@ -2,7 +2,17 @@ using Gtk 4.0;
|
||||||
|
|
||||||
FileFilter {
|
FileFilter {
|
||||||
name: "File Filter Name";
|
name: "File Filter Name";
|
||||||
mime-types ["text/plain", "image/ *"]
|
|
||||||
patterns ["*.txt"]
|
mime-types [
|
||||||
suffixes ["png"]
|
"text/plain",
|
||||||
|
"image/ *",
|
||||||
|
]
|
||||||
|
|
||||||
|
patterns [
|
||||||
|
"*.txt",
|
||||||
|
]
|
||||||
|
|
||||||
|
suffixes [
|
||||||
|
"png",
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,6 +168,7 @@ class TestSamples(unittest.TestCase):
|
||||||
self.assert_decompile("accessibility_dec")
|
self.assert_decompile("accessibility_dec")
|
||||||
self.assert_decompile("binding")
|
self.assert_decompile("binding")
|
||||||
self.assert_decompile("child_type")
|
self.assert_decompile("child_type")
|
||||||
|
self.assert_decompile("file_filter")
|
||||||
self.assert_decompile("flags")
|
self.assert_decompile("flags")
|
||||||
self.assert_decompile("id_prop")
|
self.assert_decompile("id_prop")
|
||||||
self.assert_decompile("layout_dec")
|
self.assert_decompile("layout_dec")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue