clients: implement team.config as string property
... with separate validation function.
This commit is contained in:
@@ -3648,19 +3648,14 @@ _validate_fcn_proxy_pac_script (const char *value, char **out_to_free, GError **
|
|||||||
RETURN_STR_TO_FREE (script);
|
RETURN_STR_TO_FREE (script);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static const char *
|
||||||
_set_fcn_team_config (ARGS_SET_FCN)
|
_validate_fcn_team_config (const char *value, char **out_to_free, GError **error)
|
||||||
{
|
{
|
||||||
char *json = NULL;
|
char *json = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
if (!nmc_team_check_config (value, &json, error))
|
||||||
|
return NULL;
|
||||||
if (!nmc_team_check_config (value, &json, error)) {
|
RETURN_STR_TO_FREE (json);
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
g_object_set (setting, property_info->property_name, json, NULL);
|
|
||||||
g_free (json);
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gconstpointer
|
static gconstpointer
|
||||||
@@ -5882,9 +5877,9 @@ static const NMMetaPropertyInfo *const property_infos_TEAM[] = {
|
|||||||
.property_alias = "config",
|
.property_alias = "config",
|
||||||
.prompt = N_("Team JSON configuration [none]"),
|
.prompt = N_("Team JSON configuration [none]"),
|
||||||
.describe_message = TEAM_DESCRIBE_MESSAGE,
|
.describe_message = TEAM_DESCRIBE_MESSAGE,
|
||||||
.property_type = DEFINE_PROPERTY_TYPE (
|
.property_type = &_pt_gobject_string,
|
||||||
.get_fcn = _get_fcn_gobject,
|
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_string,
|
||||||
.set_fcn = _set_fcn_team_config,
|
.validate_fcn = _validate_fcn_team_config,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
NULL
|
NULL
|
||||||
@@ -5898,9 +5893,9 @@ static const NMMetaPropertyInfo *const property_infos_TEAM_PORT[] = {
|
|||||||
.property_alias = "config",
|
.property_alias = "config",
|
||||||
.prompt = N_("Team JSON configuration [none]"),
|
.prompt = N_("Team JSON configuration [none]"),
|
||||||
.describe_message = TEAM_DESCRIBE_MESSAGE,
|
.describe_message = TEAM_DESCRIBE_MESSAGE,
|
||||||
.property_type = DEFINE_PROPERTY_TYPE (
|
.property_type = &_pt_gobject_string,
|
||||||
.get_fcn = _get_fcn_gobject,
|
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_string,
|
||||||
.set_fcn = _set_fcn_team_config,
|
.validate_fcn = _validate_fcn_team_config,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
NULL
|
NULL
|
||||||
|
Reference in New Issue
Block a user