[NetworkManager-openvpn/th/support-proto: 1/2] properties: add setting_vpn_add_data_item_or_remove() helper
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [NetworkManager-openvpn/th/support-proto: 1/2] properties: add setting_vpn_add_data_item_or_remove() helper
- Date: Fri, 23 Oct 2020 13:59:32 +0000 (UTC)
commit 279bcfb70b91bd46a124a07d8d6ed95b84ec6213
Author: Thomas Haller <thaller redhat com>
Date: Fri Oct 23 15:55:30 2020 +0200
properties: add setting_vpn_add_data_item_or_remove() helper
properties/import-export.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
---
diff --git a/properties/import-export.c b/properties/import-export.c
index c1fe6db..a6478d9 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -124,6 +124,25 @@ setting_vpn_add_data_item (NMSettingVpn *setting,
nm_setting_vpn_add_data_item (setting, key, value);
}
+static void
+setting_vpn_add_data_item_or_remove (NMSettingVpn *setting,
+ const char *key,
+ const char *value)
+{
+ g_return_if_fail (NM_IS_SETTING_VPN (setting));
+ g_return_if_fail (key && key[0]);
+
+ if (!value) {
+ nm_setting_vpn_remove_data_item (setting, key);
+ return;
+ }
+
+ g_return_if_fail (value && value[0]);
+ g_return_if_fail (_is_utf8 (value));
+
+ nm_setting_vpn_add_data_item (setting, key, value);
+}
+
static void
setting_vpn_add_data_item_utf8safe (NMSettingVpn *setting,
const char *key,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]