clients: change nm_meta_abstract_info_get() to report defaults
Return a boolean to indicate whether the value is the default one, so that the caller can choose to hide it.
This commit is contained in:
@@ -107,6 +107,7 @@ _metagen_ip4_config_get_fcn (const NMMetaEnvironment *environment,
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free)
|
||||
{
|
||||
NMIPConfig *cfg4 = target;
|
||||
@@ -183,6 +184,7 @@ _metagen_ip6_config_get_fcn (const NMMetaEnvironment *environment,
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free)
|
||||
{
|
||||
NMIPConfig *cfg6 = target;
|
||||
|
@@ -175,6 +175,7 @@ _metagen_general_status_get_fcn (const NMMetaEnvironment *environment,
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free)
|
||||
{
|
||||
NmCli *nmc = target;
|
||||
@@ -282,6 +283,7 @@ _metagen_general_permissions_get_fcn (const NMMetaEnvironment *environment,
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free)
|
||||
{
|
||||
NMClientPermission perm = GPOINTER_TO_UINT (target);
|
||||
@@ -330,6 +332,7 @@ _metagen_general_logging_get_fcn (const NMMetaEnvironment *environment,
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free)
|
||||
{
|
||||
NmCli *nmc = environment_user_data;
|
||||
|
@@ -474,6 +474,7 @@ get_property_val (NMSetting *setting, const char *prop, NMMetaAccessorGetType ge
|
||||
get_type,
|
||||
show_secrets ? NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS : 0,
|
||||
&out_flags,
|
||||
NULL,
|
||||
(gpointer *) &to_free);
|
||||
nm_assert (!out_flags);
|
||||
return to_free ?: g_strdup (value);
|
||||
|
@@ -75,6 +75,7 @@ _meta_type_nmc_generic_info_get_fcn (const NMMetaAbstractInfo *abstract_info,
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free)
|
||||
{
|
||||
const NmcMetaGenericInfo *info = (const NmcMetaGenericInfo *) abstract_info;
|
||||
@@ -97,6 +98,7 @@ _meta_type_nmc_generic_info_get_fcn (const NMMetaAbstractInfo *abstract_info,
|
||||
get_type,
|
||||
get_flags,
|
||||
out_flags,
|
||||
out_is_default,
|
||||
out_to_free);
|
||||
}
|
||||
|
||||
@@ -1152,6 +1154,7 @@ _print_fill (const NmcConfig *nmc_config,
|
||||
text_get_type,
|
||||
text_get_flags,
|
||||
&text_out_flags,
|
||||
NULL,
|
||||
(gpointer *) &to_free);
|
||||
if (NM_FLAGS_HAS (text_out_flags, NM_META_ACCESSOR_GET_OUT_FLAGS_STRV)) {
|
||||
if (value) {
|
||||
@@ -1178,6 +1181,7 @@ _print_fill (const NmcConfig *nmc_config,
|
||||
NM_META_ACCESSOR_GET_TYPE_TERMFORMAT,
|
||||
NM_META_ACCESSOR_GET_FLAGS_NONE,
|
||||
&color_out_flags,
|
||||
NULL,
|
||||
NULL),
|
||||
&cell->term_color,
|
||||
&cell->term_format);
|
||||
|
@@ -150,6 +150,7 @@ struct _NmcMetaGenericInfo {
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free);
|
||||
};
|
||||
|
||||
|
@@ -232,6 +232,7 @@ nm_meta_abstract_info_get (const NMMetaAbstractInfo *abstract_info,
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free)
|
||||
{
|
||||
nm_assert (abstract_info);
|
||||
@@ -240,6 +241,7 @@ nm_meta_abstract_info_get (const NMMetaAbstractInfo *abstract_info,
|
||||
nm_assert (out_flags);
|
||||
|
||||
*out_flags = NM_META_ACCESSOR_GET_OUT_FLAGS_NONE;
|
||||
NM_SET_OUT (out_is_default, FALSE);
|
||||
|
||||
if (!abstract_info->meta_type->get_fcn)
|
||||
g_return_val_if_reached (NULL);
|
||||
@@ -251,6 +253,7 @@ nm_meta_abstract_info_get (const NMMetaAbstractInfo *abstract_info,
|
||||
get_type,
|
||||
get_flags,
|
||||
out_flags,
|
||||
out_is_default,
|
||||
out_to_free);
|
||||
}
|
||||
|
||||
|
@@ -58,6 +58,7 @@ gconstpointer nm_meta_abstract_info_get (const NMMetaAbstractInfo *abstract_info
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free);
|
||||
|
||||
const char *const*nm_meta_abstract_info_complete (const NMMetaAbstractInfo *abstract_info,
|
||||
|
@@ -640,7 +640,7 @@ _env_warn_fcn (const NMMetaEnvironment *environment,
|
||||
const NMMetaPropertyInfo *property_info, char **out_to_free
|
||||
|
||||
#define ARGS_GET_FCN \
|
||||
const NMMetaPropertyInfo *property_info, const NMMetaEnvironment *environment, gpointer environment_user_data, NMSetting *setting, NMMetaAccessorGetType get_type, NMMetaAccessorGetFlags get_flags, NMMetaAccessorGetOutFlags *out_flags, gpointer *out_to_free
|
||||
const NMMetaPropertyInfo *property_info, const NMMetaEnvironment *environment, gpointer environment_user_data, NMSetting *setting, NMMetaAccessorGetType get_type, NMMetaAccessorGetFlags get_flags, NMMetaAccessorGetOutFlags *out_flags, gboolean *out_is_default, gpointer *out_to_free
|
||||
|
||||
#define ARGS_SET_FCN \
|
||||
const NMMetaPropertyInfo *property_info, const NMMetaEnvironment *environment, gpointer environment_user_data, NMSetting *setting, const char *value, GError **error
|
||||
@@ -7822,6 +7822,7 @@ _meta_type_setting_info_editor_get_fcn (const NMMetaAbstractInfo *abstract_info,
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free)
|
||||
{
|
||||
const NMMetaSettingInfoEditor *info = (const NMMetaSettingInfoEditor *) abstract_info;
|
||||
@@ -7847,6 +7848,7 @@ _meta_type_property_info_get_fcn (const NMMetaAbstractInfo *abstract_info,
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free)
|
||||
{
|
||||
const NMMetaPropertyInfo *info = (const NMMetaPropertyInfo *) abstract_info;
|
||||
@@ -7872,6 +7874,7 @@ _meta_type_property_info_get_fcn (const NMMetaAbstractInfo *abstract_info,
|
||||
get_type,
|
||||
get_flags,
|
||||
out_flags,
|
||||
out_is_default,
|
||||
out_to_free);
|
||||
|
||||
}
|
||||
|
@@ -199,6 +199,7 @@ struct _NMMetaPropertyType {
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_default,
|
||||
gpointer *out_to_free);
|
||||
gboolean (*set_fcn) (const NMMetaPropertyInfo *property_info,
|
||||
const NMMetaEnvironment *environment,
|
||||
@@ -363,6 +364,7 @@ struct _NMMetaType {
|
||||
NMMetaAccessorGetType get_type,
|
||||
NMMetaAccessorGetFlags get_flags,
|
||||
NMMetaAccessorGetOutFlags *out_flags,
|
||||
gboolean *out_is_defalt,
|
||||
gpointer *out_to_free);
|
||||
const char *const*(*complete_fcn) (const NMMetaAbstractInfo *info,
|
||||
const NMMetaEnvironment *environment,
|
||||
|
Reference in New Issue
Block a user