libnm: use _nm_setting_property_define_direct_string()

This commit is contained in:
Thomas Haller 2021-06-28 17:28:21 +02:00
parent 7556b4f382
commit 102a1f5c31
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
12 changed files with 227 additions and 281 deletions

View file

@ -216,12 +216,13 @@ nm_setting_6lowpan_class_init(NMSetting6LowpanClass *klass)
*
* Since: 1.14
**/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_6LOWPAN_PARENT,
PROP_PARENT,
NM_SETTING_PARAM_INFERRABLE,
nm_setting_6lowpan_get_parent);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_6LOWPAN_PARENT,
PROP_PARENT,
NM_SETTING_PARAM_INFERRABLE,
NMSetting6LowpanPrivate,
parent);
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);

View file

@ -370,24 +370,26 @@ nm_setting_adsl_class_init(NMSettingAdslClass *klass)
*
* Username used to authenticate with the ADSL service.
**/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_ADSL_USERNAME,
PROP_USERNAME,
NM_SETTING_PARAM_NONE,
nm_setting_adsl_get_username);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_ADSL_USERNAME,
PROP_USERNAME,
NM_SETTING_PARAM_NONE,
NMSettingAdslPrivate,
username);
/**
* NMSettingAdsl:password:
*
* Password used to authenticate with the ADSL service.
**/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_ADSL_PASSWORD,
PROP_PASSWORD,
NM_SETTING_PARAM_SECRET,
nm_setting_adsl_get_password);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_ADSL_PASSWORD,
PROP_PASSWORD,
NM_SETTING_PARAM_SECRET,
NMSettingAdslPrivate,
password);
/**
* NMSettingAdsl:password-flags:
@ -407,24 +409,34 @@ nm_setting_adsl_class_init(NMSettingAdslClass *klass)
*
* ADSL connection protocol. Can be "pppoa", "pppoe" or "ipoatm".
**/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_ADSL_PROTOCOL,
PROP_PROTOCOL,
NM_SETTING_PARAM_NONE,
nm_setting_adsl_get_protocol);
_nm_setting_property_define_direct_string(
properties_override,
obj_properties,
NM_SETTING_ADSL_PROTOCOL,
PROP_PROTOCOL,
NM_SETTING_PARAM_NONE,
NMSettingAdslPrivate,
protocol,
/* it's special, because set_property() calls g_ascii_strdown() on
* the string! */
.direct_has_special_setter = TRUE);
/**
* NMSettingAdsl:encapsulation:
*
* Encapsulation of ADSL connection. Can be "vcmux" or "llc".
**/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_ADSL_ENCAPSULATION,
PROP_ENCAPSULATION,
NM_SETTING_PARAM_NONE,
nm_setting_adsl_get_encapsulation);
_nm_setting_property_define_direct_string(
properties_override,
obj_properties,
NM_SETTING_ADSL_ENCAPSULATION,
PROP_ENCAPSULATION,
NM_SETTING_PARAM_NONE,
NMSettingAdslPrivate,
encapsulation,
/* it's special, because set_property() calls g_ascii_strdown() on
* the string! */
.direct_has_special_setter = TRUE);
/**
* NMSettingAdsl:vpi:

View file

@ -1872,12 +1872,13 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* description: User friendly name for the connection profile.
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_CONNECTION_ID,
PROP_ID,
NM_SETTING_PARAM_FUZZY_IGNORE,
nm_setting_connection_get_id);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_CONNECTION_ID,
PROP_ID,
NM_SETTING_PARAM_FUZZY_IGNORE,
NMSettingConnectionPrivate,
id);
/**
* NMSettingConnection:uuid:
@ -1902,12 +1903,13 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* creates the UUID itself (by hashing the filename).
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_CONNECTION_UUID,
PROP_UUID,
NM_SETTING_PARAM_FUZZY_IGNORE,
nm_setting_connection_get_uuid);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_CONNECTION_UUID,
PROP_UUID,
NM_SETTING_PARAM_FUZZY_IGNORE,
NMSettingConnectionPrivate,
uuid);
/**
* NMSettingConnection:stable-id:
@ -1987,17 +1989,19 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* can be required for some connection types.
* ---end---
*/
_nm_setting_property_define_string_full(
_nm_setting_property_define_direct_string_full(
properties_override,
obj_properties,
NM_SETTING_CONNECTION_INTERFACE_NAME,
PROP_INTERFACE_NAME,
NM_SETTING_PARAM_INFERRABLE,
NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_STRING,
.to_dbus_fcn = _nm_setting_property_to_dbus_fcn_get_string,
.direct_type = NM_VALUE_TYPE_STRING,
.to_dbus_fcn = _nm_setting_property_to_dbus_fcn_direct,
.missing_from_dbus_fcn =
nm_setting_connection_no_interface_name),
nm_setting_connection_get_interface_name);
NMSettingConnectionPrivate,
interface_name);
/**
* NMSettingConnection:type:
@ -2017,12 +2021,13 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* example: TYPE=Ethernet; TYPE=Bond; TYPE=Bridge; DEVICETYPE=TeamPort
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_CONNECTION_TYPE,
PROP_TYPE,
NM_SETTING_PARAM_INFERRABLE,
nm_setting_connection_get_connection_type);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_CONNECTION_TYPE,
PROP_TYPE,
NM_SETTING_PARAM_INFERRABLE,
NMSettingConnectionPrivate,
type);
/**
* NMSettingConnection:permissions:
@ -2229,13 +2234,14 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* example: ZONE=Work
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_CONNECTION_ZONE,
PROP_ZONE,
NM_SETTING_PARAM_FUZZY_IGNORE
| NM_SETTING_PARAM_REAPPLY_IMMEDIATELY,
nm_setting_connection_get_zone);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_CONNECTION_ZONE,
PROP_ZONE,
NM_SETTING_PARAM_FUZZY_IGNORE
| NM_SETTING_PARAM_REAPPLY_IMMEDIATELY,
NMSettingConnectionPrivate,
zone);
/**
* NMSettingConnection:master:
@ -2251,12 +2257,14 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* for compatibility with legacy tooling.
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_CONNECTION_MASTER,
PROP_MASTER,
NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_INFERRABLE,
nm_setting_connection_get_master);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_CONNECTION_MASTER,
PROP_MASTER,
NM_SETTING_PARAM_FUZZY_IGNORE
| NM_SETTING_PARAM_INFERRABLE,
NMSettingConnectionPrivate,
master);
/**
* NMSettingConnection:slave-type:
@ -2275,12 +2283,14 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* and BRIDGE_UUID for bridging.
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_CONNECTION_SLAVE_TYPE,
PROP_SLAVE_TYPE,
NM_SETTING_PARAM_FUZZY_IGNORE | NM_SETTING_PARAM_INFERRABLE,
nm_setting_connection_get_slave_type);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_CONNECTION_SLAVE_TYPE,
PROP_SLAVE_TYPE,
NM_SETTING_PARAM_FUZZY_IGNORE
| NM_SETTING_PARAM_INFERRABLE,
NMSettingConnectionPrivate,
slave_type);
/**
* NMSettingConnection:autoconnect-slaves:
@ -2562,12 +2572,13 @@ nm_setting_connection_class_init(NMSettingConnectionClass *klass)
* example: https://yourdevice.example.com/model.json
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_CONNECTION_MUD_URL,
PROP_MUD_URL,
NM_SETTING_PARAM_NONE,
nm_setting_connection_get_mud_url);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_CONNECTION_MUD_URL,
PROP_MUD_URL,
NM_SETTING_PARAM_NONE,
NMSettingConnectionPrivate,
mud_url);
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);

View file

@ -5776,32 +5776,32 @@ _nm_sett_info_property_override_create_array_ip_config(void)
_nm_properties_override_gobj(
properties_override,
obj_properties[PROP_METHOD],
&nm_sett_info_propert_type_string,
.to_dbus_data.get_string =
(const char *(*) (NMSetting *) ) nm_setting_ip_config_get_method);
&nm_sett_info_propert_type_direct_string,
.direct_offset = NM_STRUCT_OFFSET_ENSURE_TYPE(char *, NMSettingIPConfigPrivate, method));
_nm_properties_override_gobj(
properties_override,
obj_properties[PROP_GATEWAY],
NM_SETT_INFO_PROPERT_TYPE_DBUS(G_VARIANT_TYPE_STRING,
.to_dbus_fcn = _nm_setting_property_to_dbus_fcn_get_string,
.direct_type = NM_VALUE_TYPE_STRING,
.to_dbus_fcn = _nm_setting_property_to_dbus_fcn_direct,
.from_dbus_fcn = ip_gateway_set),
.to_dbus_data.get_string =
(const char *(*) (NMSetting *) ) nm_setting_ip_config_get_gateway);
.direct_offset = NM_STRUCT_OFFSET_ENSURE_TYPE(char *, NMSettingIPConfigPrivate, gateway),
/* The property setter for the gateway performs some normalization and is special! */
.direct_has_special_setter = TRUE);
_nm_properties_override_gobj(
properties_override,
obj_properties[PROP_DHCP_HOSTNAME],
&nm_sett_info_propert_type_string,
.to_dbus_data.get_string =
(const char *(*) (NMSetting *) ) nm_setting_ip_config_get_dhcp_hostname);
&nm_sett_info_propert_type_direct_string,
.direct_offset =
NM_STRUCT_OFFSET_ENSURE_TYPE(char *, NMSettingIPConfigPrivate, dhcp_hostname));
_nm_properties_override_gobj(
properties_override,
obj_properties[PROP_DHCP_IAID],
&nm_sett_info_propert_type_string,
.to_dbus_data.get_string =
(const char *(*) (NMSetting *) ) nm_setting_ip_config_get_dhcp_iaid);
&nm_sett_info_propert_type_direct_string,
.direct_offset = NM_STRUCT_OFFSET_ENSURE_TYPE(char *, NMSettingIPConfigPrivate, dhcp_iaid));
/* ---dbus---
* property: routing-rules

View file

@ -675,12 +675,13 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_PARENT,
PROP_PARENT,
NM_SETTING_PARAM_INFERRABLE,
nm_setting_ip_tunnel_get_parent);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_PARENT,
PROP_PARENT,
NM_SETTING_PARAM_INFERRABLE,
NMSettingIPTunnelPrivate,
parent);
/**
* NMSettingIPTunnel:mode:
@ -707,12 +708,13 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_LOCAL,
PROP_LOCAL,
NM_SETTING_PARAM_INFERRABLE,
nm_setting_ip_tunnel_get_local);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_LOCAL,
PROP_LOCAL,
NM_SETTING_PARAM_INFERRABLE,
NMSettingIPTunnelPrivate,
local);
/**
* NMSettingIPTunnel:remote:
@ -722,12 +724,13 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_REMOTE,
PROP_REMOTE,
NM_SETTING_PARAM_INFERRABLE,
nm_setting_ip_tunnel_get_remote);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_REMOTE,
PROP_REMOTE,
NM_SETTING_PARAM_INFERRABLE,
NMSettingIPTunnelPrivate,
remote);
/**
* NMSettingIPTunnel:ttl
@ -787,12 +790,13 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_INPUT_KEY,
PROP_INPUT_KEY,
NM_SETTING_PARAM_INFERRABLE,
nm_setting_ip_tunnel_get_input_key);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_INPUT_KEY,
PROP_INPUT_KEY,
NM_SETTING_PARAM_INFERRABLE,
NMSettingIPTunnelPrivate,
input_key);
/**
* NMSettingIPTunnel:output-key:
@ -802,12 +806,13 @@ nm_setting_ip_tunnel_class_init(NMSettingIPTunnelClass *klass)
*
* Since: 1.2
**/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_OUTPUT_KEY,
PROP_OUTPUT_KEY,
NM_SETTING_PARAM_INFERRABLE,
nm_setting_ip_tunnel_get_output_key);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_IP_TUNNEL_OUTPUT_KEY,
PROP_OUTPUT_KEY,
NM_SETTING_PARAM_INFERRABLE,
NMSettingIPTunnelPrivate,
output_key);
/**
* NMSettingIPTunnel:encapsulation-limit:

View file

@ -856,12 +856,13 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass)
* example: DHCP_CLIENT_ID=ax-srv-1; DHCP_CLIENT_ID=01:44:44:44:44:44:44
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID,
PROP_DHCP_CLIENT_ID,
NM_SETTING_PARAM_NONE,
nm_setting_ip4_config_get_dhcp_client_id);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID,
PROP_DHCP_CLIENT_ID,
NM_SETTING_PARAM_NONE,
NMSettingIP4ConfigPrivate,
dhcp_client_id);
/* ---ifcfg-rh---
* property: dad-timeout
@ -907,12 +908,13 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass)
* example: DHCP_FQDN=foo.bar.com
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_IP4_CONFIG_DHCP_FQDN,
PROP_DHCP_FQDN,
NM_SETTING_PARAM_NONE,
nm_setting_ip4_config_get_dhcp_fqdn);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_IP4_CONFIG_DHCP_FQDN,
PROP_DHCP_FQDN,
NM_SETTING_PARAM_NONE,
NMSettingIP4ConfigPrivate,
dhcp_fqdn);
/**
* NMSettingIP4Config:dhcp-vendor-class-identifier:
@ -933,12 +935,13 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass)
* example: DHCP_VENDOR_CLASS_IDENTIFIER=foo
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_IP4_CONFIG_DHCP_VENDOR_CLASS_IDENTIFIER,
PROP_DHCP_VENDOR_CLASS_IDENTIFIER,
NM_SETTING_PARAM_NONE,
nm_setting_ip4_config_get_dhcp_vendor_class_identifier);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_IP4_CONFIG_DHCP_VENDOR_CLASS_IDENTIFIER,
PROP_DHCP_VENDOR_CLASS_IDENTIFIER,
NM_SETTING_PARAM_NONE,
NMSettingIP4ConfigPrivate,
dhcp_vendor_class_identifier);
/* IP4-specific property overrides */

View file

@ -921,12 +921,13 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
* example: IPV6_TOKEN=::53
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_IP6_CONFIG_TOKEN,
PROP_TOKEN,
NM_SETTING_PARAM_INFERRABLE,
nm_setting_ip6_config_get_token);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_IP6_CONFIG_TOKEN,
PROP_TOKEN,
NM_SETTING_PARAM_INFERRABLE,
NMSettingIP6ConfigPrivate,
token);
/**
* NMSettingIP6Config:ra-timeout:
@ -1001,12 +1002,13 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
* example: DHCPV6_DUID=LL; DHCPV6_DUID=0301deadbeef0001; DHCPV6_DUID=03:01:de:ad:be:ef:00:01
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_IP6_CONFIG_DHCP_DUID,
PROP_DHCP_DUID,
NM_SETTING_PARAM_NONE,
nm_setting_ip6_config_get_dhcp_duid);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_IP6_CONFIG_DHCP_DUID,
PROP_DHCP_DUID,
NM_SETTING_PARAM_NONE,
NMSettingIP6ConfigPrivate,
dhcp_duid);
/* IP6-specific property overrides */

View file

@ -289,8 +289,6 @@ extern const NMSettInfoPropertType nm_sett_info_propert_type_plain_u;
extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_boolean;
extern const NMSettInfoPropertType nm_sett_info_propert_type_direct_string;
extern const NMSettInfoPropertType nm_sett_info_propert_type_string;
NMSettingVerifyResult
_nm_setting_verify(NMSetting *setting, NMConnection *connection, GError **error);
@ -317,14 +315,6 @@ GVariant *_nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting *
NMConnectionSerializationFlags flags,
const NMConnectionSerializationOptions *options);
GVariant *
_nm_setting_property_to_dbus_fcn_get_string(const NMSettInfoSetting * sett_info,
guint property_idx,
NMConnection * connection,
NMSetting * setting,
NMConnectionSerializationFlags flags,
const NMConnectionSerializationOptions *options);
GVariant *_nm_setting_to_dbus(NMSetting * setting,
NMConnection * connection,
NMConnectionSerializationFlags flags,
@ -542,62 +532,6 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
/*****************************************************************************/
#define _nm_setting_property_define_string_full(properties_override, \
obj_properties, \
prop_name, \
prop_id, \
param_flags, \
property_type, \
get_fcn, \
...) \
G_STMT_START \
{ \
GParamSpec * _param_spec; \
const NMSettInfoPropertType *const _property_type = (property_type); \
\
G_STATIC_ASSERT(!NM_FLAGS_ANY((param_flags), \
~(NM_SETTING_PARAM_SECRET | NM_SETTING_PARAM_FUZZY_IGNORE \
| NM_SETTING_PARAM_INFERRABLE \
| NM_SETTING_PARAM_REAPPLY_IMMEDIATELY))); \
nm_assert(_property_type); \
nm_assert(_property_type->to_dbus_fcn == _nm_setting_property_to_dbus_fcn_get_string); \
\
_param_spec = \
g_param_spec_string("" prop_name "", \
"", \
"", \
NULL, \
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | (param_flags)); \
\
(obj_properties)[(prop_id)] = _param_spec; \
\
_nm_properties_override_gobj((properties_override), \
_param_spec, \
_property_type, \
.to_dbus_data.get_string = \
(const char *(*) (NMSetting *) ) (get_fcn), \
__VA_ARGS__); \
} \
G_STMT_END
#define _nm_setting_property_define_string(properties_override, \
obj_properties, \
prop_name, \
prop_id, \
param_flags, \
get_fcn, \
...) \
_nm_setting_property_define_string_full((properties_override), \
(obj_properties), \
prop_name, \
(prop_id), \
(param_flags), \
&nm_sett_info_propert_type_string, \
(get_fcn), \
__VA_ARGS__)
/*****************************************************************************/
gboolean _nm_setting_use_legacy_property(NMSetting * setting,
GVariant * connection_dict,
const char *legacy_property,

View file

@ -1291,12 +1291,13 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
* description: The property is not saved by the plugin.
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_WIRED_PORT,
PROP_PORT,
NM_SETTING_PARAM_NONE,
nm_setting_wired_get_port);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_WIRED_PORT,
PROP_PORT,
NM_SETTING_PARAM_NONE,
NMSettingWiredPrivate,
port);
/**
* NMSettingWired:speed:
@ -1353,12 +1354,13 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
* "duplex" parameter in the ETHOOL_OPTS variable.
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_WIRED_DUPLEX,
PROP_DUPLEX,
NM_SETTING_PARAM_NONE,
nm_setting_wired_get_duplex);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_WIRED_DUPLEX,
PROP_DUPLEX,
NM_SETTING_PARAM_NONE,
NMSettingWiredPrivate,
duplex);
/**
* NMSettingWired:auto-negotiate:
@ -1532,12 +1534,13 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
* cloned-mac-address.
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK,
PROP_GENERATE_MAC_ADDRESS_MASK,
NM_SETTING_PARAM_FUZZY_IGNORE,
nm_setting_wired_get_generate_mac_address_mask);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK,
PROP_GENERATE_MAC_ADDRESS_MASK,
NM_SETTING_PARAM_FUZZY_IGNORE,
NMSettingWiredPrivate,
generate_mac_address_mask);
/**
* NMSettingWired:mac-address-blacklist:
@ -1628,12 +1631,13 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
* example: NETTYPE=qeth
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_WIRED_S390_NETTYPE,
PROP_S390_NETTYPE,
NM_SETTING_PARAM_INFERRABLE,
nm_setting_wired_get_s390_nettype);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_WIRED_S390_NETTYPE,
PROP_S390_NETTYPE,
NM_SETTING_PARAM_INFERRABLE,
NMSettingWiredPrivate,
s390_nettype);
/**
* NMSettingWired:s390-options: (type GHashTable(utf8,utf8)):
@ -1713,12 +1717,13 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass)
* example: ETHTOOL_OPTS="wol gs sopass 00:11:22:33:44:55"
* ---end---
*/
_nm_setting_property_define_string(properties_override,
obj_properties,
NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD,
PROP_WAKE_ON_LAN_PASSWORD,
NM_SETTING_PARAM_NONE,
nm_setting_wired_get_wake_on_lan_password);
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD,
PROP_WAKE_ON_LAN_PASSWORD,
NM_SETTING_PARAM_NONE,
NMSettingWiredPrivate,
wol_password);
/**
* NMSettingWired:accept-all-mac-addresses:

View file

@ -591,33 +591,6 @@ _nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting *
}
}
GVariant *
_nm_setting_property_to_dbus_fcn_get_string(const NMSettInfoSetting * sett_info,
guint property_idx,
NMConnection * connection,
NMSetting * setting,
NMConnectionSerializationFlags flags,
const NMConnectionSerializationOptions *options)
{
const NMSettInfoProperty *property_info = &sett_info->property_infos[property_idx];
const char * val;
/* For string properties that are implemented via this function, the default is always NULL.
* In general, having strings default to NULL is most advisable.
*
* Setting "including_default" for a string makes no sense because a
* GVariant of type "s" cannot express NULL. */
nm_assert(!NM_G_PARAM_SPEC_GET_DEFAULT_STRING(property_info->param_spec));
nm_assert(!property_info->to_dbus_data.including_default);
val = property_info->to_dbus_data.get_string(setting);
if (!val)
return NULL;
if (!val[0])
return g_variant_ref(nm_g_variant_singleton_s_empty());
return g_variant_new_string(val);
}
GVariant *
_nm_setting_property_to_dbus_fcn_gprop(const NMSettInfoSetting * sett_info,
guint property_idx,
@ -2454,10 +2427,6 @@ const NMSettInfoPropertType nm_sett_info_propert_type_direct_string =
.direct_type = NM_VALUE_TYPE_STRING,
.to_dbus_fcn = _nm_setting_property_to_dbus_fcn_direct);
const NMSettInfoPropertType nm_sett_info_propert_type_string =
NM_SETT_INFO_PROPERT_TYPE_DBUS_INIT(G_VARIANT_TYPE_STRING,
.to_dbus_fcn = _nm_setting_property_to_dbus_fcn_get_string);
/*****************************************************************************/
static GenData *

View file

@ -4487,11 +4487,6 @@ check_done:;
!= NM_SETTING_PROPERTY_TO_DBUS_FCN_GPROP_TYPE_DEFAULT)
g_assert(!sip->to_dbus_data.gprop_to_dbus_fcn);
can_set_including_default = TRUE;
} else if (sip->property_type->to_dbus_fcn
== _nm_setting_property_to_dbus_fcn_get_string) {
g_assert(sip->param_spec);
g_assert(sip->param_spec->value_type == G_TYPE_STRING);
g_assert(sip->to_dbus_data.get_string);
}
if (!can_set_including_default)

View file

@ -721,11 +721,20 @@ struct _NMSettInfoProperty {
* the direct location. */
guint16 direct_offset;
/* Currently, properties that set property_type->direct_type only have to_dbus_fcn()
* implemented "the direct way". For the property setter, they still call g_object_set().
* In the future, also other operations, like from_dbus_fcn() should be implemented
* by direct access (thereby, bypassing g_object_set()).
*
* A "direct_has_special_setter" property does something unusual, that will require special attention
* in the future, when we implement more functionality regarding the setter. It has no effect,
* except of marking those properties and serve as a reminder that special care needs to be taken. */
bool direct_has_special_setter : 1;
struct {
union {
gpointer none;
NMSettInfoPropGPropToDBusFcn gprop_to_dbus_fcn;
const char *(*get_string)(NMSetting *);
};
/* Usually, properties that are set to the default value for the GParamSpec