Commit 64f1e78e authored by Thomas Haller's avatar Thomas Haller

cli: drop NMCTriStateValue for NMTernary

parent bcbea6fe
......@@ -132,7 +132,7 @@ nmc_string_to_bool (const char *str, gboolean *val_bool, GError **error)
}
gboolean
nmc_string_to_tristate (const char *str, NMCTriStateValue *val, GError **error)
nmc_string_to_ternary (const char *str, NMTernary *val, GError **error)
{
const char *s_true[] = { "true", "yes", "on", NULL };
const char *s_false[] = { "false", "no", "off", NULL };
......@@ -150,11 +150,11 @@ nmc_string_to_tristate (const char *str, NMCTriStateValue *val, GError **error)
}
if (nmc_string_is_valid (str, s_true, NULL))
*val = NMC_TRI_STATE_YES;
*val = NM_TERNARY_TRUE;
else if (nmc_string_is_valid (str, s_false, NULL))
*val = NMC_TRI_STATE_NO;
*val = NM_TERNARY_FALSE;
else if (nmc_string_is_valid (str, s_unknown, NULL))
*val = NMC_TRI_STATE_UNKNOWN;
*val = NM_TERNARY_DEFAULT;
else {
g_set_error (error, 1, 0,
_("'%s' is not valid; use [%s], [%s] or [%s]"),
......
......@@ -24,12 +24,6 @@
#include "nm-active-connection.h"
#include "nm-device.h"
typedef enum {
NMC_TRI_STATE_NO,
NMC_TRI_STATE_YES,
NMC_TRI_STATE_UNKNOWN,
} NMCTriStateValue;
const NMObject **nmc_objects_sort_by_path (const NMObject *const*objs, gssize len);
const char *nmc_string_is_valid (const char *input, const char **allowed, GError **error);
......@@ -40,7 +34,7 @@ gboolean nmc_string_to_uint (const char *str,
unsigned long int max,
unsigned long int *value);
gboolean nmc_string_to_bool (const char *str, gboolean *val_bool, GError **error);
gboolean nmc_string_to_tristate (const char *str, NMCTriStateValue *val, GError **error);
gboolean nmc_string_to_ternary (const char *str, NMTernary *val, GError **error);
gboolean matches (const char *cmd, const char *pattern);
......
......@@ -2719,19 +2719,19 @@ static gboolean
_set_fcn_connection_metered (ARGS_SET_FCN)
{
NMMetered metered;
NMCTriStateValue ts_val;
NMTernary ts_val;
if (!nmc_string_to_tristate (value, &ts_val, error))
if (!nmc_string_to_ternary (value, &ts_val, error))
return FALSE;
switch (ts_val) {
case NMC_TRI_STATE_YES:
case NM_TERNARY_TRUE:
metered = NM_METERED_YES;
break;
case NMC_TRI_STATE_NO:
case NM_TERNARY_FALSE:
metered = NM_METERED_NO;
break;
case NMC_TRI_STATE_UNKNOWN:
case NM_TERNARY_DEFAULT:
metered = NM_METERED_UNKNOWN;
break;
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment