mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-06 04:28:29 +02:00
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:
parent
332592ef4f
commit
a67a3439b0
1 changed files with 21 additions and 18 deletions
|
|
@ -794,26 +794,29 @@ _nm_setting_to_dbus (NMSetting *setting, NMConnection *connection, NMConnectionS
|
||||||
const NMSettingProperty *property = &properties[i];
|
const NMSettingProperty *property = &properties[i];
|
||||||
GParamSpec *prop_spec = property->param_spec;
|
GParamSpec *prop_spec = property->param_spec;
|
||||||
|
|
||||||
if (!prop_spec && !property->synth_func) {
|
if (!prop_spec) {
|
||||||
/* D-Bus-only property with no synth_func, so we skip it. */
|
if (!property->synth_func)
|
||||||
continue;
|
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)
|
if (property->synth_func)
|
||||||
dbus_value = property->synth_func (setting, connection, property->name);
|
dbus_value = property->synth_func (setting, connection, property->name);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue