Commit Graph

138 Commits

Author SHA1 Message Date
Iñigo Martínez
93042e0052 gdbus-codegen: Fix issue with docbook generation
In cases where gdbus-codegen is used only for docbook generation,
the execution stops with the following error message:

  `Using --header or --body requires --output`

This is because it was assumed that, in addition to the docbook
generation, the header or source code were always generated.

This patch fixes this, and the header or source code generation
is not mandatory, so the docbook can be generated separately.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-31 22:12:51 +00:00
Iñigo Martínez
261cb8ea86 gdbus-codegen: Set source coding to utf-8
Some of the recent changes introduced UTF-8 characters which made
gdbus-codegen to crash when using Python 2.

Following PEP 263, the utf-8 coding comment has been used.

PEP: https://www.python.org/dev/peps/pep-0263/
BUG: https://bugzilla.gnome.org/show_bug.cgi?id=791015

Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
2018-01-15 17:04:31 +01:00
Iñigo Martínez
e4d68c7b3e gdbus-codegen: Support for separate C header and code generation
gdbus-codegen's options only allow a simultaneous header and source
code generation.

A `--header` and `--body` options have been added along with the
`--output` option which allow separate C header and code
generation.

These options cannot be used in addition to the old options such
as `--generate-c-code`, `--generate-docbook` or
`--output-directory`.

These options have also been added to gdbus-codegen's documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-15 16:11:17 +01:00
Iñigo Martínez
6c3af1cdda gdbus-codegen: Remove unnecessary parameters from the constructor
The `outdir` and `docbook` parameters are passed to the
`DocbookCodeGenerator` constructor, but these parameters are only
used at docbook generation, which is optional.

The parameters have been removed from the class creation and added
to the `generate` method, where they are actually being used.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-15 16:10:12 +01:00
Iñigo Martínez
22772acff8 gdbus-codegen: Split C header and code generation
The class that generated both C header and code has been split into
two classes. These clases are now specialized on creating the header
or the body code.

All parameters that do not belong to each class have also been
deleted, so only the necessary parameters still remain. These also
includes the header and code file descriptors, leaving only the
corresponding file descriptor necessary for each class.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-15 16:07:07 +01:00
Iñigo Martínez
a66f2f80e0 gdbus-codegen: Split C header and code generation functions
The generation of the C header and code preambles have been split
in order to be able to generate both files separately in the future.

The functions for generating preambles and postambles have also been
renamed following the function names used in the glib-genmarshal
rewrite, so that they stay consistent.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-15 16:06:01 +01:00
Iñigo Martínez
c658d03b76 gdbus-codegen: Add support for pragma inclusion guard
The #pragma once is widely supported preprocessor directive that can
be used instead of include guards.

This adds support for using optionally this directive instead of
include guards.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-15 16:05:26 +01:00
Iñigo Martínez
e59bce3c74 gdbus-codegen: Move from optparse to argparse
The optparse module is deprecated since version 2.7 and the
development continues with the argparse.

The code has been moved from optparse to argparse when parsing
command-line options. This has also led to the deprecation of the
`--xml-files`, and positional arguments should be used instead.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-15 16:03:39 +01:00
Iñigo Martínez
dcc1fe09d0 gdbus-codegen: Use Color's print_* methods
`glib-genmarshal` and `glib-mkenums` use a `Color` class which
implements a number of print_* methods to print colored messages
to the standard error output.

In order to be consistent with those programs' output,
`gdbus-codegen` has also started using that same class and methods.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-15 16:03:03 +01:00
Iñigo Martínez
a3d223d0e9 gdbus-codegen: Split license string
The license string which is embedded in the C header and body
preambles has been moved to a global variable. This way it can be
reused in both sections.

https://bugzilla.gnome.org/show_bug.cgi?id=791015
2018-01-09 13:13:08 +01:00
Jens Georg
f5804275af gdbus-codegen: Clarify license of generated code
https://bugzilla.gnome.org/show_bug.cgi?id=780893
2017-12-13 14:09:05 +00:00
Philip Withnall
06719a86b2 docs: Drop unnecessary <!-- -->s from gtk-doc comments
Putting a <!-- --> in plural<!-- -->s was an old hack used to fix
linking the symbol with gtk-doc when gtk-doc didn’t know about plural
forms. gtk-doc does now know about plural forms, so the hack can be
removed.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-29 17:50:27 +00:00
Tim Waugh
d35d9b7911 codegen: fix array out-param annotations
When using gdbus-codegen to produce generated code for a method with
an out parameter with a signature like 'as', make sure to include
an "(array)" annotation for that parameter.

(Reworked by Philip Withnall to improve code formatting.)

https://bugzilla.gnome.org/show_bug.cgi?id=741167
2017-11-28 14:28:49 +00:00
Daniel Macks
0b10c41a04 Git should ignore generated config.py file
gio/gdbus-2.0/codegen/config.py is generated by ./configure from
gio/gdbus-2.0/codegen/config.py.in

https://bugzilla.gnome.org/show_bug.cgi?id=790588
2017-11-20 10:17:01 +00:00
Philip Withnall
63c07f9b63 codegen: Change (allow-none) annotations to (nullable)
(nullable) has been around for a while now.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-17 11:42:48 +00:00
Colin Walters
cb8bfa758f gdbus-codegen: Call abspath() earlier
The previous change from https://bugzilla.gnome.org/show_bug.cgi?id=786785
didn't actually work (for me at least) in the `/bin/gdbus-codegen` case
as the relative `/bin/../share` path works, but then `os.path.abspath()`
breaks it (as it's not doing `realpath()`, and let's not go there).

Fix this by doing the `abspath` first.

Downstream: https://bugzilla.redhat.com/show_bug.cgi?id=1507661

https://bugzilla.gnome.org/show_bug.cgi?id=789723
2017-11-06 11:57:52 +00:00
Nirbheek Chauhan
b444ae0de2 meson: Improve gdbus-codegen custom target dependencies
Ensure that the custom targets that use gdbus-codegen get rebuilt when
any of the gdbus-codegen files are changed.

https://bugzilla.gnome.org/show_bug.cgi?id=752239
2017-10-11 16:55:39 +05:30
Jan Alexander Steffens (heftig)
30b25a6fd9 meson: Fix permissions of installed scripts
configure_file preserves the attributes, so the templates need to be
executable for the (installed) outputs to be executable.

https://bugzilla.gnome.org/show_bug.cgi?id=787671
2017-10-11 09:49:26 +01:00
Nirbheek Chauhan
b9f2ea4235 gdbus-codegen: Don't assume bindir and datadir share prefix
This assumption breaks when, for instance:

* Called as /bin/gdbus-codegen
* Installed on Windows in a directory that is not `bin/`

For such cases, we cannot make any assumptions about the directory
structure, and must hard-code the datadir.

https://bugzilla.gnome.org/show_bug.cgi?id=786785
2017-10-11 09:48:38 +01:00
Emmanuele Bassi
683809d5f7 Use env for gdbus-codegen's script
This allows us to build with Python 3 without using an absolute path.
2017-07-14 22:05:01 +01:00
Patrick Griffis
d10be6102f meson: Minor modernizations 2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
fe2a9887a8 meson: Improve MSVC and MinGW support and fix dependencies everywhere
Disable gio tests on Windows, fix .gitignore to not ignore
config.h.meson, and add more things to it.

Rename the library file naming and versioning to match what Autotools
outputs, e.g., libglib-2.0.so.0.5000.2 on Linux, libglib-2.0-0.dll  and
glib-2.0-0.dll on Windows with MSVC.

Several more tiny fixes, more executables built and installed, install
pkg-config and m4 files, fix building of gobject tests.

Changes to gdbus-codegen to support out-of-tree builds without
environment variables set (which you can't in Meson). We now add the
build directory to the Python module search path.
2017-07-13 19:03:39 -04:00
Florian Müllner
99d34f65d3 gdbus-codegen: Apply --output-directory to generated docs as well
In addition to code, gdbus-codegen can also generate docbook
documentation for DBus interfaces. There's no good reason why
the newly added --output-directory option shouldn't apply to
those generated files as well.

https://bugzilla.gnome.org/show_bug.cgi?id=783201
2017-05-30 00:08:38 +02:00
Sébastien Wilmet
0fedc90fac gio/gdbus-2.0/codegen/: LGPLv2+ -> LGPLv2.1+
https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Emmanuele Bassi
f952fdf3fc Drop trailing semi-colon from G_DEFINE_ macro
It's unnecessary, and only adds visual noise; we have been fairly
inconsistent in the past, but the semi-colon-less version clearly
dominates in the code base.

https://bugzilla.gnome.org/show_bug.cgi?id=669355
2017-04-10 10:38:31 +01:00
Patrick Griffis
ee09bb704f gdbus-codegen: Add --output-directory flag
This is useful with Meson where files are generated in subdirs

https://bugzilla.gnome.org/show_bug.cgi?id=778801
2017-02-27 06:37:44 -05:00
Patrick Griffis
79c08255be gdbus-codegen: Fix -Wconversion warning
https://bugzilla.gnome.org/show_bug.cgi?id=778581
2017-02-14 14:06:38 -05:00
Philip Withnall
097f70828f gdbus-codegen: Strip @since parameters before comparison
People might put more extraneous whitespace in a @since line in a
documentation comment, which should not affect the ordering of
methods/signals/etc. in the generated output.

https://bugzilla.gnome.org/show_bug.cgi?id=770372
2016-08-25 10:27:22 +01:00
Philip Withnall
15b315b472 gdbus-codegen: Allow '@since: UNRELEASED' in documentation comments
Previously, this would not work, as it would result in comparing the
order of a string and an integer. Make it work, and make 'UNRELEASED'
compare higher than other versions so it's always treated as the latest
version.

'UNRELEASED' is commonly used by maintainers to highlight new API while
it's being prototyped, until they know which version it will actually
be released in. At the time of release, they replace all 'UNRELEASED'
strings in git with the new version number.

An example of this usage is here:
d380ac6a2a (9208ee267cb05db1afd3a5c323d71e51db489447_7619_7656)

https://bugzilla.gnome.org/show_bug.cgi?id=769995
2016-08-16 22:36:53 +02:00
Matthias Clasen
98f86beed6 gdbus-codegen: Only generate autocleanup when instructed to
This adds a new --c-generate-autocleanup option to gdbus-codegen
which can be used to instruct gdbus-codegen about what autocleanup
definitions to emit.

Doing this unconditionally was found to interfere with existing
code out in the wild.

The new option takes an argument that can be
none, objects or all; to indicate whether to generate no
autocleanup functions, only do it for object types, or do it
for interface types as well. The default is 'objects', which
matches the unconditional behavior of gdbus-codegen on the 2.48
branch.

https://bugzilla.gnome.org/show_bug.cgi?id=763379
2016-05-05 06:13:16 -04:00
Simon McVittie
1c6cd5f0a3 codegen: make g_autoptr for the GInterface conditional
Some GNOME projects unconditionally work around the generated code's
lack of g_autoptr support by defining the autoptr cleanup function
themselves, which is not forward-compatible; as a result, commit
cbbcaa4 broke them. Do not define the cleanup function unless the
including app "opts in" to newer APIs via GLIB_VERSION_MAX_ALLOWED.

Projects requiring compatibility with GLib < 2.49 can get a
forward-compatible g_autoptr for a generated GInterface type found in
a library, for example ExampleAnimal in the GIO tests, by declaring
and using a typedef with a distinct name outside the library's
namespace:

    typedef AutoExampleAnimal ExampleAnimal;
    G_DEFINE_AUTOPTR_CLEANUP_FUNC (AutoExampleAnimal, g_object_unref)

    ...

    g_autoptr (AutoExampleAnimal) animal = NULL;

    /* returns ExampleAnimal * */
    animal = example_animal_proxy_new_sync (...);
    /* takes ExampleAnimal * first argument */
    example_animal_call_poke_sync (animal, ...);

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=763379
Reviewed-by: Colin Walters <walters@verbum.org>
Reviewed-by: Emmanuele Bassi <ebassi@gnome.org>
2016-05-03 15:48:55 +01:00
Simon McVittie
cbbcaa4dd7 codegen: Add g_autoptr support for the shared GInterface
The rest of the generated classes gained g_autoptr support in fd6ca66,
but this one is still missing. Because whatever_proxy_new_finish() and
whatever_proxy_new_sync() are declared as returning a Whatever *
instead of a WhateverProxy *, and the generated method-call stubs
act on a Whatever *, it's reasonably common to want to declare a
g_autoptr (Whatever).

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/review?bug=763379
Reviewed-by: Colin Walters <walters@verbum.org>
2016-05-02 19:59:09 +01:00
Philip Withnall
fd6ca66c16 codegen: Add support for g_autoptr to gdbus-codegen–generated objects
This means that any code generated by gdbus-codegen will now require
GLib 2.44 or newer.

https://bugzilla.gnome.org/show_bug.cgi?id=763379
2016-03-10 09:39:44 +00:00
Bastien Nocera
8792609e15 gio: Add names to idles and timeouts
This isn't too useful for some of the "return result in idle"
functions, but it's better than nothing.

https://bugzilla.gnome.org/show_bug.cgi?id=726872
2014-03-27 12:53:00 +01:00
Colin Walters
4cbee6a35b Restore executability for other files 2014-01-31 09:36:52 -05:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01:00
Jasper St. Pierre
0c87f71521 codegen: direction defaults to "in" 2013-12-31 15:39:02 -05:00
Bastien Nocera
c300079f13 gdbus-codegen: Fix crasher in goa-using apps
When replacing a version of goa-daemon (from gnome-online-accounts)
by a newer version with some added interfaces, evolution-data-server
and the gvfs-goa volume monitor might crash as there's no interface
definition for this new interface.

Work-around this by returning earlier from the _notify() implementation,
rather than accessing invalid memory.

https://bugzilla.gnome.org/show_bug.cgi?id=720539
2013-12-18 10:53:01 +01:00
Manuel Bachmann
36ef409591 gdbus-codegen: look for deps in correct path under win32
codegen.py and friends get installed in "share/glib-2.0",
so look for them there.

https://bugzilla.gnome.org/show_bug.cgi?id=702862
2013-12-11 11:02:33 +01:00
djcb
49fc6d5b7e gdbus-codegen: Fix leak in property setter
Comparing the code generated for the setter and other methods without
(real) return value, I noticed that the setter does not unref the
gvariant it gets.

https://bugzilla.gnome.org/show_bug.cgi?id=719472
2013-11-28 08:25:20 -05:00
Chun-wei Fan
87e6db8deb codegen.py: Rearrange GLib Version Check
...so that the generated code will build on all platforms, as compilers
like Visual C++ does not like #ifdef checks during a definition/use of
a macro.

https://bugzilla.gnome.org/show_bug.cgi?id=711049
2013-11-07 09:25:54 +08:00
Emmanuele Bassi
1b08980b48 gdbus-codegen: Take into consideration MAX_ALLOWED for private data
The G_ADD_PRIVATE() macro, and the auto-generated get_instance_private()
internal function, should be used conditionally depending on the maximum
allowed version of GLib, as defined by the GLIB_VERSION_MAX_ALLOWED
pre-processor symbol.

This allows generating code that can be compiled in projects that wish
to use an older API version of GLib through the use of the
GLIB_VERSION_MAX_ALLOWED symbol.

https://bugzilla.gnome.org/show_bug.cgi?id=710133
2013-10-28 12:47:16 -04:00
Daiki Ueno
a7f2765dba codegen: Treat input file as binary
Under C locale, open() in Python 3 sets the file encoding to ASCII.
As expat looks at encoding="..." in XML declaration, gdbus-codegen can
simply open the input file as binary and let expat decode the content.

https://bugzilla.gnome.org/show_bug.cgi?id=696633
2013-08-17 06:42:02 +02:00
Emmanuele Bassi
54cc43630d Rename the generated private data getter function
As it turns out, we have examples of internal functions called
type_name_get_private() in the wild (especially among older libraries),
so we need to use a name for the per-instance private data getter
function that hopefully won't conflict with anything.
2013-06-24 15:43:04 +01:00
Emmanuele Bassi
32747def4b gio: Use the new private instance data declaration
Use the newly added macros, and remove the explicit calls to
g_type_class_add_private().

https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-06-24 14:18:01 +01:00
Ryan Lortie
f9eb9eed10 Rework the build system for a new tests approach
Perform a substantial cleanup of the build system with respect to
building and installing testcases.

First, Makefile.decl has been renamed glib.mk and substantially
expanded.  We intend to add more stuff here in the future, like canned
rules for mkenums, marshallers, resources, etc.

By default, tests are no longer compiled as part of 'make'.  They will
be built when 'make check' is run.  The old behaviour can be obtained
with --enable-always-build-tests.

--disable-modular-tests is gone (because tests are no longer built by
default).  There is no longer any way to cause 'make check' to be a
no-op, but that's not very useful anyway.

A new glibtests.m4 file is introduced.  Along with glib.mk, this
provides for consistent handling of --enable-installed-tests and
--enable-always-build-tests (mentioned above).

Port our various test-installing Makefiles to the new framework.

This patch substantially improves the situation in the toplevel tests/
directory.  Things are now somewhat under control there.  There were
some tests being built that weren't even being run and we run those now.
The long-running GObject performance tests in this directory have been
removed from 'make check' because they take too long.

As an experiment, 'make check' now runs the testcases on win32 builds,
by default.  We can't run them under gtester (since it uses a pipe to
communicate with the subprocess) so just toss them in TESTS.  Most of
them are passing on win32.

Things are not quite done here, but this patch is already a substantial
improvement.  More to come.
2013-05-31 23:12:15 -04:00
Dan Winship
4b94c0831e Use 'dumb quotes' rather than `really dumb quotes'
Back in the far-off twentieth century, it was normal on unix
workstations for U+0060 GRAVE ACCENT to be drawn as "‛" and for U+0027
APOSTROPHE to be drawn as "’". This led to the convention of using
them as poor-man's ‛smart quotes’ in ASCII-only text.

However, "'" is now universally drawn as a vertical line, and "`" at a
45-degree angle, making them an `odd couple' when used together.

Unfortunately, there are lots of very old strings in glib, and also
lots of new strings in which people have kept up the old tradition,
perhaps entirely unaware that it used to not look stupid.

Fix this by just using 'dumb quotes' everywhere.

https://bugzilla.gnome.org/show_bug.cgi?id=700746
2013-05-21 11:23:22 -03:00
Guido Günther
31c00c1fbe codegen: move G_DEFINE_INTERFACE{,_WITH_CODE} before _default_init
to avoid warnings when built with -Wredundant-decls:

  sessionmanager-presence-generated.c:316:1: warning: redundant redeclaration of ‘session_manager_presence_default_init’ [-Wredundant-decls]
  sessionmanager-presence-generated.c:281:1: note: previous definition of ‘session_manager_presence_default_init’ was here
  sessionmanager-presence-generated.c:1273:1: warning: redundant redeclaration of ‘object_default_init’ [-Wredundant-decls]
  sessionmanager-presence-generated.c:1259:1: note: previous definition of ‘object_default_init’ was here

https://bugzilla.gnome.org/show_bug.cgi?id=696108
2013-04-02 21:49:59 +02:00
Guido Günther
576e2ce1db codegen: Avoid warnings when the generated client code is built with -Wunused-parameter
https://bugzilla.gnome.org/show_bug.cgi?id=696108
2013-04-02 21:49:54 +02:00
Guido Günther
beae47d838 Init padding to NULL to avoid a missing initializer warning
like

sessionmanager-presence-generated.c:920:1: warning: missing initializer [-Wmissing-field-initializers]
sessionmanager-presence-generated.c:920:1: warning: (near initialization for ‘_org_gnome_session_manager_presence_skeleton_vtable.padding’) [-Wmissing-field-initializers]

https://bugzilla.gnome.org/review?bug=696108
2013-03-24 16:27:01 +01:00
Matthias Clasen
ab328469f5 Silence automake
automake doesn't like INCLUDES anymore.
2013-02-02 22:54:15 -05:00
Stef Walter
3202978060 gdbus: Don't output invalid nested <para> docbook tags
Fix gdbus-codegen so it no longer outputs tags like
<para><para>Text</para></para>

https://bugzilla.gnome.org/show_bug.cgi?id=692865
2013-01-31 10:00:55 +01:00
Stef Walter
11e208f9d6 gdbus: Don't output invalid empty <variablelist> tags
Docbook doesn't allow an empty <variablelist> and so the docbook
output from gdbus-codegen is invalid when a method/signal has
no arguments.

https://bugzilla.gnome.org/show_bug.cgi?id=692865
2013-01-31 10:00:55 +01:00
Colin Walters
05461e5709 codegen: Install Python files in $(datadir)/glib-2.0, rather than $(libdir)
These files are actually architecture-indepdendent; using $(libdir)
for them means that /usr/bin/gdbus-codegen varies between
architectures, which is problematic for (mis)uses of multilib.

See https://bugzilla.redhat.com/show_bug.cgi?id=718404

https://bugzilla.gnome.org/show_bug.cgi?id=685012
2012-10-05 17:00:13 -04:00
Colin Walters
ce06987449 codegen: Explicitly close output
This is just cleaner rather than relying on the GC, and maybe
if we're lucky it will actually solve a problem.

https://bugzilla.gnome.org/show_bug.cgi?id=684909
2012-10-05 16:50:48 -04:00
David Zeuthen
fa6a684630 gdbus-codegen: make members of an interface inherit the "Since" annotation
This is the expected (and sane) behavior - without this bug-fix you'd
have to add "Since" to every member of a newly added D-Bus interface.

Also show-case this in the codegen example.

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-10-03 11:13:12 -04:00
Aleksander Morgado
724c8a1846 gdbus-codegen: avoid error when wrong interface is provided to --annotate
If the interface given cannot be matched, `iface_obj' was left uninitialized and
the iface_obj == None check would end up crashing:

Traceback (most recent call last):
  File "/usr/bin/gdbus-codegen", line 41, in <module>
    sys.exit(codegen_main.codegen_main())
  File "/usr/lib64/gdbus-2.0/codegen/codegen_main.py", line 175, in codegen_main
    apply_annotations(all_ifaces, opts.annotate)
  File "/usr/lib64/gdbus-2.0/codegen/codegen_main.py", line 146, in apply_annotations
    apply_annotation(iface_list, iface, None, None, None, None, key, value)
  File "/usr/lib64/gdbus-2.0/codegen/codegen_main.py", line 64, in apply_annotation
    if iface_obj == None:
UnboundLocalError: local variable 'iface_obj' referenced before assignment

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=683088
2012-09-01 11:53:19 -04:00
Matthias Clasen
21aff13d22 Fix 'make report'
Turns out this doesn't work unless every Makefile.am includes
Makefile.decl.
2012-08-16 23:23:16 -04:00
David Zeuthen
c09bf3e6b9 gdbus-codegen: improve casting a tiny wee bit
The in commit b79fbc5c3f for fixing
-Wstrict-aliasing warnings was a little too brutal, make it a bit
better.

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-07-07 17:10:46 -04:00
David Zeuthen
b79fbc5c3f gdbus-codegen: neuter warnings when using -Wstrict-aliasing
Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-07-06 13:49:28 -04:00
David Zeuthen
d728eae85f gdbus-codegen: don't shadow variable
This avoids a warning when building with -Wshadow

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-07-06 13:49:28 -04:00
David Zeuthen
d72116d8b7 gdbus-codegen: Don't generate invalid GObject property names
For a D-Bus property with name "Type" (fairly common), we used to
generate a GObject property with name "type-" and C accessors
get_type_() (to avoid clashing with the GType getter), set_type_()
(for symmetri).

However, the rules for GObject property names are fairly rigid and
specifically prohibit names ending in a dash.

Therefore change things so the chosen GObject property name is "type"
but preserve the naming rules for the C getter and setter (for the
same reasons: avoiding name clashing and symmetri).

This change does break the API of generated code (but only on the
GObject property level, the C symbols are not changed) but strictly
speaking the behavior was undefined since "type-" was an invalid
GObject property name.

Also add a test case for this.

Bug 679473.

https://bugzilla.gnome.org/show_bug.cgi?id=679473

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-07-06 09:26:41 -04:00
Simon Feltman
03611f7c06 Updated codegen to work with python3.
Most changes were just replacing usage of "has_key" with "in".
Also updated the sorting function which was simplified and
changed to a "key" function instead of "cmp" (which is no longer
supported in python3. Verified everything builds with
python 2.7 and 3.

https://bugzilla.gnome.org/show_bug.cgi?id=678066
2012-07-01 11:14:54 -04:00
Johan Dahlin
08cfcdc81a Use the same Python as we found in configure
Don't assume /usr/bin/python is python 2.x, on newer Ubuntu versions
it's actually python 3.x.
2012-06-29 11:59:33 -03:00
Dan Winship
7d0db04223 gdbus: fix generated code to not warn under -Wfloat-equal
https://bugzilla.gnome.org/show_bug.cgi?id=678333
2012-06-20 08:20:50 -04:00
Alexander Larsson
ff92fe9593 Support initial underscores in dbus codegen namespace
Before these were considered lowercase and thus got duplicated.
2012-04-19 10:24:08 +02:00
Christian Persch
8869de3857 gdbus-codegen: Avoid warnings in generated code
Initialising a "gchar *" struct member from a string literal may produce
a warning; add an explicit cast to fix that.

Bug #664275.
2012-04-16 22:39:34 +02:00
David Zeuthen
8e763aef43 gdbus-codegen: Use C array instead of GValueArray
GValueArray was deprecated in bug 667228 and since we never change the
size of the array, it was kinda dumb to just GValueArray in the first
place.

https://bugzilla.gnome.org/show_bug.cgi?id=667228

Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-01-26 14:56:29 -05:00
Javier Jardón
dde3401122 gio/gdbus-2.0/codegen/codegen.py: Use g_list_free_full() 2012-01-03 16:53:47 +01:00
Aleksander Morgado
8fcb73b0a9 gdbus-codegen: fix typo in generated documentation
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=665858
2011-12-09 15:18:25 +01:00
Tristan Van Berkom
a00530ecb0 GDBusInterfaceSkeleton: make it possible to export on multiple connections
This is useful in peer-to-peer connections.

With minor changes by David Zeuthen <davidz@redhat.com>.

https://bugzilla.gnome.org/show_bug.cgi?id=662718

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-12-02 11:20:21 -05:00
Javier Jardón
8d3250016d gio: Use G_VALUE_INIT 2011-10-18 17:12:33 +01:00
Dan Winship
59f1f54655 Add g_main_context_ref_thread_default()
Add g_main_context_ref_thread_default(), which always returns a
reffed GMainContext, rather than sometimes returning a (non-reffed)
GMainContext, and sometimes returning NULL. This simplifies the
bookkeeping in any code that needs to keep a reference to the
thread-default context for a while.

https://bugzilla.gnome.org/show_bug.cgi?id=660994
2011-10-07 10:14:34 -04:00
David Zeuthen
f34908ef15 GDBus: Regenerate code when the codegen or options passed to it changes
https://bugzilla.gnome.org/show_bug.cgi?id=660498

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-10-05 12:42:06 -04:00
Ryan Lortie
7d4dea748d GDBus codegen: generate code with embedded GMutex
Modify GDBus code generator to emit code that uses GMutex embedded into
the structure of the skeleton instead of a pointer.

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 11:13:47 -04:00
David Zeuthen
aabdb7e190 GDBusObject{Proxy,Skeleton}: Prefix properties with g- to avoid collisions
Otherwise we might collide with an interface called Connection.

https://bugzilla.gnome.org/show_bug.cgi?id=659699

This is for the same reason that GDBusProxy has its properties
prefixed with g-.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-21 12:35:40 -04:00
Xavier Claessens
6b39085016 gdbus-codegen: prepend arg_ to method/signal arg names
This is to avoid shadow declaration warning in the case an arg name
is "time" for example.

https://bugzilla.gnome.org/show_bug.cgi?id=659690

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-21 07:45:50 -04:00
Xavier Claessens
70515ffe92 gdbus-codegen: Fix build errors in generated code
https://bugzilla.gnome.org/show_bug.cgi?id=659646
2011-09-21 10:22:24 +02:00
David Zeuthen
48494dd552 gdbus-codegen: Support Ugly_Case for given C namespace
https://bugzilla.gnome.org/show_bug.cgi?id=658976

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 16:01:13 -04:00
David Zeuthen
c6c2c10946 gdbus-codegen: Single letter namespaces get dropped from symbol names
https://bugzilla.gnome.org/show_bug.cgi?id=659082

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 15:20:00 -04:00
Tomas Bzatek
659b287a92 gdbus-codegen: Fix segfault when remote property is invalidated
The 'key' variable is no longer valid outside the cycle, owned and
probably already freed by GVariant. This causes apps to segfault
when proxy is constructed and a property on remote d-bus service
changes (actually is invalidated). Looks like a typo anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=659070
2011-09-14 19:02:01 +02:00
Will Thompson
a020fbf8f6 gdbus-codegen: post-process all interfaces when parsing >1 file
This also fixes a crash when you run gdbus-codegen with no arguments.

https://bugzilla.gnome.org/show_bug.cgi?id=656323

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-01 14:28:57 -04:00
Dieter Verfaillie
a2614efd14 Make gdbus-codegen 'relocatable' at runtime on Windows.
https://bugzilla.gnome.org/show_bug.cgi?id=650763
2011-08-25 17:23:00 -04:00
Dieter Verfaillie
acb5b852c1 gdbus-codegen: Revert to using /usr/bin/env for Python
After a lot of discussion, we decided /usr/bin/env is the most
flexible for now.

https://bugzilla.gnome.org/show_bug.cgi?id=650763
2011-08-25 17:19:27 -04:00
Dieter Verfaillie
cd0cd95078 Introduce the UNINSTALLED_GLIB_SRCDIR environment variable
This makes it possible to avoid setting PYTHONPATH in
Makefile.am files.

https://bugzilla.gnome.org/show_bug.cgi?id=650763
2011-08-25 16:55:49 -04:00
Dieter Verfaillie
5391aae009 Introduce the UNINSTALLED_GLIB_BUILDDIR environment variable
This makes it possible to also use relative imports for
gdbus-codegen's config module.

https://bugzilla.gnome.org/show_bug.cgi?id=650763
2011-08-25 16:55:49 -04:00
Dieter Verfaillie
5dc3c2efc8 Use relative imports for the gdbus/codegen package
But not yet for the config module (but is taken care
of in a followup patch).

https://bugzilla.gnome.org/show_bug.cgi?id=650763
2011-08-25 16:55:47 -04:00
Dieter Verfaillie
0eaec4e59a Avoid using - (hyphen) in gdbus-codegen directory name
It's an invalid character in Python module names and prevents us from
being able to import it.

https://bugzilla.gnome.org/show_bug.cgi?id=650763
2011-08-25 16:55:46 -04:00