From 37cb6885f7c107d3c1936efafdc8c07719de123c Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 11 Dec 2023 12:09:13 +0100 Subject: [PATCH] libnm: use G_PARAM_EXPLICIT_NOTIFY for direct strv properties For doing this, it's important to review that no set_property() implementation exists, which now would miss to emit the notification. --- src/libnm-core-impl/nm-setting-ip-config.c | 7 ++++--- src/libnm-core-impl/nm-setting-private.h | 12 ++++++------ src/libnm-core-impl/tests/test-setting.c | 3 ++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/libnm-core-impl/nm-setting-ip-config.c b/src/libnm-core-impl/nm-setting-ip-config.c index 145e9b3eda..0c50a42761 100644 --- a/src/libnm-core-impl/nm-setting-ip-config.c +++ b/src/libnm-core-impl/nm-setting-ip-config.c @@ -6201,6 +6201,7 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps nm_strvarray_add(priv->dns_options.arr, str); } } + _notify(NM_SETTING_IP_CONFIG(object), PROP_DNS_OPTIONS); break; case PROP_ADDRESSES: g_ptr_array_unref(priv->addresses); @@ -6337,7 +6338,7 @@ nm_setting_ip_config_class_init(NMSettingIPConfigClass *klass) "", "", G_TYPE_STRV, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS); /** * NMSettingIPConfig:dns-options: @@ -6376,7 +6377,7 @@ nm_setting_ip_config_class_init(NMSettingIPConfigClass *klass) "", "", G_TYPE_STRV, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS); /** * NMSettingIPConfig:dns-priority: @@ -6804,7 +6805,7 @@ nm_setting_ip_config_class_init(NMSettingIPConfigClass *klass) "", "", G_TYPE_STRV, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS); /** * NMSettingIPConfig:auto-route-ext-gw: diff --git a/src/libnm-core-impl/nm-setting-private.h b/src/libnm-core-impl/nm-setting-private.h index b10ee30d62..d621d1e67e 100644 --- a/src/libnm-core-impl/nm-setting-private.h +++ b/src/libnm-core-impl/nm-setting-private.h @@ -857,12 +857,12 @@ _nm_properties_override(GArray *properties_override, const NMSettInfoProperty *p \ G_STATIC_ASSERT(!NM_FLAGS_ANY((param_flags), ~(NM_SETTING_PARAM_FUZZY_IGNORE))); \ \ - _param_spec = \ - g_param_spec_boxed("" prop_name "", \ - "", \ - "", \ - G_TYPE_STRV, \ - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | (param_flags)); \ + _param_spec = g_param_spec_boxed("" prop_name "", \ + "", \ + "", \ + G_TYPE_STRV, \ + G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY \ + | G_PARAM_STATIC_STRINGS | (param_flags)); \ \ (obj_properties)[(prop_id)] = _param_spec; \ \ diff --git a/src/libnm-core-impl/tests/test-setting.c b/src/libnm-core-impl/tests/test-setting.c index 82ff076812..84a42665b9 100644 --- a/src/libnm-core-impl/tests/test-setting.c +++ b/src/libnm-core-impl/tests/test-setting.c @@ -4920,7 +4920,8 @@ check_done:; NM_VALUE_TYPE_INT64, NM_VALUE_TYPE_UINT64, NM_VALUE_TYPE_STRING, - NM_VALUE_TYPE_BYTES); + NM_VALUE_TYPE_BYTES, + NM_VALUE_TYPE_STRV); if (NM_FLAGS_HAS(sip->param_spec->flags, G_PARAM_EXPLICIT_NOTIFY)) { g_assert(expected);