diff --git a/src/libnm-core-impl/nm-setting-infiniband.c b/src/libnm-core-impl/nm-setting-infiniband.c index 2ee44489f2..7e6705c255 100644 --- a/src/libnm-core-impl/nm-setting-infiniband.c +++ b/src/libnm-core-impl/nm-setting-infiniband.c @@ -37,8 +37,8 @@ typedef struct { char *parent; char *virtual_iface_name; gsize virtual_iface_name_parent_length; - int virtual_iface_name_p_key; - int p_key; + gint32 virtual_iface_name_p_key; + gint32 p_key; guint32 mtu; } NMSettingInfinibandPrivate; @@ -319,14 +319,11 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) case PROP_TRANSPORT_MODE: g_value_set_string(value, nm_setting_infiniband_get_transport_mode(setting)); break; - case PROP_P_KEY: - g_value_set_int(value, nm_setting_infiniband_get_p_key(setting)); - break; case PROP_PARENT: g_value_set_string(value, nm_setting_infiniband_get_parent(setting)); break; default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + _nm_setting_property_get_property_direct(object, prop_id, value, pspec); break; } } @@ -357,7 +354,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps priv->parent = g_value_dup_string(value); break; default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + _nm_setting_property_set_property_direct(object, prop_id, value, pspec); break; } } @@ -366,11 +363,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps static void nm_setting_infiniband_init(NMSettingInfiniband *self) -{ - NMSettingInfinibandPrivate *priv = NM_SETTING_INFINIBAND_GET_PRIVATE(self); - - priv->p_key = -1; -} +{} /** * nm_setting_infiniband_new: @@ -507,14 +500,16 @@ nm_setting_infiniband_class_init(NMSettingInfinibandClass *klass) * example: PKEY=yes PKEY_ID=2 PHYSDEV=mlx4_ib0 DEVICE=mlx4_ib0.8002 * ---end--- */ - obj_properties[PROP_P_KEY] = - g_param_spec_int(NM_SETTING_INFINIBAND_P_KEY, - "", - "", - -1, - 0xFFFF, - -1, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS); + _nm_setting_property_define_direct_int32(properties_override, + obj_properties, + NM_SETTING_INFINIBAND_P_KEY, + PROP_P_KEY, + -1, + 0xFFFF, + -1, + NM_SETTING_PARAM_INFERRABLE, + NMSettingInfinibandPrivate, + p_key); /** * NMSettingInfiniband:parent: diff --git a/src/libnm-core-impl/nm-setting-ip-config.c b/src/libnm-core-impl/nm-setting-ip-config.c index 83ef72a6de..1569ab5975 100644 --- a/src/libnm-core-impl/nm-setting-ip-config.c +++ b/src/libnm-core-impl/nm-setting-ip-config.c @@ -5832,6 +5832,34 @@ _nm_sett_info_property_override_create_array_ip_config(int addr_family) .direct_offset = NM_STRUCT_OFFSET_ENSURE_TYPE(bool, NMSettingIPConfigPrivate, ignore_auto_dns)); + _nm_properties_override_gobj( + properties_override, + obj_properties[PROP_DNS_PRIORITY], + &nm_sett_info_propert_type_direct_int32, + .direct_offset = + NM_STRUCT_OFFSET_ENSURE_TYPE(gint32, NMSettingIPConfigPrivate, dns_priority)); + + _nm_properties_override_gobj( + properties_override, + obj_properties[PROP_DHCP_TIMEOUT], + &nm_sett_info_propert_type_direct_int32, + .direct_offset = + NM_STRUCT_OFFSET_ENSURE_TYPE(gint32, NMSettingIPConfigPrivate, dhcp_timeout)); + + _nm_properties_override_gobj( + properties_override, + obj_properties[PROP_REQUIRED_TIMEOUT], + &nm_sett_info_propert_type_direct_int32, + .direct_offset = + NM_STRUCT_OFFSET_ENSURE_TYPE(gint32, NMSettingIPConfigPrivate, required_timeout)); + + _nm_properties_override_gobj( + properties_override, + obj_properties[PROP_DAD_TIMEOUT], + &nm_sett_info_propert_type_direct_int32, + .direct_offset = + NM_STRUCT_OFFSET_ENSURE_TYPE(gint32, NMSettingIPConfigPrivate, dad_timeout)); + _nm_properties_override_gobj( properties_override, obj_properties[PROP_DHCP_SEND_HOSTNAME], @@ -5878,9 +5906,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) priv->dns_options ? _nm_utils_ptrarray_to_strv(priv->dns_options) : NULL); break; - case PROP_DNS_PRIORITY: - g_value_set_int(value, priv->dns_priority); - break; case PROP_ADDRESSES: g_value_take_boxed(value, _nm_utils_copy_array(priv->addresses, @@ -5920,15 +5945,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) case PROP_MAY_FAIL: g_value_set_boolean(value, priv->may_fail); break; - case PROP_DAD_TIMEOUT: - g_value_set_int(value, nm_setting_ip_config_get_dad_timeout(setting)); - break; - case PROP_DHCP_TIMEOUT: - g_value_set_int(value, nm_setting_ip_config_get_dhcp_timeout(setting)); - break; - case PROP_REQUIRED_TIMEOUT: - g_value_set_int(value, nm_setting_ip_config_get_required_timeout(setting)); - break; case PROP_DHCP_IAID: g_value_set_string(value, nm_setting_ip_config_get_dhcp_iaid(setting)); break; @@ -5939,7 +5955,7 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) g_value_set_boxed(value, nm_strvarray_get_strv_non_empty(priv->dhcp_reject_servers, NULL)); break; default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + _nm_setting_property_get_property_direct(object, prop_id, value, pspec); break; } } @@ -5984,9 +6000,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps } } break; - case PROP_DNS_PRIORITY: - priv->dns_priority = g_value_get_int(value); - break; case PROP_ADDRESSES: g_ptr_array_unref(priv->addresses); priv->addresses = _nm_utils_copy_array(g_value_get_boxed(value), @@ -6031,15 +6044,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps case PROP_MAY_FAIL: priv->may_fail = g_value_get_boolean(value); break; - case PROP_DAD_TIMEOUT: - priv->dad_timeout = g_value_get_int(value); - break; - case PROP_DHCP_TIMEOUT: - priv->dhcp_timeout = g_value_get_int(value); - break; - case PROP_REQUIRED_TIMEOUT: - priv->required_timeout = g_value_get_int(value); - break; case PROP_DHCP_IAID: g_free(priv->dhcp_iaid); priv->dhcp_iaid = g_value_dup_string(value); @@ -6051,7 +6055,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps nm_strvarray_set_strv(&priv->dhcp_reject_servers, g_value_get_boxed(value)); break; default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + _nm_setting_property_set_property_direct(object, prop_id, value, pspec); break; } } @@ -6063,13 +6067,11 @@ _nm_setting_ip_config_private_init(gpointer self, NMSettingIPConfigPrivate *priv { nm_assert(NM_IS_SETTING_IP_CONFIG(self)); - priv->dns = g_ptr_array_new_with_free_func(g_free); - priv->dns_search = g_ptr_array_new_with_free_func(g_free); - priv->addresses = g_ptr_array_new_with_free_func((GDestroyNotify) nm_ip_address_unref); - priv->routes = g_ptr_array_new_with_free_func((GDestroyNotify) nm_ip_route_unref); - priv->route_metric = -1; - priv->dad_timeout = -1; - priv->required_timeout = -1; + priv->dns = g_ptr_array_new_with_free_func(g_free); + priv->dns_search = g_ptr_array_new_with_free_func(g_free); + priv->addresses = g_ptr_array_new_with_free_func((GDestroyNotify) nm_ip_address_unref); + priv->routes = g_ptr_array_new_with_free_func((GDestroyNotify) nm_ip_route_unref); + priv->route_metric = -1; } static void diff --git a/src/libnm-core-impl/nm-setting-ip6-config.c b/src/libnm-core-impl/nm-setting-ip6-config.c index 1319224171..8ac750c243 100644 --- a/src/libnm-core-impl/nm-setting-ip6-config.c +++ b/src/libnm-core-impl/nm-setting-ip6-config.c @@ -48,11 +48,11 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_IP6_PRIVACY, typedef struct { NMSettingIPConfigPrivate parent; - char *token; - char *dhcp_duid; - int ip6_privacy; - NMSettingIP6ConfigAddrGenMode addr_gen_mode; - gint32 ra_timeout; + char *token; + char *dhcp_duid; + int ip6_privacy; + gint32 addr_gen_mode; + gint32 ra_timeout; } NMSettingIP6ConfigPrivate; /** @@ -507,18 +507,12 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE(object); switch (prop_id) { - case PROP_ADDR_GEN_MODE: - g_value_set_int(value, priv->addr_gen_mode); - break; case PROP_TOKEN: g_value_set_string(value, priv->token); break; case PROP_DHCP_DUID: g_value_set_string(value, priv->dhcp_duid); break; - case PROP_RA_TIMEOUT: - g_value_set_int(value, priv->ra_timeout); - break; default: _nm_setting_property_get_property_direct(object, prop_id, value, pspec); break; @@ -531,9 +525,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE(object); switch (prop_id) { - case PROP_ADDR_GEN_MODE: - priv->addr_gen_mode = g_value_get_int(value); - break; case PROP_TOKEN: g_free(priv->token); priv->token = g_value_dup_string(value); @@ -542,9 +533,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps g_free(priv->dhcp_duid); priv->dhcp_duid = g_value_dup_string(value); break; - case PROP_RA_TIMEOUT: - priv->ra_timeout = g_value_get_int(value); - break; default: _nm_setting_property_set_property_direct(object, prop_id, value, pspec); break; @@ -559,8 +547,6 @@ nm_setting_ip6_config_init(NMSettingIP6Config *setting) NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE(setting); _nm_setting_ip_config_private_init(setting, &priv->parent); - - priv->addr_gen_mode = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY; } /** @@ -847,14 +833,16 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass) * example: IPV6_ADDR_GEN_MODE=stable-privacy * ---end--- */ - obj_properties[PROP_ADDR_GEN_MODE] = - g_param_spec_int(NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE, - "", - "", - G_MININT, - G_MAXINT, - NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + _nm_setting_property_define_direct_int32(properties_override, + obj_properties, + NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE, + PROP_ADDR_GEN_MODE, + G_MININT32, + G_MAXINT32, + NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY, + NM_SETTING_PARAM_NONE, + NMSettingIP6ConfigPrivate, + addr_gen_mode); /** * NMSettingIP6Config:token: @@ -897,15 +885,16 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass) * example: IPV6_RA_TIMEOUT=10 * ---end--- */ - - obj_properties[PROP_RA_TIMEOUT] = g_param_spec_int( - NM_SETTING_IP6_CONFIG_RA_TIMEOUT, - "", - "", - 0, - G_MAXINT32, - 0, - G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_STATIC_STRINGS); + _nm_setting_property_define_direct_int32(properties_override, + obj_properties, + NM_SETTING_IP6_CONFIG_RA_TIMEOUT, + PROP_RA_TIMEOUT, + 0, + G_MAXINT32, + 0, + NM_SETTING_PARAM_FUZZY_IGNORE, + NMSettingIP6ConfigPrivate, + ra_timeout); /** * NMSettingIP6Config:dhcp-duid: diff --git a/src/libnm-core-impl/nm-setting-macsec.c b/src/libnm-core-impl/nm-setting-macsec.c index 386875ee3b..ac6ecf04db 100644 --- a/src/libnm-core-impl/nm-setting-macsec.c +++ b/src/libnm-core-impl/nm-setting-macsec.c @@ -38,15 +38,15 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_PARENT, PROP_SEND_SCI, ); typedef struct { - char *parent; - char *mka_cak; - char *mka_ckn; - int port; - guint mka_cak_flags; - NMSettingMacsecMode mode; - NMSettingMacsecValidation validation; - bool encrypt; - bool send_sci; + char *parent; + char *mka_cak; + char *mka_ckn; + guint mka_cak_flags; + gint32 mode; + gint32 validation; + gint32 port; + bool encrypt; + bool send_sci; } NMSettingMacsecPrivate; /** @@ -99,6 +99,7 @@ NMSettingMacsecMode nm_setting_macsec_get_mode(NMSettingMacsec *setting) { g_return_val_if_fail(NM_IS_SETTING_MACSEC(setting), NM_SETTING_MACSEC_MODE_PSK); + return NM_SETTING_MACSEC_GET_PRIVATE(setting)->mode; } @@ -175,6 +176,7 @@ int nm_setting_macsec_get_port(NMSettingMacsec *setting) { g_return_val_if_fail(NM_IS_SETTING_MACSEC(setting), 1); + return NM_SETTING_MACSEC_GET_PRIVATE(setting)->port; } @@ -190,6 +192,7 @@ NMSettingMacsecValidation nm_setting_macsec_get_validation(NMSettingMacsec *setting) { g_return_val_if_fail(NM_IS_SETTING_MACSEC(setting), NM_SETTING_MACSEC_VALIDATION_DISABLE); + return NM_SETTING_MACSEC_GET_PRIVATE(setting)->validation; } @@ -374,15 +377,7 @@ verify(NMSetting *setting, NMConnection *connection, GError **error) return FALSE; } - if (priv->port <= 0 || priv->port > 65534) { - g_set_error(error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_MISSING_PROPERTY, - _("invalid port %d"), - priv->port); - g_prefix_error(error, "%s.%s: ", NM_SETTING_MACSEC_SETTING_NAME, NM_SETTING_MACSEC_PORT); - return FALSE; - } + nm_assert(priv->port >= 1 && priv->port <= 65534); if (priv->mode != NM_SETTING_MACSEC_MODE_PSK && (priv->mka_cak || priv->mka_ckn)) { g_set_error_literal(error, @@ -411,9 +406,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) case PROP_PARENT: g_value_set_string(value, priv->parent); break; - case PROP_MODE: - g_value_set_int(value, priv->mode); - break; case PROP_ENCRYPT: g_value_set_boolean(value, priv->encrypt); break; @@ -423,12 +415,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) case PROP_MKA_CKN: g_value_set_string(value, priv->mka_ckn); break; - case PROP_PORT: - g_value_set_int(value, priv->port); - break; - case PROP_VALIDATION: - g_value_set_int(value, priv->validation); - break; case PROP_SEND_SCI: g_value_set_boolean(value, priv->send_sci); break; @@ -449,9 +435,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps g_free(priv->parent); priv->parent = g_value_dup_string(value); break; - case PROP_MODE: - priv->mode = g_value_get_int(value); - break; case PROP_ENCRYPT: priv->encrypt = g_value_get_boolean(value); break; @@ -463,12 +446,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps g_free(priv->mka_ckn); priv->mka_ckn = g_value_dup_string(value); break; - case PROP_PORT: - priv->port = g_value_get_int(value); - break; - case PROP_VALIDATION: - priv->validation = g_value_get_int(value); - break; case PROP_SEND_SCI: priv->send_sci = g_value_get_boolean(value); break; @@ -482,13 +459,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps static void nm_setting_macsec_init(NMSettingMacsec *self) -{ - NMSettingMacsecPrivate *priv = NM_SETTING_MACSEC_GET_PRIVATE(self); - - nm_assert(priv->mode == NM_SETTING_MACSEC_MODE_PSK); - priv->port = 1; - priv->validation = NM_SETTING_MACSEC_VALIDATION_STRICT; -} +{} /** * nm_setting_macsec_new: @@ -559,14 +530,16 @@ nm_setting_macsec_class_init(NMSettingMacsecClass *klass) * * Since: 1.6 **/ - obj_properties[PROP_MODE] = - g_param_spec_int(NM_SETTING_MACSEC_MODE, - "", - "", - G_MININT, - G_MAXINT, - NM_SETTING_MACSEC_MODE_PSK, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS); + _nm_setting_property_define_direct_int32(properties_override, + obj_properties, + NM_SETTING_MACSEC_MODE, + PROP_MODE, + G_MININT32, + G_MAXINT32, + NM_SETTING_MACSEC_MODE_PSK, + NM_SETTING_PARAM_INFERRABLE, + NMSettingMacsecPrivate, + mode); /** * NMSettingMacsec:encrypt: @@ -635,14 +608,16 @@ nm_setting_macsec_class_init(NMSettingMacsecClass *klass) * * Since: 1.6 **/ - obj_properties[PROP_PORT] = - g_param_spec_int(NM_SETTING_MACSEC_PORT, - "", - "", - 1, - 65534, - 1, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS); + _nm_setting_property_define_direct_int32(properties_override, + obj_properties, + NM_SETTING_MACSEC_PORT, + PROP_PORT, + 1, + 65534, + 1, + NM_SETTING_PARAM_INFERRABLE, + NMSettingMacsecPrivate, + port); /** * NMSettingMacsec:validation: @@ -651,14 +626,16 @@ nm_setting_macsec_class_init(NMSettingMacsecClass *klass) * * Since: 1.6 **/ - obj_properties[PROP_VALIDATION] = - g_param_spec_int(NM_SETTING_MACSEC_VALIDATION, - "", - "", - G_MININT, - G_MAXINT, - NM_SETTING_MACSEC_VALIDATION_STRICT, - G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS); + _nm_setting_property_define_direct_int32(properties_override, + obj_properties, + NM_SETTING_MACSEC_VALIDATION, + PROP_VALIDATION, + G_MININT32, + G_MAXINT32, + NM_SETTING_MACSEC_VALIDATION_STRICT, + NM_SETTING_PARAM_INFERRABLE, + NMSettingMacsecPrivate, + validation); /** * NMSettingMacsec:send-sci: diff --git a/src/libnm-core-impl/nm-setting-private.h b/src/libnm-core-impl/nm-setting-private.h index df676983dc..90627e792d 100644 --- a/src/libnm-core-impl/nm-setting-private.h +++ b/src/libnm-core-impl/nm-setting-private.h @@ -141,10 +141,10 @@ typedef struct { char *dhcp_iaid; gint64 route_metric; guint dhcp_hostname_flags; - int dns_priority; - int dad_timeout; - int dhcp_timeout; - int required_timeout; + gint32 required_timeout; + gint32 dad_timeout; + gint32 dhcp_timeout; + gint32 dns_priority; guint32 route_table; bool ignore_auto_routes; bool ignore_auto_dns; @@ -270,7 +270,6 @@ extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_interfac 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_plain_i; extern const NMSettInfoPropertType nm_sett_info_propert_type_plain_u; extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_boolean; diff --git a/src/libnm-core-impl/nm-setting-wireless-security.c b/src/libnm-core-impl/nm-setting-wireless-security.c index db1079f233..0c681aec11 100644 --- a/src/libnm-core-impl/nm-setting-wireless-security.c +++ b/src/libnm-core-impl/nm-setting-wireless-security.c @@ -77,10 +77,10 @@ typedef struct { guint leap_password_flags; guint wep_key_flags; guint psk_flags; - NMSettingWirelessSecurityPmf pmf; NMWepKeyType wep_key_type; NMSettingWirelessSecurityWpsMethod wps_method; - NMSettingWirelessSecurityFils fils; + gint32 pmf; + gint32 fils; guint32 wep_tx_keyidx; } NMSettingWirelessSecurityPrivate; @@ -1332,9 +1332,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) case PROP_GROUP: g_value_take_boxed(value, _nm_utils_slist_to_strv(priv->group, TRUE)); break; - case PROP_PMF: - g_value_set_int(value, nm_setting_wireless_security_get_pmf(setting)); - break; case PROP_LEAP_USERNAME: g_value_set_string(value, priv->leap_username); break; @@ -1362,9 +1359,6 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) case PROP_WPS_METHOD: g_value_set_uint(value, priv->wps_method); break; - case PROP_FILS: - g_value_set_int(value, nm_setting_wireless_security_get_fils(setting)); - break; default: _nm_setting_property_get_property_direct(object, prop_id, value, pspec); break; @@ -1404,9 +1398,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps g_slist_free_full(priv->group, g_free); priv->group = nm_strv_to_gslist(g_value_get_boxed(value), TRUE); break; - case PROP_PMF: - priv->pmf = g_value_get_int(value); - break; case PROP_LEAP_USERNAME: g_free(priv->leap_username); priv->leap_username = g_value_dup_string(value); @@ -1441,9 +1432,6 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps case PROP_WPS_METHOD: priv->wps_method = g_value_get_uint(value); break; - case PROP_FILS: - priv->fils = g_value_get_int(value); - break; default: _nm_setting_property_set_property_direct(object, prop_id, value, pspec); break; @@ -1675,14 +1663,16 @@ nm_setting_wireless_security_class_init(NMSettingWirelessSecurityClass *klass) * example: PMF=required * ---end--- */ - obj_properties[PROP_PMF] = g_param_spec_int(NM_SETTING_WIRELESS_SECURITY_PMF, - "", - "", - G_MININT32, - G_MAXINT32, - 0, - G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE - | G_PARAM_STATIC_STRINGS); + _nm_setting_property_define_direct_int32(properties_override, + obj_properties, + NM_SETTING_WIRELESS_SECURITY_PMF, + PROP_PMF, + G_MININT32, + G_MAXINT32, + 0, + NM_SETTING_PARAM_FUZZY_IGNORE, + NMSettingWirelessSecurityPrivate, + pmf); /** * NMSettingWirelessSecurity:leap-username: @@ -1973,14 +1963,16 @@ nm_setting_wireless_security_class_init(NMSettingWirelessSecurityClass *klass) * example: FILS=required * ---end--- */ - obj_properties[PROP_FILS] = g_param_spec_int(NM_SETTING_WIRELESS_SECURITY_FILS, - "", - "", - G_MININT32, - G_MAXINT32, - 0, - G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE - | G_PARAM_STATIC_STRINGS); + _nm_setting_property_define_direct_int32(properties_override, + obj_properties, + NM_SETTING_WIRELESS_SECURITY_FILS, + PROP_FILS, + G_MININT32, + G_MAXINT32, + 0, + NM_SETTING_PARAM_FUZZY_IGNORE, + NMSettingWirelessSecurityPrivate, + fils); g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties); diff --git a/src/libnm-core-impl/nm-setting.c b/src/libnm-core-impl/nm-setting.c index ce47c9bd1a..e161e2b1d5 100644 --- a/src/libnm-core-impl/nm-setting.c +++ b/src/libnm-core-impl/nm-setting.c @@ -376,9 +376,7 @@ _nm_setting_class_commit(NMSettingClass *setting_class, nm_assert(p->param_spec); vtype = p->param_spec->value_type; - if (vtype == G_TYPE_INT) - p->property_type = &nm_sett_info_propert_type_plain_i; - else if (vtype == G_TYPE_UINT) + if (vtype == G_TYPE_UINT) p->property_type = &nm_sett_info_propert_type_plain_u; else if (vtype == G_TYPE_INT64) p->property_type = NM_SETT_INFO_PROPERT_TYPE_GPROP( @@ -3493,12 +3491,6 @@ 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); -const NMSettInfoPropertType nm_sett_info_propert_type_plain_i = - NM_SETT_INFO_PROPERT_TYPE_GPROP_INIT(G_VARIANT_TYPE_INT32, - .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_plain_u = NM_SETT_INFO_PROPERT_TYPE_GPROP_INIT(G_VARIANT_TYPE_UINT32, .compare_fcn = _nm_setting_property_compare_fcn_default, diff --git a/src/libnm-core-impl/tests/test-setting.c b/src/libnm-core-impl/tests/test-setting.c index 0540b716a4..3683393115 100644 --- a/src/libnm-core-impl/tests/test-setting.c +++ b/src/libnm-core-impl/tests/test-setting.c @@ -4898,16 +4898,11 @@ check_done:; != 0) continue; - if ((pt == &nm_sett_info_propert_type_plain_i - && pt_2 == &nm_sett_info_propert_type_deprecated_ignore_i) - || (pt_2 == &nm_sett_info_propert_type_plain_i - && pt == &nm_sett_info_propert_type_deprecated_ignore_i) - || (pt == &nm_sett_info_propert_type_plain_u - && pt_2 == &nm_sett_info_propert_type_deprecated_ignore_u) + if ((pt == &nm_sett_info_propert_type_plain_u + && pt_2 == &nm_sett_info_propert_type_deprecated_ignore_u) || (pt_2 == &nm_sett_info_propert_type_plain_u && pt == &nm_sett_info_propert_type_deprecated_ignore_u)) { /* These are known to be duplicated. This is the case for - * "gsm.network-type" and plain properties like "802-11-wireless-security.fils" ("i" D-Bus type) * "gsm.allowed-bands" and plain properties like "802-11-olpc-mesh.channel" ("u" D-Bus type) * While the content/behaviour of the property types are identical, their purpose * is different. So allow them.