mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 07:08:02 +02:00
cli: add nmc_property_set_int() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
c9476a4242
commit
83e99c2227
1 changed files with 20 additions and 0 deletions
|
|
@ -2159,6 +2159,26 @@ nmc_property_set_uint (NMSetting *setting, const char *prop, const char *val, GE
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
nmc_property_set_int (NMSetting *setting, const char *prop, const char *val, GError **error)
|
||||||
|
{
|
||||||
|
long int val_int;
|
||||||
|
|
||||||
|
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||||
|
|
||||||
|
if (!nmc_string_to_int (val, TRUE, G_MININT, G_MAXINT, &val_int)) {
|
||||||
|
g_set_error (error, 1, 0, _("'%s' is not a valid number (or out of range)"), val);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Validate the number according to the property spec */
|
||||||
|
if (!validate_int (setting, prop, (gint) val_int, error))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
g_object_set (setting, prop, (gint) val_int, NULL);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
nmc_property_set_bool (NMSetting *setting, const char *prop, const char *val, GError **error)
|
nmc_property_set_bool (NMSetting *setting, const char *prop, const char *val, GError **error)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue