diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2018-04-04 10:14:19 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2018-04-13 17:02:55 +0200 |
commit | 350345fff434170170371047375c4c7a68dff509 (patch) | |
tree | 69f3271edb883fc38cf86de1fea2d2b8c904cd2a | |
parent | ae54a75298dafd279819a1ced30e65cdd49c6725 (diff) | |
download | NetworkManager-350345fff434170170371047375c4c7a68dff509.tar.gz |
clients: meta: use enum setter for secret flags
-rw-r--r-- | clients/common/nm-meta-setting-desc.c | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index 0e979eda68..6344a1ee61 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -1176,42 +1176,6 @@ _set_fcn_gobject_mac (ARGS_SET_FCN) } static gboolean -_set_fcn_gobject_secret_flags (ARGS_SET_FCN) -{ - gs_free char *err_token = NULL; - gs_free char *str_all = NULL; - int flags; - - nm_assert (!error || !*error); - - if (!nm_utils_enum_from_str (nm_setting_secret_flags_get_type (), - value, - &flags, - &err_token)) { - str_all = nm_utils_enum_to_str (nm_setting_secret_flags_get_type (), - ALL_SECRET_FLAGS); - g_set_error (error, 1, 0, - _("'%s' is not a valid flag; use <0-%d> or a combination of '%s'"), - err_token, - ALL_SECRET_FLAGS, - str_all); - return FALSE; - } - - /* Validate the flags number */ - if (flags > ALL_SECRET_FLAGS) { - flags = ALL_SECRET_FLAGS; - _env_warn_fcn (environment, environment_user_data, - NM_META_ENV_WARN_LEVEL_WARN, - N_("'%s' sum is higher than all flags => all flags set"), - value); - } - - g_object_set (setting, property_info->property_name, (guint) flags, NULL); - return TRUE; -} - -static gboolean _set_fcn_gobject_enum (ARGS_SET_FCN) { GType gtype = 0; @@ -4840,7 +4804,7 @@ static const NMMetaPropertyType _pt_gobject_mac = { static const NMMetaPropertyType _pt_gobject_secret_flags = { .get_fcn = _get_fcn_gobject_secret_flags, - .set_fcn = _set_fcn_gobject_secret_flags, + .set_fcn = _set_fcn_gobject_enum, .values_fcn = _values_fcn_gobject_enum, }; |