mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-07 13:08:10 +02:00
dbus: add helper macros for GDBusAnnotationInfo
This commit is contained in:
parent
dff7ed3e76
commit
da743663c3
2 changed files with 52 additions and 19 deletions
|
|
@ -11,6 +11,18 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
const GDBusAnnotationInfo _nm_gdbus_annotation_info_deprecated = {
|
||||
.key = "org.freedesktop.DBus.Deprecated",
|
||||
.value = "true",
|
||||
};
|
||||
|
||||
const GDBusAnnotationInfo *const _nm_gdbus_annotation_info_list_deprecated[] = {
|
||||
NM_GDBUS_ANNOTATION_INFO_DEPRECATED(),
|
||||
NULL,
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
GDBusPropertyInfo *
|
||||
nm_dbus_utils_interface_info_lookup_property(const GDBusInterfaceInfo *interface_info,
|
||||
const char *property_name,
|
||||
|
|
|
|||
|
|
@ -45,34 +45,55 @@ typedef struct {
|
|||
G_STATIC_ASSERT(G_STRUCT_OFFSET(NMDBusPropertyInfoExtended, property_name)
|
||||
== G_STRUCT_OFFSET(struct _NMDBusPropertyInfoExtendedBase, property_name));
|
||||
|
||||
#define NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE(m_name, m_signature, m_property_name) \
|
||||
((GDBusPropertyInfo *) &((const struct _NMDBusPropertyInfoExtendedBase){ \
|
||||
._parent = \
|
||||
{ \
|
||||
.ref_count = -1, \
|
||||
.name = m_name, \
|
||||
.signature = m_signature, \
|
||||
.flags = G_DBUS_PROPERTY_INFO_FLAGS_READABLE, \
|
||||
}, \
|
||||
.property_name = m_property_name, \
|
||||
extern const GDBusAnnotationInfo _nm_gdbus_annotation_info_deprecated;
|
||||
|
||||
#define NM_GDBUS_ANNOTATION_INFO_DEPRECATED() \
|
||||
((GDBusAnnotationInfo *) &_nm_gdbus_annotation_info_deprecated)
|
||||
|
||||
#define NM_DEFINE_DBUS_ANNOTATION_INFO(a_key, a_value) \
|
||||
((GDBusAnnotationInfo *) &((const GDBusAnnotationInfo){ \
|
||||
.key = (a_key), \
|
||||
.value = (a_value), \
|
||||
}))
|
||||
|
||||
extern const GDBusAnnotationInfo *const _nm_gdbus_annotation_info_list_deprecated[];
|
||||
|
||||
/* This is a (NULL terminated) list of GDBusAnnotationInfo with only one entry:
|
||||
* NM_GDBUS_ANNOTATION_INFO_DEPRECATED. This single instance can be reused for the
|
||||
* common case where we only have one annotation (and it's the deprecation).
|
||||
*
|
||||
* Otherwise, NM_DEFINE_DBUS_ANNOTATION_INFOS() is for defining a new list. */
|
||||
#define NM_GDBUS_ANNOTATION_INFO_LIST_DEPRECATED() \
|
||||
((GDBusAnnotationInfo **) _nm_gdbus_annotation_info_list_deprecated)
|
||||
|
||||
#define NM_DEFINE_DBUS_ANNOTATION_INFOS(...) \
|
||||
((GDBusAnnotationInfo **) ((const GDBusAnnotationInfo *const[]){__VA_ARGS__, NULL}))
|
||||
|
||||
#define NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READABLE(m_name, m_signature, m_property_name, ...) \
|
||||
((GDBusPropertyInfo *) &((const struct _NMDBusPropertyInfoExtendedBase){ \
|
||||
._parent = {.ref_count = -1, \
|
||||
.name = m_name, \
|
||||
.signature = m_signature, \
|
||||
.flags = G_DBUS_PROPERTY_INFO_FLAGS_READABLE, \
|
||||
__VA_ARGS__}, \
|
||||
.property_name = m_property_name, \
|
||||
}))
|
||||
|
||||
#define NM_DEFINE_DBUS_PROPERTY_INFO_EXTENDED_READWRITABLE(m_name, \
|
||||
m_signature, \
|
||||
m_property_name, \
|
||||
m_permission, \
|
||||
m_audit_op) \
|
||||
m_audit_op, \
|
||||
...) \
|
||||
((GDBusPropertyInfo *) &((const struct _NMDBusPropertyInfoExtendedReadWritable){ \
|
||||
._base = \
|
||||
{ \
|
||||
._parent = \
|
||||
{ \
|
||||
.ref_count = -1, \
|
||||
.name = m_name, \
|
||||
.signature = m_signature, \
|
||||
.flags = G_DBUS_PROPERTY_INFO_FLAGS_READABLE \
|
||||
| G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, \
|
||||
}, \
|
||||
._parent = {.ref_count = -1, \
|
||||
.name = m_name, \
|
||||
.signature = m_signature, \
|
||||
.flags = G_DBUS_PROPERTY_INFO_FLAGS_READABLE \
|
||||
| G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, \
|
||||
__VA_ARGS__}, \
|
||||
.property_name = m_property_name, \
|
||||
}, \
|
||||
.permission = m_permission, \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue