diff options
author | Thomas Haller <thaller@redhat.com> | 2017-05-21 13:58:22 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-05-23 13:37:10 +0200 |
commit | c55561d3039138a2857b67d3f651ed8f0c553d9b (patch) | |
tree | 79b5ab41c2918804aa8d96128660c384c234ebdb | |
parent | 8c87a4b8a8ffb0fb37a0b014c0d7501b0b91fe90 (diff) | |
download | NetworkManager-c55561d3039138a2857b67d3f651ed8f0c553d9b.tar.gz |
clients: implement connection.autoconnect-slaves property as enum
-rw-r--r-- | clients/common/nm-meta-setting-desc.c | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index 88f363d7e6..f7c1da76aa 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -789,21 +789,6 @@ _set_fcn_gobject_bool (ARGS_SET_FCN) } static gboolean -_set_fcn_gobject_trilean (ARGS_SET_FCN) -{ - const int INVALID = G_MININT; - int v; - - v = _nm_utils_ascii_str_to_int64 (value, 10, -1, 1, INVALID); - if (v == INVALID) { - g_set_error (error, 1, 0, _("'%s' is not a valid value; use -1, 0 or 1"), value); - return FALSE; - } - g_object_set (setting, property_info->property_name, v, NULL); - return TRUE; -} - -static gboolean _set_fcn_gobject_int (ARGS_SET_FCN) { const gint64 INVALID = G_MININT64; @@ -1236,24 +1221,6 @@ ip6_privacy_to_string (NMSettingIP6ConfigPrivacy ip6_privacy, NMMetaAccessorGetT } static char * -autoconnect_slaves_to_string (NMSettingConnectionAutoconnectSlaves autoconnect_slaves, - NMMetaAccessorGetType get_type) -{ - if (get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY) - return g_strdup_printf ("%d", autoconnect_slaves); - - switch (autoconnect_slaves) { - case NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_NO: - return g_strdup_printf (_("%d (no)"), autoconnect_slaves); - case NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES: - return g_strdup_printf (_("%d (yes)"), autoconnect_slaves); - case NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT: - default: - return g_strdup_printf (_("%d (default)"), autoconnect_slaves); - } -} - -static char * secret_flags_to_string (guint32 flags, NMMetaAccessorGetType get_type) { GString *flag_str; @@ -2232,14 +2199,6 @@ _get_fcn_connection_permissions (ARGS_GET_FCN) return NULL; } -static gconstpointer -_get_fcn_connection_autoconnect_slaves (ARGS_GET_FCN) -{ - NMSettingConnection *s_con = NM_SETTING_CONNECTION (setting); - RETURN_UNSUPPORTED_GET_TYPE (); - RETURN_STR_TO_FREE (autoconnect_slaves_to_string (nm_setting_connection_get_autoconnect_slaves (s_con), get_type)); -} - static gboolean _set_fcn_connection_type (ARGS_SET_FCN) { @@ -5237,9 +5196,9 @@ static const NMMetaPropertyInfo *const property_infos_CONNECTION[] = { ), ), PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES, - .property_type = DEFINE_PROPERTY_TYPE ( - .get_fcn = _get_fcn_connection_autoconnect_slaves, - .set_fcn = _set_fcn_gobject_trilean, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_connection_autoconnect_slaves_get_type, ), ), PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_SECONDARIES, |