From 4c8673d978fa6c2d84f547afaa935a98b0b0c09a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 12 Sep 2017 16:33:42 +0200 Subject: [PATCH] cli: refactor connection.autoconnect-retires to use int-getter --- clients/common/nm-meta-setting-desc.c | 44 ++++++++------------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index 707f293284..a3e59be309 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -2277,35 +2277,6 @@ _values_fcn_bond_options (ARGS_VALUES_FCN) return nm_setting_bond_get_valid_options (NULL); } -static gconstpointer -_get_fcn_connection_autoconnect_retries (ARGS_GET_FCN) -{ - NMSettingConnection *s_con = NM_SETTING_CONNECTION (setting); - gint retries; - char *s; - - RETURN_UNSUPPORTED_GET_TYPE (); - - retries = nm_setting_connection_get_autoconnect_retries (s_con); - if (get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY) - s = g_strdup_printf ("%d", retries); - else { - switch (retries) { - case -1: - s = g_strdup_printf (_("%d (default)"), retries); - break; - case 0: - s = g_strdup_printf (_("%d (forever)"), retries); - break; - default: - s = g_strdup_printf ("%d", retries); - break; - } - } - - RETURN_STR_TO_FREE (s); -} - static gconstpointer _get_fcn_connection_permissions (ARGS_GET_FCN) { @@ -5012,9 +4983,18 @@ static const NMMetaPropertyInfo *const property_infos_CONNECTION[] = { .property_type = &_pt_gobject_int, ), PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES, - .property_type = DEFINE_PROPERTY_TYPE ( - .get_fcn = _get_fcn_connection_autoconnect_retries, - .set_fcn = _set_fcn_gobject_int, + .property_type = &_pt_gobject_int, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, + .value_infos = INT_VALUE_INFOS ( + { + .value = -1, + .nick = "default", + }, + { + .value = 0, + .nick = "forever", + } + ), ), ), PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_TIMESTAMP,