summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-04-18 17:14:00 +0200
committerThomas Haller <thaller@redhat.com>2016-04-19 13:47:42 +0200
commit6878999ca388bc747e1a9546837f82929cb7575c (patch)
tree377e948649605b95253f7a4488e68dc033b6f5ab
parent186787744c5678f60c054b1223a44e7890901f11 (diff)
downloadNetworkManager-6878999ca388bc747e1a9546837f82929cb7575c.tar.gz
libnm/vpn: lookup nm_vpn_plugin_info_supports_multiple() from cached values
Instead of looking into the keyfile, lookup the "supports-multiple-connections" setting in the "keys" hash. This has some behavioral difference: - g_key_file_get_boolean() first does g_key_file_get_value(), and then converts the string using the private g_key_file_parse_value_as_boolean() function -- which is case-sensitive, accepts "true|false|0|1" and considers only the text until the first whitespace. - now, we put g_key_file_get_string() into the cache "keys" and parse it with _nm_utils_ascii_str_to_bool(). The latter is case insensitive, allows also "yes|no|on|off", strips whitespaces. However, the difference is subtle and shouldn't matter. The point of this change is to free "keyfile" after construction.
-rw-r--r--libnm-core/nm-vpn-plugin-info.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libnm-core/nm-vpn-plugin-info.c b/libnm-core/nm-vpn-plugin-info.c
index 53278fcac8..430f9125ed 100644
--- a/libnm-core/nm-vpn-plugin-info.c
+++ b/libnm-core/nm-vpn-plugin-info.c
@@ -620,12 +620,12 @@ nm_vpn_plugin_info_get_program (NMVpnPluginInfo *self)
gboolean
nm_vpn_plugin_info_supports_multiple (NMVpnPluginInfo *self)
{
+ const char *s;
+
g_return_val_if_fail (NM_IS_VPN_PLUGIN_INFO (self), FALSE);
- return g_key_file_get_boolean (NM_VPN_PLUGIN_INFO_GET_PRIVATE (self)->keyfile,
- NM_VPN_PLUGIN_INFO_KF_GROUP_CONNECTION,
- "supports-multiple-connections",
- NULL);
+ s = nm_vpn_plugin_info_lookup_property (self, NM_VPN_PLUGIN_INFO_KF_GROUP_CONNECTION, "supports-multiple-connections");
+ return _nm_utils_ascii_str_to_bool (s, FALSE);
}