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:
@@ -2582,6 +2582,7 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
|
|||||||
NM_TYPE_SETTING_CONNECTION_AUTOCONNECT_SLAVES,
|
NM_TYPE_SETTING_CONNECTION_AUTOCONNECT_SLAVES,
|
||||||
NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT,
|
NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT,
|
||||||
NM_SETTING_PARAM_FUZZY_IGNORE,
|
NM_SETTING_PARAM_FUZZY_IGNORE,
|
||||||
|
NULL,
|
||||||
NMSettingConnectionPrivate,
|
NMSettingConnectionPrivate,
|
||||||
autoconnect_slaves);
|
autoconnect_slaves);
|
||||||
|
|
||||||
@@ -2658,6 +2659,7 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
|
|||||||
NM_TYPE_METERED,
|
NM_TYPE_METERED,
|
||||||
NM_METERED_UNKNOWN,
|
NM_METERED_UNKNOWN,
|
||||||
NM_SETTING_PARAM_REAPPLY_IMMEDIATELY,
|
NM_SETTING_PARAM_REAPPLY_IMMEDIATELY,
|
||||||
|
NULL,
|
||||||
NMSettingConnectionPrivate,
|
NMSettingConnectionPrivate,
|
||||||
metered);
|
metered);
|
||||||
|
|
||||||
|
@@ -936,6 +936,7 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
|
|||||||
NM_TYPE_SETTING_IP6_CONFIG_PRIVACY,
|
NM_TYPE_SETTING_IP6_CONFIG_PRIVACY,
|
||||||
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN,
|
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN,
|
||||||
NM_SETTING_PARAM_NONE,
|
NM_SETTING_PARAM_NONE,
|
||||||
|
NULL,
|
||||||
NMSettingIP6ConfigPrivate,
|
NMSettingIP6ConfigPrivate,
|
||||||
ip6_privacy);
|
ip6_privacy);
|
||||||
|
|
||||||
|
@@ -894,44 +894,45 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define _nm_setting_property_define_direct_enum(properties_override, \
|
#define _nm_setting_property_define_direct_enum(properties_override, \
|
||||||
obj_properties, \
|
obj_properties, \
|
||||||
prop_name, \
|
prop_name, \
|
||||||
prop_id, \
|
prop_id, \
|
||||||
gtype_enum, \
|
gtype_enum, \
|
||||||
default_value, \
|
default_value, \
|
||||||
param_flags, \
|
param_flags, \
|
||||||
private_struct_type, \
|
property_type, \
|
||||||
private_struct_field, \
|
private_struct_type, \
|
||||||
... /* extra NMSettInfoProperty fields */) \
|
private_struct_field, \
|
||||||
G_STMT_START \
|
... /* extra NMSettInfoProperty fields */) \
|
||||||
{ \
|
({ \
|
||||||
GParamSpec *_param_spec; \
|
GParamSpec *_param_spec; \
|
||||||
\
|
const NMSettInfoPropertType *_property_type; \
|
||||||
G_STATIC_ASSERT( \
|
\
|
||||||
!NM_FLAGS_ANY((param_flags), \
|
G_STATIC_ASSERT( \
|
||||||
~(NM_SETTING_PARAM_REAPPLY_IMMEDIATELY | NM_SETTING_PARAM_FUZZY_IGNORE \
|
!NM_FLAGS_ANY((param_flags), \
|
||||||
| NM_SETTING_PARAM_INFERRABLE))); \
|
~(NM_SETTING_PARAM_REAPPLY_IMMEDIATELY | NM_SETTING_PARAM_FUZZY_IGNORE \
|
||||||
\
|
| NM_SETTING_PARAM_INFERRABLE))); \
|
||||||
_param_spec = g_param_spec_enum("" prop_name "", \
|
\
|
||||||
"", \
|
_param_spec = g_param_spec_enum("" prop_name "", \
|
||||||
"", \
|
"", \
|
||||||
(gtype_enum), \
|
"", \
|
||||||
(default_value), \
|
(gtype_enum), \
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY \
|
(default_value), \
|
||||||
| G_PARAM_STATIC_STRINGS | (param_flags)); \
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY \
|
||||||
\
|
| G_PARAM_STATIC_STRINGS | (param_flags)); \
|
||||||
(obj_properties)[(prop_id)] = _param_spec; \
|
\
|
||||||
\
|
(obj_properties)[(prop_id)] = _param_spec; \
|
||||||
_nm_properties_override_gobj( \
|
_property_type = (property_type) ?: &nm_sett_info_propert_type_direct_enum; \
|
||||||
(properties_override), \
|
\
|
||||||
_param_spec, \
|
_nm_properties_override_gobj( \
|
||||||
&nm_sett_info_propert_type_direct_enum, \
|
(properties_override), \
|
||||||
.direct_offset = \
|
_param_spec, \
|
||||||
NM_STRUCT_OFFSET_ENSURE_TYPE(int, private_struct_type, private_struct_field), \
|
_property_type, \
|
||||||
__VA_ARGS__); \
|
.direct_offset = \
|
||||||
} \
|
NM_STRUCT_OFFSET_ENSURE_TYPE(int, private_struct_type, private_struct_field), \
|
||||||
G_STMT_END
|
__VA_ARGS__); \
|
||||||
|
})
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
@@ -950,6 +951,7 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
|
|||||||
NM_TYPE_TERNARY, \
|
NM_TYPE_TERNARY, \
|
||||||
NM_TERNARY_DEFAULT, \
|
NM_TERNARY_DEFAULT, \
|
||||||
(param_flags), \
|
(param_flags), \
|
||||||
|
NULL, \
|
||||||
private_struct_type, \
|
private_struct_type, \
|
||||||
private_struct_field, \
|
private_struct_field, \
|
||||||
__VA_ARGS__)
|
__VA_ARGS__)
|
||||||
|
Reference in New Issue
Block a user