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>
This commit is contained in:
Simon McVittie 2016-05-02 19:22:07 +01:00
parent d95030a2fd
commit cbbcaa4dd7

View File

@ -307,6 +307,10 @@ class CodeGenerator:
self.h.write('};\n')
self.h.write('\n')
self.h.write('#if GLIB_CHECK_VERSION(2, 44, 0)\n')
self.h.write('G_DEFINE_AUTOPTR_CLEANUP_FUNC (%s, g_object_unref)\n' % (i.camel_name))
self.h.write('#endif\n')
self.h.write('\n')
self.h.write('GType %s_get_type (void) G_GNUC_CONST;\n'%(i.name_lower))
self.h.write('\n')
self.h.write('GDBusInterfaceInfo *%s_interface_info (void);\n'%(i.name_lower))