[glib] codegen: Add support for g_autoptr to gdbus-code gen–generated objects
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] codegen: Add support for g_autoptr to gdbus-code gen–generated objects
- Date: Thu, 10 Mar 2016 09:40:18 +0000 (UTC)
commit fd6ca66c16b942d1f7d8c70468a438ad4c887c7b
Author: Philip Withnall <philip withnall collabora co uk>
Date: Wed Mar 9 15:51:45 2016 +0000
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
gio/gdbus-2.0/codegen/codegen.py | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/gio/gdbus-2.0/codegen/codegen.py b/gio/gdbus-2.0/codegen/codegen.py
index 3858bcf..9d1acbd 100644
--- a/gio/gdbus-2.0/codegen/codegen.py
+++ b/gio/gdbus-2.0/codegen/codegen.py
@@ -450,6 +450,10 @@ 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('\n')
+ self.h.write('#if GLIB_CHECK_VERSION(2, 44, 0)\n')
+ self.h.write('G_DEFINE_AUTOPTR_CLEANUP_FUNC (%sProxy, g_object_unref)\n' % (i.camel_name))
+ self.h.write('#endif\n')
self.h.write('\n')
if i.deprecated:
@@ -538,6 +542,10 @@ class CodeGenerator:
self.h.write('\n')
self.h.write('GType %s_skeleton_get_type (void) G_GNUC_CONST;\n'%(i.name_lower))
self.h.write('\n')
+ self.h.write('#if GLIB_CHECK_VERSION(2, 44, 0)\n')
+ self.h.write('G_DEFINE_AUTOPTR_CLEANUP_FUNC (%sSkeleton, g_object_unref)\n' % (i.camel_name))
+ self.h.write('#endif\n')
+ self.h.write('\n')
if i.deprecated:
self.h.write('G_GNUC_DEPRECATED ')
self.h.write('%s *%s_skeleton_new (void);\n'%(i.camel_name, i.name_lower))
@@ -601,6 +609,11 @@ 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('\n')
+ self.h.write('#if GLIB_CHECK_VERSION(2, 44, 0)\n')
+ self.h.write('G_DEFINE_AUTOPTR_CLEANUP_FUNC (%sObjectProxy, g_object_unref)\n' %
(self.namespace))
+ self.h.write('#endif\n')
+ self.h.write('\n')
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 +640,11 @@ 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('\n')
+ self.h.write('#if GLIB_CHECK_VERSION(2, 44, 0)\n')
+ self.h.write('G_DEFINE_AUTOPTR_CLEANUP_FUNC (%sObjectSkeleton, g_object_unref)\n' %
(self.namespace))
+ self.h.write('#endif\n')
+ self.h.write('\n')
self.h.write('%sObjectSkeleton *%sobject_skeleton_new (const gchar *object_path);\n'
%(self.namespace, self.ns_lower))
for i in self.ifaces:
@@ -661,6 +679,10 @@ class CodeGenerator:
self.h.write(' GDBusObjectManagerClientClass parent_class;\n')
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 (%sObjectManagerClient, g_object_unref)\n' %
(self.namespace))
+ self.h.write('#endif\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('\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))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]