diff options
author | Thomas Haller <thaller@redhat.com> | 2019-05-07 09:51:17 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-05-23 18:09:49 +0200 |
commit | f5482013ac188cb480db0be7a9f382fc7d10d4cc (patch) | |
tree | fd9d6e616c4a2c49291dd63596659f6160d86ed7 /shared/nm-glib-aux | |
parent | dadd38c484238f70400f86c01676a65eae6936f5 (diff) | |
download | NetworkManager-f5482013ac188cb480db0be7a9f382fc7d10d4cc.tar.gz |
shared: add NM_GOBJECT_PROPERTIES_DEFINE_NOTIFY() macro as part of NM_GOBJECT_PROPERTIES_DEFINE()
This will be needed independently from NM_GOBJECT_PROPERTIES_DEFINE().
Diffstat (limited to 'shared/nm-glib-aux')
-rw-r--r-- | shared/nm-glib-aux/nm-macros-internal.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h index a5ac7ce782..77288dde58 100644 --- a/shared/nm-glib-aux/nm-macros-internal.h +++ b/shared/nm-glib-aux/nm-macros-internal.h @@ -1011,10 +1011,9 @@ typedef enum { \ } _PropertyEnums; \ static GParamSpec *obj_properties[_PROPERTY_ENUMS_LAST] = { NULL, } -#define NM_GOBJECT_PROPERTIES_DEFINE(obj_type, ...) \ -NM_GOBJECT_PROPERTIES_DEFINE_BASE (__VA_ARGS__); \ +#define NM_GOBJECT_PROPERTIES_DEFINE_NOTIFY(obj_type, obj_properties, property_enums_type, prop_0) \ static inline void \ -_nm_gobject_notify_together_impl (obj_type *obj, guint n, const _PropertyEnums *props) \ +_nm_gobject_notify_together_impl (obj_type *obj, guint n, const property_enums_type *props) \ { \ const gboolean freeze_thaw = (n > 1); \ \ @@ -1024,9 +1023,9 @@ _nm_gobject_notify_together_impl (obj_type *obj, guint n, const _PropertyEnums * if (freeze_thaw) \ g_object_freeze_notify ((GObject *) obj); \ while (n-- > 0) { \ - const _PropertyEnums prop = *props++; \ + const property_enums_type prop = *props++; \ \ - if (prop != PROP_0) { \ + if (prop != prop_0) { \ nm_assert ((gsize) prop < G_N_ELEMENTS (obj_properties)); \ nm_assert (obj_properties[prop]); \ g_object_notify_by_pspec ((GObject *) obj, obj_properties[prop]); \ @@ -1037,11 +1036,15 @@ _nm_gobject_notify_together_impl (obj_type *obj, guint n, const _PropertyEnums * } \ \ static inline void \ -_notify (obj_type *obj, _PropertyEnums prop) \ +_notify (obj_type *obj, property_enums_type prop) \ { \ _nm_gobject_notify_together_impl (obj, 1, &prop); \ } \ +#define NM_GOBJECT_PROPERTIES_DEFINE(obj_type, ...) \ +NM_GOBJECT_PROPERTIES_DEFINE_BASE (__VA_ARGS__); \ +NM_GOBJECT_PROPERTIES_DEFINE_NOTIFY (obj_type, obj_properties, _PropertyEnums, PROP_0) + /* invokes _notify() for all arguments (of type _PropertyEnums). Note, that if * there are more than one prop arguments, this will involve a freeze/thaw * of GObject property notifications. */ |