summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2016-04-22 12:34:18 +0100
committerColin Walters <walters@verbum.org>2016-05-04 20:12:31 -0400
commit004bd37d0b33eb39372bd0e0bed8ab9c1ac2c50c (patch)
tree75ff48bb25481e8d840701efdcbfe273a13cafb4
parent421fa2424933574568489689a7f284e936ca1dbe (diff)
downloadpolkit-004bd37d0b33eb39372bd0e0bed8ab9c1ac2c50c.tar.gz
polkit: Add g_autoptr() support for GObject-derived polkit types
Add G_DEFINE_AUTOPTR_CLEANUP_FUNC calls to polkittypes.h, so that g_autoptr() can be used with polkit objects. This is conditional on GLib ≥ 2.44.0 being available. It does not bump polkit’s dependency on GLib. https://bugs.freedesktop.org/show_bug.cgi?id=95065
-rw-r--r--src/polkit/polkittypes.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/polkit/polkittypes.h b/src/polkit/polkittypes.h
index 3de1778..e0cf653 100644
--- a/src/polkit/polkittypes.h
+++ b/src/polkit/polkittypes.h
@@ -64,4 +64,21 @@ typedef struct _PolkitTemporaryAuthorization PolkitTemporaryAuthorization;
struct _PolkitPermission;
typedef struct _PolkitPermission PolkitPermission;
+#if GLIB_CHECK_VERSION(2, 44, 0)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitAuthority, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitActionDescription, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitSubject, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitUnixProcess, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitUnixSession, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitSystemBusName, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitIdentity, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitUnixUser, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitUnixGroup, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitUnixNetgroup, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitAuthorizationResult, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitDetails, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitTemporaryAuthorization, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitPermission, g_object_unref)
+#endif
+
#endif /* __POLKIT_TYPES_H */