glib/gio/gdbus-2.0/codegen
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
..
__init__.py Updated FSF's address 2014-01-31 14:31:55 +01:00
.gitignore Avoid using - (hyphen) in gdbus-codegen directory name 2011-08-25 16:55:46 -04:00
codegen_docbook.py Updated FSF's address 2014-01-31 14:31:55 +01:00
codegen_main.py Restore executability for other files 2014-01-31 09:36:52 -05:00
codegen.py codegen: make g_autoptr for the GInterface conditional 2016-05-03 15:48:55 +01:00
config.py.in Updated FSF's address 2014-01-31 14:31:55 +01:00
dbustypes.py Updated FSF's address 2014-01-31 14:31:55 +01:00
gdbus-codegen.in Updated FSF's address 2014-01-31 14:31:55 +01:00
Makefile.am Rework the build system for a new tests approach 2013-05-31 23:12:15 -04:00
parser.py Updated FSF's address 2014-01-31 14:31:55 +01:00
utils.py Updated FSF's address 2014-01-31 14:31:55 +01:00