mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 09:04:55 +00:00
setting: add property_type field to _nm_setting_property_define_direct_enum
In order to make _nm_setting_property_define_direct_enum more flexible, this patch is introducing property_type argument to it. When set to NULL it will set property_type to nm_sett_info_propert_type_direct_enum.
This commit is contained in:
parent
2921fe7aac
commit
b90dd247be
|
@ -2582,6 +2582,7 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
|
|||
NM_TYPE_SETTING_CONNECTION_AUTOCONNECT_SLAVES,
|
||||
NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT,
|
||||
NM_SETTING_PARAM_FUZZY_IGNORE,
|
||||
NULL,
|
||||
NMSettingConnectionPrivate,
|
||||
autoconnect_slaves);
|
||||
|
||||
|
@ -2658,6 +2659,7 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
|
|||
NM_TYPE_METERED,
|
||||
NM_METERED_UNKNOWN,
|
||||
NM_SETTING_PARAM_REAPPLY_IMMEDIATELY,
|
||||
NULL,
|
||||
NMSettingConnectionPrivate,
|
||||
metered);
|
||||
|
||||
|
|
|
@ -936,6 +936,7 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
|
|||
NM_TYPE_SETTING_IP6_CONFIG_PRIVACY,
|
||||
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN,
|
||||
NM_SETTING_PARAM_NONE,
|
||||
NULL,
|
||||
NMSettingIP6ConfigPrivate,
|
||||
ip6_privacy);
|
||||
|
||||
|
|
|
@ -894,44 +894,45 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define _nm_setting_property_define_direct_enum(properties_override, \
|
||||
obj_properties, \
|
||||
prop_name, \
|
||||
prop_id, \
|
||||
gtype_enum, \
|
||||
default_value, \
|
||||
param_flags, \
|
||||
private_struct_type, \
|
||||
private_struct_field, \
|
||||
... /* extra NMSettInfoProperty fields */) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
GParamSpec *_param_spec; \
|
||||
\
|
||||
G_STATIC_ASSERT( \
|
||||
!NM_FLAGS_ANY((param_flags), \
|
||||
~(NM_SETTING_PARAM_REAPPLY_IMMEDIATELY | NM_SETTING_PARAM_FUZZY_IGNORE \
|
||||
| NM_SETTING_PARAM_INFERRABLE))); \
|
||||
\
|
||||
_param_spec = g_param_spec_enum("" prop_name "", \
|
||||
"", \
|
||||
"", \
|
||||
(gtype_enum), \
|
||||
(default_value), \
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY \
|
||||
| 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_direct_enum, \
|
||||
.direct_offset = \
|
||||
NM_STRUCT_OFFSET_ENSURE_TYPE(int, private_struct_type, private_struct_field), \
|
||||
__VA_ARGS__); \
|
||||
} \
|
||||
G_STMT_END
|
||||
#define _nm_setting_property_define_direct_enum(properties_override, \
|
||||
obj_properties, \
|
||||
prop_name, \
|
||||
prop_id, \
|
||||
gtype_enum, \
|
||||
default_value, \
|
||||
param_flags, \
|
||||
property_type, \
|
||||
private_struct_type, \
|
||||
private_struct_field, \
|
||||
... /* extra NMSettInfoProperty fields */) \
|
||||
({ \
|
||||
GParamSpec *_param_spec; \
|
||||
const NMSettInfoPropertType *_property_type; \
|
||||
\
|
||||
G_STATIC_ASSERT( \
|
||||
!NM_FLAGS_ANY((param_flags), \
|
||||
~(NM_SETTING_PARAM_REAPPLY_IMMEDIATELY | NM_SETTING_PARAM_FUZZY_IGNORE \
|
||||
| NM_SETTING_PARAM_INFERRABLE))); \
|
||||
\
|
||||
_param_spec = g_param_spec_enum("" prop_name "", \
|
||||
"", \
|
||||
"", \
|
||||
(gtype_enum), \
|
||||
(default_value), \
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY \
|
||||
| G_PARAM_STATIC_STRINGS | (param_flags)); \
|
||||
\
|
||||
(obj_properties)[(prop_id)] = _param_spec; \
|
||||
_property_type = (property_type) ?: &nm_sett_info_propert_type_direct_enum; \
|
||||
\
|
||||
_nm_properties_override_gobj( \
|
||||
(properties_override), \
|
||||
_param_spec, \
|
||||
_property_type, \
|
||||
.direct_offset = \
|
||||
NM_STRUCT_OFFSET_ENSURE_TYPE(int, private_struct_type, private_struct_field), \
|
||||
__VA_ARGS__); \
|
||||
})
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
@ -950,6 +951,7 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
|
|||
NM_TYPE_TERNARY, \
|
||||
NM_TERNARY_DEFAULT, \
|
||||
(param_flags), \
|
||||
NULL, \
|
||||
private_struct_type, \
|
||||
private_struct_field, \
|
||||
__VA_ARGS__)
|
||||
|
|
Loading…
Reference in a new issue