internal: add direct_is_aliased_field flag to NMSettInfoProperty

(cherry picked from commit 2921fe7aac)
This commit is contained in:
Fernando Fernandez Mancera 2024-01-22 15:30:36 +01:00
parent e1e612a60b
commit 13281fbd20
3 changed files with 14 additions and 4 deletions

View file

@ -2458,7 +2458,8 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
NMSettingConnectionPrivate,
controller,
.direct_string_allow_empty = TRUE,
.is_deprecated = TRUE);
.is_deprecated = TRUE,
.direct_is_aliased_field = TRUE, );
/**
* NMSettingConnection:controller:
@ -2518,8 +2519,9 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
_nm_setting_connection_slave_type_from_dbus, ),
NMSettingConnectionPrivate,
port_type,
.is_deprecated = 1,
.direct_string_allow_empty = TRUE);
.is_deprecated = TRUE,
.direct_string_allow_empty = TRUE,
.direct_is_aliased_field = TRUE, );
/**
* NMSettingConnection:port-type:

View file

@ -1077,7 +1077,7 @@ _init_direct(NMSetting *setting)
int def_val;
def_val = NM_G_PARAM_SPEC_GET_DEFAULT_ENUM(property_info->param_spec);
nm_assert(*p_val == 0);
nm_assert(NM_IN_SET(*p_val, 0, property_info->direct_is_aliased_field ? def_val : 0));
*p_val = def_val;
break;
}

View file

@ -907,6 +907,14 @@ struct _NMSettInfoProperty {
* is not deprecated. This flag is about the deprecation of the D-Bus representation
* of a property. */
bool dbus_deprecated : 1;
/* Whether the property is an alias.
*
* This flag indicates whether a property is an alias of another. This is used
* during _init_direct() to allow two or more properties to set the value of
* the same field.
*/
bool direct_is_aliased_field : 1;
};
typedef struct {