summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-05-21 22:00:27 +0200
committerThomas Haller <thaller@redhat.com>2017-05-21 22:00:28 +0200
commitbf18b167881f94dde1f99586bbef83f39fb154d5 (patch)
tree6c4dc9ce4b8a093ad4b91828c693e5fbe006e5a9
parentae51cea108a765870fe1501b624056b19771f9f7 (diff)
downloadNetworkManager-bf18b167881f94dde1f99586bbef83f39fb154d5.tar.gz
clients: implement team.config as string property
... with separate validation function.
-rw-r--r--clients/common/nm-meta-setting-desc.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index 8efb7ec828..a6a05a06a9 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -3648,19 +3648,14 @@ _validate_fcn_proxy_pac_script (const char *value, char **out_to_free, GError **
RETURN_STR_TO_FREE (script);
}
-static gboolean
-_set_fcn_team_config (ARGS_SET_FCN)
+static const char *
+_validate_fcn_team_config (const char *value, char **out_to_free, GError **error)
{
char *json = NULL;
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- if (!nmc_team_check_config (value, &json, error)) {
- return FALSE;
- }
- g_object_set (setting, property_info->property_name, json, NULL);
- g_free (json);
- return TRUE;
+ if (!nmc_team_check_config (value, &json, error))
+ return NULL;
+ RETURN_STR_TO_FREE (json);
}
static gconstpointer
@@ -5880,9 +5875,9 @@ static const NMMetaPropertyInfo *const property_infos_TEAM[] = {
.property_alias = "config",
.prompt = N_("Team JSON configuration [none]"),
.describe_message = TEAM_DESCRIBE_MESSAGE,
- .property_type = DEFINE_PROPERTY_TYPE (
- .get_fcn = _get_fcn_gobject,
- .set_fcn = _set_fcn_team_config,
+ .property_type = &_pt_gobject_string,
+ .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_string,
+ .validate_fcn = _validate_fcn_team_config,
),
),
NULL
@@ -5896,9 +5891,9 @@ static const NMMetaPropertyInfo *const property_infos_TEAM_PORT[] = {
.property_alias = "config",
.prompt = N_("Team JSON configuration [none]"),
.describe_message = TEAM_DESCRIBE_MESSAGE,
- .property_type = DEFINE_PROPERTY_TYPE (
- .get_fcn = _get_fcn_gobject,
- .set_fcn = _set_fcn_team_config,
+ .property_type = &_pt_gobject_string,
+ .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_string,
+ .validate_fcn = _validate_fcn_team_config,
),
),
NULL