[network-manager-openvpn/th/export-bgo764132: 8/23] properties: refactor do_export() (add args_write_line_setting_value())
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openvpn/th/export-bgo764132: 8/23] properties: refactor do_export() (add args_write_line_setting_value())
- Date: Thu, 24 Mar 2016 11:29:49 +0000 (UTC)
commit 730ed3fbfeb902ad9cc5af9d2741b47f8916657b
Author: Thomas Haller <thaller redhat com>
Date: Wed Mar 23 18:58:57 2016 +0100
properties: refactor do_export() (add args_write_line_setting_value())
properties/import-export.c | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/properties/import-export.c b/properties/import-export.c
index 7a0c9ca..10e61fc 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -1614,6 +1614,23 @@ args_write_line_int64_str (GString *f, const char *key, const char *value)
args_write_line_int64 (f, key, v);
}
+static void
+args_write_line_setting_value (GString *f,
+ const char *tag_key,
+ NMSettingVpn *s_vpn,
+ const char *setting_key)
+{
+ const char *value;
+
+ nm_assert (tag_key && tag_key[0]);
+ nm_assert (NM_IS_SETTING_VPN (s_vpn));
+ nm_assert (setting_key && setting_key[0]);
+
+ value = nm_setting_vpn_get_data_item (s_vpn, setting_key);
+ if (_arg_is_set (value))
+ args_write_line (f, tag_key, value);
+}
+
/*****************************************************************************/
static GString *
@@ -1635,7 +1652,6 @@ do_export_create (NMConnection *connection, const char *path, GError **error)
const char *port = NULL;
const char *ping = NULL;
const char *ping_exit = NULL;
- const char *ping_restart = NULL;
const char *local_ip = NULL;
const char *remote_ip = NULL;
const char *tls_remote = NULL;
@@ -1745,10 +1761,6 @@ do_export_create (NMConnection *connection, const char *path, GError **error)
if (_arg_is_set (value))
ping_exit = value;
- value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_PING_RESTART);
- if (_arg_is_set (value))
- ping_restart = value;
-
value = nm_setting_vpn_get_data_item (s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS);
if (_arg_is_set (value)) {
reneg_exists = TRUE;
@@ -1927,8 +1939,7 @@ do_export_create (NMConnection *connection, const char *path, GError **error)
if (ping_exit)
args_write_line (f, "ping-exit", ping_exit);
- if (ping_restart)
- args_write_line (f, "ping-restart", ping_restart);
+ args_write_line_setting_value (f, "ping-restart", s_vpn, NM_OPENVPN_KEY_PING_RESTART);
if (local_ip && remote_ip)
args_write_line (f, "ifconfig", local_ip, remote_ip);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]