libnm: reuse static property type for strv properties

This commit is contained in:
Thomas Haller 2023-10-25 11:58:29 +02:00
parent 4a9c32063f
commit aa63748379
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 11 additions and 5 deletions

View file

@ -331,6 +331,7 @@ extern const NMSettInfoPropertType nm_sett_info_propert_type_setting_name;
extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_interface_name;
extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_ignore_i;
extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_ignore_u;
extern const NMSettInfoPropertType nm_sett_info_propert_type_gprop_strv_oldstyle;
extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_boolean;
extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_int32;

View file

@ -424,11 +424,7 @@ _nm_setting_class_commit(NMSettingClass *setting_class,
vtype = p->param_spec->value_type;
if (vtype == G_TYPE_STRV)
p->property_type = NM_SETT_INFO_PROPERT_TYPE_GPROP(
G_VARIANT_TYPE_STRING_ARRAY,
.compare_fcn = _nm_setting_property_compare_fcn_default,
.from_dbus_fcn = _nm_setting_property_from_dbus_fcn_gprop,
.from_dbus_is_full = TRUE);
p->property_type = &nm_sett_info_propert_type_gprop_strv;
else
nm_assert_not_reached();
@ -3622,6 +3618,15 @@ const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_ignore_u =
/* No functions set. This property type is to silently ignore the value on D-Bus. */
.compare_fcn = _nm_setting_property_compare_fcn_ignore);
/* This should not be used for new strv properties. Use nm_sett_info_propert_type_direct_strv.
*
* FIXME: existing properties should migrate to nm_sett_info_propert_type_direct_strv. */
const NMSettInfoPropertType nm_sett_info_propert_type_gprop_strv_oldstyle =
NM_SETT_INFO_PROPERT_TYPE_GPROP_INIT(G_VARIANT_TYPE_STRING_ARRAY,
.compare_fcn = _nm_setting_property_compare_fcn_default,
.from_dbus_fcn = _nm_setting_property_from_dbus_fcn_gprop,
.from_dbus_is_full = TRUE);
const NMSettInfoPropertType nm_sett_info_propert_type_direct_boolean =
NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(G_VARIANT_TYPE_BOOLEAN,
.direct_type = NM_VALUE_TYPE_BOOL,