libnm: minor rework checking property flags in _nm_setting_to_dbus()

Properties that are backed by a GObject property are fundamentally
different.

I think it's clearer to rework the check, to first check whether
we have a param_spec, and then implement different checks.
This commit is contained in:
Thomas Haller 2018-07-29 14:32:36 +02:00
parent 332592ef4f
commit a67a3439b0

View file

@ -794,26 +794,29 @@ _nm_setting_to_dbus (NMSetting *setting, NMConnection *connection, NMConnectionS
const NMSettingProperty *property = &properties[i];
GParamSpec *prop_spec = property->param_spec;
if (!prop_spec && !property->synth_func) {
/* D-Bus-only property with no synth_func, so we skip it. */
continue;
if (!prop_spec) {
if (!property->synth_func)
continue;
if (flags & NM_CONNECTION_SERIALIZE_ONLY_SECRETS)
continue;
} else {
if (!(prop_spec->flags & G_PARAM_WRITABLE))
continue;
if ( (prop_spec->flags & NM_SETTING_PARAM_LEGACY)
&& !_nm_utils_is_manager_process)
continue;
if ( (flags & NM_CONNECTION_SERIALIZE_NO_SECRETS)
&& (prop_spec->flags & NM_SETTING_PARAM_SECRET))
continue;
if ( (flags & NM_CONNECTION_SERIALIZE_ONLY_SECRETS)
&& !(prop_spec->flags & NM_SETTING_PARAM_SECRET))
continue;
}
if (prop_spec && !(prop_spec->flags & G_PARAM_WRITABLE))
continue;
if ( prop_spec && (prop_spec->flags & NM_SETTING_PARAM_LEGACY)
&& !_nm_utils_is_manager_process)
continue;
if ( (flags & NM_CONNECTION_SERIALIZE_NO_SECRETS)
&& (prop_spec && (prop_spec->flags & NM_SETTING_PARAM_SECRET)))
continue;
if ( (flags & NM_CONNECTION_SERIALIZE_ONLY_SECRETS)
&& !(prop_spec && (prop_spec->flags & NM_SETTING_PARAM_SECRET)))
continue;
if (property->synth_func)
dbus_value = property->synth_func (setting, connection, property->name);
else