mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 08:50:27 +01:00
clients: add GError parameter to nm_vpn_get_plugin_by_service()
This commit is contained in:
parent
ce238a7074
commit
96ab3a8a5c
2 changed files with 8 additions and 5 deletions
|
|
@ -37,12 +37,13 @@ static gboolean plugins_loaded;
|
|||
static GSList *plugins = NULL;
|
||||
|
||||
NMVpnEditorPlugin *
|
||||
nm_vpn_get_plugin_by_service (const char *service)
|
||||
nm_vpn_get_plugin_by_service (const char *service, GError **error)
|
||||
{
|
||||
NMVpnEditorPlugin *plugin = NULL;
|
||||
NMVpnPluginInfo *plugin_info;
|
||||
|
||||
g_return_val_if_fail (service != NULL, NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
if (G_UNLIKELY (!plugins_loaded))
|
||||
nm_vpn_get_plugins ();
|
||||
|
|
@ -51,8 +52,10 @@ nm_vpn_get_plugin_by_service (const char *service)
|
|||
if (plugin_info) {
|
||||
plugin = nm_vpn_plugin_info_get_editor_plugin (plugin_info);
|
||||
if (!plugin)
|
||||
plugin = nm_vpn_plugin_info_load_editor_plugin (plugin_info, NULL);
|
||||
}
|
||||
plugin = nm_vpn_plugin_info_load_editor_plugin (plugin_info, error);
|
||||
} else
|
||||
g_set_error_literal (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_FAILED,
|
||||
_("could not get VPN plugin info"));
|
||||
return plugin;
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +83,7 @@ nm_vpn_supports_ipv6 (NMConnection *connection)
|
|||
service_type = nm_setting_vpn_get_service_type (s_vpn);
|
||||
g_return_val_if_fail (service_type != NULL, FALSE);
|
||||
|
||||
plugin = nm_vpn_get_plugin_by_service (service_type);
|
||||
plugin = nm_vpn_get_plugin_by_service (service_type, NULL);
|
||||
g_return_val_if_fail (plugin != NULL, FALSE);
|
||||
|
||||
capabilities = nm_vpn_editor_plugin_get_capabilities (plugin);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
GSList *nm_vpn_get_plugins (void);
|
||||
|
||||
NMVpnEditorPlugin *nm_vpn_get_plugin_by_service (const char *service);
|
||||
NMVpnEditorPlugin *nm_vpn_get_plugin_by_service (const char *service, GError **error);
|
||||
|
||||
gboolean nm_vpn_supports_ipv6 (NMConnection *connection);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue