diff --git a/src/libnm-core-impl/nm-setting-wired.c b/src/libnm-core-impl/nm-setting-wired.c index 312e9e41b6..4c35545ce2 100644 --- a/src/libnm-core-impl/nm-setting-wired.c +++ b/src/libnm-core-impl/nm-setting-wired.c @@ -1383,7 +1383,7 @@ nm_setting_wired_class_init(NMSettingWiredClass *klass) NM_SETTING_PARAM_NONE, NMSettingWiredPrivate, auto_negotiate, - .to_dbus_data.including_default = TRUE); + .to_dbus_including_default = TRUE); /** * NMSettingWired:mac-address: diff --git a/src/libnm-core-impl/nm-setting.c b/src/libnm-core-impl/nm-setting.c index 6c37134eec..f14e29563a 100644 --- a/src/libnm-core-impl/nm-setting.c +++ b/src/libnm-core-impl/nm-setting.c @@ -886,7 +886,7 @@ _nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting * gboolean val; val = *((bool *) _nm_setting_get_private(setting, sett_info, property_info->direct_offset)); - if (!property_info->to_dbus_data.including_default + if (!property_info->to_dbus_including_default && val == NM_G_PARAM_SPEC_GET_DEFAULT_BOOLEAN(property_info->param_spec)) return NULL; return g_variant_ref(nm_g_variant_singleton_b(val)); @@ -897,7 +897,7 @@ _nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting * val = *( (guint32 *) _nm_setting_get_private(setting, sett_info, property_info->direct_offset)); - if (!property_info->to_dbus_data.including_default + if (!property_info->to_dbus_including_default && val == NM_G_PARAM_SPEC_GET_DEFAULT_UINT(property_info->param_spec)) return NULL; return g_variant_new_uint32(val); @@ -912,7 +912,7 @@ _nm_setting_property_to_dbus_fcn_direct(const NMSettInfoSetting * * 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); + nm_assert(!property_info->to_dbus_including_default); val = *((const char *const *) _nm_setting_get_private(setting, sett_info, @@ -948,7 +948,7 @@ _nm_setting_property_to_dbus_fcn_gprop(const NMSettInfoSetting * s g_object_get_property(G_OBJECT(setting), property_info->param_spec->name, &prop_value); - if (!property_info->to_dbus_data.including_default + if (!property_info->to_dbus_including_default && g_param_value_defaults(property_info->param_spec, &prop_value)) return NULL; diff --git a/src/libnm-core-impl/tests/test-setting.c b/src/libnm-core-impl/tests/test-setting.c index 9446db8608..3823922f94 100644 --- a/src/libnm-core-impl/tests/test-setting.c +++ b/src/libnm-core-impl/tests/test-setting.c @@ -4512,7 +4512,7 @@ check_done:; } if (!can_set_including_default) - g_assert(!sip->to_dbus_data.including_default); + g_assert(!sip->to_dbus_including_default); g_assert(!sip->property_type->from_dbus_fcn || !sip->property_type->gprop_from_dbus_fcn); diff --git a/src/libnm-core-intern/nm-core-internal.h b/src/libnm-core-intern/nm-core-internal.h index 6035b9f55b..59fb7853e7 100644 --- a/src/libnm-core-intern/nm-core-internal.h +++ b/src/libnm-core-intern/nm-core-internal.h @@ -744,13 +744,11 @@ struct _NMSettInfoProperty { * except of marking those properties and serve as a reminder that special care needs to be taken. */ bool direct_has_special_setter : 1; - struct { - /* Usually, properties that are set to the default value for the GParamSpec - * are not serialized to GVariant (and NULL is returned by to_dbus_data(). - * Set this flag to force always converting the property even if the value - * is the default. */ - bool including_default : 1; - } to_dbus_data; + /* Usually, properties that are set to the default value for the GParamSpec + * are not serialized to GVariant (and NULL is returned by to_dbus_data(). + * Set this flag to force always converting the property even if the value + * is the default. */ + bool to_dbus_including_default : 1; }; typedef struct {