Commit Graph

24 Commits

Author SHA1 Message Date
Matthias Clasen
f16e58e9a7 builder tool: Canonicalize property names
When simplifying, convert property names to canonical form,
so we don't waste time while looking them up later.
2016-05-06 16:09:12 -04:00
Руслан Ижбулатов
3ed9cb2488 gtk-builder-tool: use g_printf() instead of g_print()
1) g_print() can be redirected
2) g_print() does some extra processing, such as character set conversion.
   Specifically, on W32 it will detect system codepage via GetACP(),
   and will convert UTF-8 output into that codepage, even though
   the output should stay unchanged (whether gtk-builder-tool interprets
   strings from ui files as UTF-8 is a separate matter).

https://bugzilla.gnome.org/show_bug.cgi?id=765118
2016-04-15 17:45:27 +00:00
Matthias Clasen
073f8bc44b gtk-builder-tool: Expand the preview command
Make the preview command parse options properly, turn the ID into
an --id=ID option, and add a --css=FILE option that allows to
specify a css file to use for previewing.

This is useful for e.g. previewing the reftest .ui files with
their corresponding .css.
2016-01-31 13:09:43 -05:00
Matthias Clasen
836bd65408 gtk-builder-tool: Accept --help
Saying 'Failed to open file '--help' is not polite or smart.
Catch this case and show usage information.
2016-01-31 11:02:53 -05:00
Matthias Clasen
7d75d5ec66 builder tool: Add a preview command
This was somewhat missing, and is easy to add.
2016-01-29 09:39:41 -05:00
Matthias Clasen
76810e110b gtk-builder-tool: Don't break GtkHBox and GtkVBox
These classes have different defaults for ::expand than GtkBox,
which is not reflected in the declared default, so we have to
blacklist it.
2015-09-14 11:15:12 -04:00
Matthias Clasen
fda5b4ce4c builder-tool: Don't simplify translatable="yes"
It turns out that xgettext does not understand translatable="1",
so don't make gtk-builder-tool produce this, even though
GtkBuilder can parse it just fine.

https://bugzilla.gnome.org/show_bug.cgi?id=754928
2015-09-13 23:24:05 -04:00
Matthias Clasen
a531633660 Run gtk-builder-tool simplify over all templates 2015-09-12 11:24:36 -04:00
Matthias Clasen
3c247f20ea gtk-builder-tool: Canonicalize booleans
Always write booleans as '0' or '1'.
2015-09-12 11:24:36 -04:00
Matthias Clasen
defc3d8cbc builder-tool: Don't strip border-width
Strictly speaking, this would only have to be special-cased inside
GtkDialog, but lets just skip it altogether.
2015-07-19 13:18:30 -04:00
Matthias Clasen
f8b7623b3c builder-tool: Don't strip h/vexpand
Setting these properties has the side-effect of setting the
corresponding -set properties, which makes GTK+ behave subtly
different. So don't mess with these.
2015-06-25 07:01:26 -04:00
Matthias Clasen
4f115ad940 gtk-builder-tool: Some refactoring
Break out similar code into separate functions.
2015-05-02 17:39:05 -04:00
Matthias Clasen
9ff14a8188 gtk-builder-tool: Strip placeholders
glade likes to sprinkle <child><placeholder/></child> all
over the place - get rid of it.
2015-05-02 17:39:05 -04:00
Matthias Clasen
3b0e71cf9b gtk-builder-tool: Simplify non-translatable properties 2015-05-02 17:39:05 -04:00
Matthias Clasen
932e254688 gtk-builder-tool: Always emit translatable properties
Seems unlikely that these would ever have a default value,
but better safe than sorry.
2015-05-02 17:39:05 -04:00
Matthias Clasen
060c4f9c66 gtk-builder-tool: Handle cell properties
These were causing 'unknown property' warnings before.
2015-05-02 17:39:05 -04:00
Matthias Clasen
52bf6d52bb gtk-builder-tool: Add more exceptions 2015-05-02 11:55:57 -04:00
Matthias Clasen
b8548d27a1 gtk-builder-tool: Start an exception list
We have a number of cases where properties should have their
default value overridden in a subclass, but haven't because thats
annoying to do. We also have properties where the absence of
an explicit value has context-dependent meaning.
Add a list of exceptions for these cases.
2015-05-02 07:35:35 -04:00
Matthias Clasen
398399610a gtk-builder-tool: Add an enumerate command
This lists all the named objects from the .ui file.
2015-04-30 07:11:49 -04:00
Matthias Clasen
ec05339858 gtk-builder-tool: Validate templates
Catch an error that indicates the file looks like a template,
and then try again, this time with the template parsing API
of GtkBuilder. This is a little iffy, since we need to create
a 'fake' type and instance to pass in, but it works ok in
simple tests.
2015-04-30 06:19:10 -04:00
Matthias Clasen
d7523423d4 gtk-builder-tool: Separate commands
Add separate commands for validation and simplification.
2015-04-27 23:40:43 -04:00
Matthias Clasen
bf6a2deda0 Translate error messages 2015-04-27 19:10:10 -04:00
Matthias Clasen
169f29998f Do validation before simplification
Use GtkBuilder to parse the file first, and report any errors
it finds before using our own simple-minded parser to simplify.
2015-04-27 19:10:10 -04:00
Matthias Clasen
8bb5a14977 Add a simple commandline tool for ui files
This tool strips properties which are set to their
default value from .ui files.
2015-04-27 19:10:10 -04:00