GNOME Bugzilla – Bug 755797
Add G_DEFINE_AUTO_* to gdbus-codegen
Last modified: 2016-03-11 15:02:05 UTC
The autogenerated code should provide g_auto* magic — whether in the form of using G_DECLARE_* macros, or by using G_DEFINE_AUTO* directly.
Created attachment 319518 [details] [review] gdbus-codegen: Add G_DEFINE_AUTO_* to headers
A better patch was pushed in bug 763379 *** This bug has been marked as a duplicate of bug 763379 ***
Comment on attachment 319518 [details] [review] gdbus-codegen: Add G_DEFINE_AUTO_* to headers >From 9f7569a502565e0a668f42db6172ad3c73258c81 Mon Sep 17 00:00:00 2001 >From: Rui Matos <tiagomatos@gmail.com> >Date: Thu, 21 Jan 2016 19:38:19 +0100 >Subject: [PATCH] gdbus-codegen: Add G_DEFINE_AUTO_* to headers > >https://bugzilla.gnome.org/show_bug.cgi?id=755797 >--- > gio/gdbus-2.0/codegen/codegen.py | 7 +++++++ > 1 file changed, 7 insertions(+) > >diff --git a/gio/gdbus-2.0/codegen/codegen.py b/gio/gdbus-2.0/codegen/codegen.py >index 3858bcf..56464e7 100644 >--- a/gio/gdbus-2.0/codegen/codegen.py >+++ b/gio/gdbus-2.0/codegen/codegen.py >@@ -308,6 +308,7 @@ class CodeGenerator: > self.h.write('};\n') > self.h.write('\n') > self.h.write('GType %s_get_type (void) G_GNUC_CONST;\n'%(i.name_lower)) >+ self.h.write('G_DEFINE_AUTOPTR_CLEANUP_FUNC(%s, g_object_unref)\n'%(i.camel_name)) > self.h.write('\n') > self.h.write('GDBusInterfaceInfo *%s_interface_info (void);\n'%(i.name_lower)) > self.h.write('guint %s_override_properties (GObjectClass *klass, guint property_id_begin);\n'%(i.name_lower)) >@@ -450,6 +451,7 @@ class CodeGenerator: > self.h.write('};\n') > self.h.write('\n') > self.h.write('GType %s_proxy_get_type (void) G_GNUC_CONST;\n'%(i.name_lower)) >+ self.h.write('G_DEFINE_AUTOPTR_CLEANUP_FUNC(%sProxy, g_object_unref)\n'%(i.camel_name)) > > self.h.write('\n') > if i.deprecated: >@@ -537,6 +539,7 @@ class CodeGenerator: > self.h.write('};\n') > self.h.write('\n') > self.h.write('GType %s_skeleton_get_type (void) G_GNUC_CONST;\n'%(i.name_lower)) >+ self.h.write('G_DEFINE_AUTOPTR_CLEANUP_FUNC(%sSkeleton, g_object_unref)\n'%(i.camel_name)) > self.h.write('\n') > if i.deprecated: > self.h.write('G_GNUC_DEPRECATED ') >@@ -566,6 +569,7 @@ class CodeGenerator: > self.h.write('GType %sobject_get_type (void) G_GNUC_CONST;\n' > '\n' > %(self.ns_lower)) >+ self.h.write('G_DEFINE_AUTOPTR_CLEANUP_FUNC(%sObject, g_object_unref)\n'%(self.namespace)) > for i in self.ifaces: > if i.deprecated: > self.h.write('G_GNUC_DEPRECATED ') >@@ -601,6 +605,7 @@ class CodeGenerator: > self.h.write('};\n') > self.h.write('\n') > self.h.write('GType %sobject_proxy_get_type (void) G_GNUC_CONST;\n'%(self.ns_lower)) >+ self.h.write('G_DEFINE_AUTOPTR_CLEANUP_FUNC(%sObjectProxy, g_object_unref)\n'%(self.namespace)) > self.h.write('%sObjectProxy *%sobject_proxy_new (GDBusConnection *connection, const gchar *object_path);\n'%(self.namespace, self.ns_lower)) > self.h.write('\n') > self.h.write('#define %sTYPE_OBJECT_SKELETON (%sobject_skeleton_get_type ())\n'%(self.ns_upper, self.ns_lower)) >@@ -627,6 +632,7 @@ class CodeGenerator: > self.h.write('};\n') > self.h.write('\n') > self.h.write('GType %sobject_skeleton_get_type (void) G_GNUC_CONST;\n'%(self.ns_lower)) >+ self.h.write('G_DEFINE_AUTOPTR_CLEANUP_FUNC(%sObjectSkeleton, g_object_unref)\n'%(self.namespace)) > self.h.write('%sObjectSkeleton *%sobject_skeleton_new (const gchar *object_path);\n' > %(self.namespace, self.ns_lower)) > for i in self.ifaces: >@@ -662,6 +668,7 @@ class CodeGenerator: > self.h.write('};\n') > self.h.write('\n') > self.h.write('GType %sobject_manager_client_get_type (void) G_GNUC_CONST;\n'%(self.ns_lower)) >+ self.h.write('G_DEFINE_AUTOPTR_CLEANUP_FUNC(%sObjectManagerClient, g_object_unref)\n'%(self.namespace)) > self.h.write('\n') > self.h.write('GType %sobject_manager_client_get_proxy_type (GDBusObjectManagerClient *manager, const gchar *object_path, const gchar *interface_name, gpointer user_data);\n'%(self.ns_lower)) > self.h.write('\n') >-- >2.5.0