diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2018-02-27 15:34:49 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2018-04-13 17:02:55 +0200 |
commit | 1f2319dcb9f333853df9148d41f20fea2e8fb57a (patch) | |
tree | e44b0d8614d7c9654e6773291921e2fc3a0a1432 | |
parent | defe869ee3a7e033da303ba415de3657fd27edb6 (diff) | |
download | NetworkManager-1f2319dcb9f333853df9148d41f20fea2e8fb57a.tar.gz |
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.
-rw-r--r-- | clients/cli/common.c | 2 | ||||
-rw-r--r-- | clients/cli/general.c | 3 | ||||
-rw-r--r-- | clients/cli/settings.c | 1 | ||||
-rw-r--r-- | clients/cli/utils.c | 4 | ||||
-rw-r--r-- | clients/cli/utils.h | 1 | ||||
-rw-r--r-- | clients/common/nm-meta-setting-access.c | 3 | ||||
-rw-r--r-- | clients/common/nm-meta-setting-access.h | 1 | ||||
-rw-r--r-- | clients/common/nm-meta-setting-desc.c | 5 | ||||
-rw-r--r-- | clients/common/nm-meta-setting-desc.h | 2 |
9 files changed, 21 insertions, 1 deletions
diff --git a/clients/cli/common.c b/clients/cli/common.c index 38729a6d08..b3dad0a68d 100644 --- a/clients/cli/common.c +++ b/clients/cli/common.c @@ -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; diff --git a/clients/cli/general.c b/clients/cli/general.c index 7ac6b22cc6..647ee5fc0d 100644 --- a/clients/cli/general.c +++ b/clients/cli/general.c @@ -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; diff --git a/clients/cli/settings.c b/clients/cli/settings.c index 86035ba4a0..5c3deeadd3 100644 --- a/clients/cli/settings.c +++ b/clients/cli/settings.c @@ -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); diff --git a/clients/cli/utils.c b/clients/cli/utils.c index 86a410d3b6..4b283a75be 100644 --- a/clients/cli/utils.c +++ b/clients/cli/utils.c @@ -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); diff --git a/clients/cli/utils.h b/clients/cli/utils.h index 48e96e0126..c92c4e2e83 100644 --- a/clients/cli/utils.h +++ b/clients/cli/utils.h @@ -150,6 +150,7 @@ struct _NmcMetaGenericInfo { NMMetaAccessorGetType get_type, NMMetaAccessorGetFlags get_flags, NMMetaAccessorGetOutFlags *out_flags, + gboolean *out_is_default, gpointer *out_to_free); }; diff --git a/clients/common/nm-meta-setting-access.c b/clients/common/nm-meta-setting-access.c index cd7ef783c4..a1bfed47b7 100644 --- a/clients/common/nm-meta-setting-access.c +++ b/clients/common/nm-meta-setting-access.c @@ -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); } diff --git a/clients/common/nm-meta-setting-access.h b/clients/common/nm-meta-setting-access.h index 54fc6c84d6..577cad787a 100644 --- a/clients/common/nm-meta-setting-access.h +++ b/clients/common/nm-meta-setting-access.h @@ -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, diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index 2b4aff274a..972d29eec5 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -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); } diff --git a/clients/common/nm-meta-setting-desc.h b/clients/common/nm-meta-setting-desc.h index d314289b8e..bb07515d5e 100644 --- a/clients/common/nm-meta-setting-desc.h +++ b/clients/common/nm-meta-setting-desc.h @@ -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, |