From e81bdf19fa826750ef4e157c200f422179abc16e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 28 Apr 2017 11:28:04 +0200 Subject: [PATCH] ifcfg-rh: add svSetValueEnum() --- src/settings/plugins/ifcfg-rh/shvar.c | 10 ++++++++++ src/settings/plugins/ifcfg-rh/shvar.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/settings/plugins/ifcfg-rh/shvar.c b/src/settings/plugins/ifcfg-rh/shvar.c index 25a012cf3c..76c8d7c926 100644 --- a/src/settings/plugins/ifcfg-rh/shvar.c +++ b/src/settings/plugins/ifcfg-rh/shvar.c @@ -38,6 +38,7 @@ #include "nm-core-internal.h" #include "nm-core-utils.h" +#include "nm-utils/nm-enum-utils.h" /*****************************************************************************/ @@ -1127,6 +1128,15 @@ svSetValueBoolean (shvarFile *s, const char *key, gboolean value) svSetValue (s, key, value ? "yes" : "no"); } +void +svSetValueEnum (shvarFile *s, const char *key, GType gtype, int value) +{ + gs_free char *v = NULL; + + v = _nm_utils_enum_to_str_full (gtype, value, " "); + svSetValueStr (s, key, v); +} + void svUnsetValue (shvarFile *s, const char *key) { diff --git a/src/settings/plugins/ifcfg-rh/shvar.h b/src/settings/plugins/ifcfg-rh/shvar.h index 8eaf9b878e..7ad2bc8863 100644 --- a/src/settings/plugins/ifcfg-rh/shvar.h +++ b/src/settings/plugins/ifcfg-rh/shvar.h @@ -73,6 +73,7 @@ void svSetValue (shvarFile *s, const char *key, const char *value); void svSetValueStr (shvarFile *s, const char *key, const char *value); void svSetValueBoolean (shvarFile *s, const char *key, gboolean value); void svSetValueInt64 (shvarFile *s, const char *key, gint64 value); +void svSetValueEnum (shvarFile *s, const char *key, GType gtype, int value); void svUnsetValue (shvarFile *s, const char *key);