cli: extend NMMetaSettingInfoEditor's get_fcn() to support different output forms
This commit is contained in:
@@ -469,17 +469,26 @@ get_property_val (NMSetting *setting, const char *prop, NMMetaAccessorGetType ge
|
|||||||
{
|
{
|
||||||
const NMMetaPropertyInfo *property_info;
|
const NMMetaPropertyInfo *property_info;
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
|
g_return_val_if_fail (NM_IS_SETTING (setting), NULL);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
g_return_val_if_fail (!error || !*error, NULL);
|
||||||
|
g_return_val_if_fail (NM_IN_SET (get_type, NM_META_ACCESSOR_GET_TYPE_PARSABLE, NM_META_ACCESSOR_GET_TYPE_PRETTY), NULL);
|
||||||
|
|
||||||
if ((property_info = nm_meta_property_info_find_by_setting (setting, prop))) {
|
if ((property_info = nm_meta_property_info_find_by_setting (setting, prop))) {
|
||||||
if (property_info->property_type->get_fcn) {
|
if (property_info->property_type->get_fcn) {
|
||||||
return property_info->property_type->get_fcn (property_info,
|
NMMetaAccessorGetOutFlags out_flags = NM_META_ACCESSOR_GET_OUT_FLAGS_NONE;
|
||||||
|
char *to_free = NULL;
|
||||||
|
const char *value;
|
||||||
|
|
||||||
|
value = property_info->property_type->get_fcn (property_info,
|
||||||
nmc_meta_environment,
|
nmc_meta_environment,
|
||||||
nmc_meta_environment_arg,
|
nmc_meta_environment_arg,
|
||||||
setting,
|
setting,
|
||||||
get_type,
|
get_type,
|
||||||
show_secrets ? NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS : 0);
|
show_secrets ? NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS : 0,
|
||||||
|
&out_flags,
|
||||||
|
(gpointer *) &to_free);
|
||||||
|
nm_assert (!out_flags);
|
||||||
|
return to_free ?: g_strdup (value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -117,13 +117,14 @@ struct _NMMetaPropertyType {
|
|||||||
|
|
||||||
const char *(*describe_fcn) (const NMMetaPropertyInfo *property_info,
|
const char *(*describe_fcn) (const NMMetaPropertyInfo *property_info,
|
||||||
char **out_to_free);
|
char **out_to_free);
|
||||||
|
gconstpointer (*get_fcn) (const NMMetaPropertyInfo *property_info,
|
||||||
char *(*get_fcn) (const NMMetaPropertyInfo *property_info,
|
|
||||||
const NMMetaEnvironment *environment,
|
const NMMetaEnvironment *environment,
|
||||||
gpointer environment_user_data,
|
gpointer environment_user_data,
|
||||||
NMSetting *setting,
|
NMSetting *setting,
|
||||||
NMMetaAccessorGetType get_type,
|
NMMetaAccessorGetType get_type,
|
||||||
NMMetaAccessorGetFlags get_flags);
|
NMMetaAccessorGetFlags get_flags,
|
||||||
|
NMMetaAccessorGetOutFlags *out_flags,
|
||||||
|
gpointer *out_to_free);
|
||||||
gboolean (*set_fcn) (const NMMetaPropertyInfo *property_info,
|
gboolean (*set_fcn) (const NMMetaPropertyInfo *property_info,
|
||||||
const NMMetaEnvironment *environment,
|
const NMMetaEnvironment *environment,
|
||||||
gpointer environment_user_data,
|
gpointer environment_user_data,
|
||||||
|
Reference in New Issue
Block a user