libnm: add _nm_setting_property_define_gprop_strv_oldstyle() define

This will be used for adding G_TYPE_STRV properties. This is a legacy
approach, new properties should use _nm_setting_property_define_direct_strv(),
which is more efficient and where the meta-data knows more about the
strv property.

Will be used next.
This commit is contained in:
Thomas Haller 2023-10-25 13:15:58 +02:00
parent aa63748379
commit 907970d08b
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -1032,6 +1032,38 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
} \
G_STMT_END
/* This should not be used for new strv properties. Use _nm_setting_property_define_direct_strv().
*
* FIXME: existing properties should migrate to _nm_setting_property_define_direct_strv(). */
#define _nm_setting_property_define_gprop_strv_oldstyle(properties_override, \
obj_properties, \
prop_name, \
prop_id, \
param_flags) \
G_STMT_START \
{ \
GParamSpec *_param_spec; \
\
G_STATIC_ASSERT(!NM_FLAGS_ANY((param_flags), \
~(NM_SETTING_PARAM_SECRET | NM_SETTING_PARAM_FUZZY_IGNORE \
| NM_SETTING_PARAM_INFERRABLE \
| NM_SETTING_PARAM_REAPPLY_IMMEDIATELY))); \
\
_param_spec = \
g_param_spec_boxed("" prop_name "", \
"", \
"", \
G_TYPE_STRV, \
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | (param_flags)); \
\
(obj_properties)[(prop_id)] = _param_spec; \
\
_nm_properties_override_gobj((properties_override), \
_param_spec, \
&nm_sett_info_propert_type_gprop_strv_oldstyle); \
} \
G_STMT_END
/*****************************************************************************/
gboolean _nm_setting_use_legacy_property(NMSetting *setting,