Commit ddfff04a authored by Thomas Haller's avatar Thomas Haller

cli: extend NMMetaSettingInfoEditor's get_fcn() to support different output forms

parent b7efa627
......@@ -469,17 +469,26 @@ get_property_val (NMSetting *setting, const char *prop, NMMetaAccessorGetType ge
{
const NMMetaPropertyInfo *property_info;
g_return_val_if_fail (NM_IS_SETTING (setting), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_return_val_if_fail (NM_IS_SETTING (setting), NULL);
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->property_type->get_fcn) {
return property_info->property_type->get_fcn (property_info,
nmc_meta_environment,
nmc_meta_environment_arg,
setting,
get_type,
show_secrets ? NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS : 0);
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_arg,
setting,
get_type,
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);
}
}
......
This diff is collapsed.
......@@ -117,13 +117,14 @@ struct _NMMetaPropertyType {
const char *(*describe_fcn) (const NMMetaPropertyInfo *property_info,
char **out_to_free);
char *(*get_fcn) (const NMMetaPropertyInfo *property_info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
NMSetting *setting,
NMMetaAccessorGetType get_type,
NMMetaAccessorGetFlags get_flags);
gconstpointer (*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);
gboolean (*set_fcn) (const NMMetaPropertyInfo *property_info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment