clients: allow properties to be hidden if they have the default value

(cherry picked from commit b94fcb2a94)
This commit is contained in:
Antonio Cardace 2020-04-15 10:10:58 +02:00 committed by Thomas Haller
parent 7b0130d5d7
commit fd37111986
2 changed files with 22 additions and 9 deletions

View file

@ -8156,6 +8156,8 @@ _meta_type_property_info_get_fcn (const NMMetaAbstractInfo *abstract_info,
gpointer *out_to_free)
{
const NMMetaPropertyInfo *info = (const NMMetaPropertyInfo *) abstract_info;
gboolean is_default_local = FALSE;
gconstpointer r;
nm_assert (!out_to_free || !*out_to_free);
nm_assert (out_flags && !*out_flags);
@ -8173,15 +8175,25 @@ _meta_type_property_info_get_fcn (const NMMetaAbstractInfo *abstract_info,
return _get_text_hidden (get_type);
}
return info->property_type->get_fcn (info,
environment,
environment_user_data,
target,
get_type,
get_flags,
out_flags,
out_is_default,
out_to_free);
if ( info->hide_if_default
&& !out_is_default)
out_is_default = &is_default_local;
r = info->property_type->get_fcn (info,
environment,
environment_user_data,
target,
get_type,
get_flags,
out_flags,
out_is_default,
out_to_free);
if ( info->hide_if_default
&& *out_is_default)
*out_flags |= NM_META_ACCESSOR_GET_OUT_FLAGS_HIDE;
return r;
}

View file

@ -376,6 +376,7 @@ struct _NMMetaPropertyInfo {
bool is_secret:1;
bool is_cli_option:1;
bool hide_if_default:1;
const char *prompt;