mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-23 18:40:24 +01:00
libnm/vpn: add nm_vpn_plugin_info_get_aliases
This commit is contained in:
parent
d37945b064
commit
10445bedb8
3 changed files with 31 additions and 2 deletions
|
|
@ -600,8 +600,6 @@ nm_vpn_plugin_info_list_find_by_service (GSList *list, const char *service)
|
|||
for (iter = list; iter; iter = iter->next) {
|
||||
char **aliases = (NM_VPN_PLUGIN_INFO_GET_PRIVATE (iter->data))->aliases;
|
||||
|
||||
if (!aliases)
|
||||
continue;
|
||||
if (_nm_utils_strv_find_first (aliases, -1, service) >= 0)
|
||||
return iter->data;
|
||||
}
|
||||
|
|
@ -767,6 +765,32 @@ nm_vpn_plugin_info_supports_multiple (NMVpnPluginInfo *self)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* nm_vpn_plugin_info_get_aliases:
|
||||
* @self: plugin info instance
|
||||
*
|
||||
* Returns: (array zero-terminated=1) (element-type utf8) (transfer none):
|
||||
* the aliases from the name-file.
|
||||
*
|
||||
* Since: 1.4
|
||||
*/
|
||||
const char *const*
|
||||
nm_vpn_plugin_info_get_aliases (NMVpnPluginInfo *self)
|
||||
{
|
||||
NMVpnPluginInfoPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (NM_IS_VPN_PLUGIN_INFO (self), NULL);
|
||||
|
||||
priv = NM_VPN_PLUGIN_INFO_GET_PRIVATE (self);
|
||||
if (priv->aliases)
|
||||
return (const char *const*) priv->aliases;
|
||||
|
||||
/* For convenience, we always want to return non-NULL, even for empty
|
||||
* aliases. Hack around that, by making a NULL terminated array using
|
||||
* the NULL of priv->aliases. */
|
||||
return (const char *const*) &priv->aliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_vpn_plugin_info_lookup_property:
|
||||
* @self: plugin info instance
|
||||
|
|
@ -1003,6 +1027,8 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
|||
}
|
||||
|
||||
priv->aliases = g_key_file_get_string_list (priv->keyfile, NM_VPN_PLUGIN_INFO_KF_GROUP_CONNECTION, "aliases", NULL, NULL);
|
||||
if (priv->aliases && !priv->aliases[0])
|
||||
g_clear_pointer (&priv->aliases, g_free);
|
||||
|
||||
priv->keys = g_hash_table_new_full (_nm_utils_strstrdictkey_hash,
|
||||
_nm_utils_strstrdictkey_equal,
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ NM_AVAILABLE_IN_1_4
|
|||
gboolean nm_vpn_plugin_info_supports_hints (NMVpnPluginInfo *self);
|
||||
NM_AVAILABLE_IN_1_2
|
||||
gboolean nm_vpn_plugin_info_supports_multiple (NMVpnPluginInfo *self);
|
||||
NM_AVAILABLE_IN_1_4
|
||||
const char *const*nm_vpn_plugin_info_get_aliases (NMVpnPluginInfo *self);
|
||||
NM_AVAILABLE_IN_1_2
|
||||
const char *nm_vpn_plugin_info_lookup_property (NMVpnPluginInfo *self, const char *group, const char *key);
|
||||
|
||||
|
|
|
|||
|
|
@ -1069,6 +1069,7 @@ global:
|
|||
nm_setting_ip6_config_get_token;
|
||||
nm_setting_ip_config_get_dns_priority;
|
||||
nm_vpn_editor_plugin_load;
|
||||
nm_vpn_plugin_info_get_aliases;
|
||||
nm_vpn_plugin_info_get_auth_dialog;
|
||||
nm_vpn_plugin_info_get_service;
|
||||
nm_vpn_plugin_info_new_search_file;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue