libnm: use G_PARAM_EXPLICIT_NOTIFY for direct string properties

For doing this, it's important to review that no set_property()
implementation exists, which now would miss to emit the notification.
This commit is contained in:
Thomas Haller 2023-12-11 12:09:13 +01:00
parent 96c1c49998
commit ecff549ba9
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
3 changed files with 32 additions and 29 deletions

View file

@ -6288,12 +6288,13 @@ nm_setting_ip_config_class_init(NMSettingIPConfigClass *klass)
* shared method must be configured on the interface which shares the internet
* to a subnet, not on the uplink which is shared.
**/
obj_properties[PROP_METHOD] = g_param_spec_string(
NM_SETTING_IP_CONFIG_METHOD,
"",
"",
NULL,
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_METHOD] =
g_param_spec_string(NM_SETTING_IP_CONFIG_METHOD,
"",
"",
NULL,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY
| NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
/**
* NMSettingIPConfig:dns:
@ -6468,14 +6469,15 @@ nm_setting_ip_config_class_init(NMSettingIPConfigClass *klass)
* for WireGuard interfaces, so usually it should not be set in that case. See
* #NMSettingWireGuard:ip4-auto-default-route.
**/
obj_properties[PROP_GATEWAY] = g_param_spec_string(
NM_SETTING_IP_CONFIG_GATEWAY,
"",
"",
NULL,
/* On D-Bus, the legacy property "addresses" contains the gateway.
* This was replaced by "address-data" and "gateway". */
G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_GATEWAY] =
g_param_spec_string(NM_SETTING_IP_CONFIG_GATEWAY,
"",
"",
NULL,
/* On D-Bus, the legacy property "addresses" contains the gateway.
* This was replaced by "address-data" and "gateway". */
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY
| NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
/**
* NMSettingIPConfig:routes: (type GPtrArray(NMIPRoute))
@ -6587,7 +6589,7 @@ nm_setting_ip_config_class_init(NMSettingIPConfigClass *klass)
"",
"",
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
/**
* NMSettingIPConfig:dhcp-send-hostname:
@ -6748,7 +6750,7 @@ nm_setting_ip_config_class_init(NMSettingIPConfigClass *klass)
"",
"",
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
/**
* NMSettingIPConfig:dhcp-hostname-flags:

View file

@ -768,12 +768,12 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
nm_assert(_property_type->direct_type == NM_VALUE_TYPE_STRING); \
nm_assert(_property_type->to_dbus_fcn == _nm_setting_property_to_dbus_fcn_direct); \
\
_param_spec = \
g_param_spec_string("" prop_name "", \
"", \
"", \
NULL, \
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | (param_flags)); \
_param_spec = g_param_spec_string("" prop_name "", \
"", \
"", \
NULL, \
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY \
| G_PARAM_STATIC_STRINGS | (param_flags)); \
\
(obj_properties)[(prop_id)] = _param_spec; \
\
@ -1018,12 +1018,12 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p
| NM_SETTING_PARAM_INFERRABLE \
| NM_SETTING_PARAM_REAPPLY_IMMEDIATELY))); \
\
_param_spec = \
g_param_spec_string("" prop_name "", \
"", \
"", \
NULL, \
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | (param_flags)); \
_param_spec = g_param_spec_string("" prop_name "", \
"", \
"", \
NULL, \
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY \
| G_PARAM_STATIC_STRINGS | (param_flags)); \
\
(obj_properties)[(prop_id)] = _param_spec; \
\

View file

@ -4918,7 +4918,8 @@ check_done:;
NM_VALUE_TYPE_UINT32,
NM_VALUE_TYPE_INT32,
NM_VALUE_TYPE_INT64,
NM_VALUE_TYPE_UINT64);
NM_VALUE_TYPE_UINT64,
NM_VALUE_TYPE_STRING);
if (NM_FLAGS_HAS(sip->param_spec->flags, G_PARAM_EXPLICIT_NOTIFY)) {
g_assert(expected);