clients: add GError parameter to nm_vpn_get_plugin_by_service()
authorJiří Klimeš <jklimes@redhat.com>
Mon, 30 Nov 2015 15:20:10 +0000 (16:20 +0100)
committerJiří Klimeš <jklimes@redhat.com>
Sat, 5 Dec 2015 20:29:00 +0000 (21:29 +0100)
clients/common/nm-vpn-helpers.c
clients/common/nm-vpn-helpers.h

index 73e6600..6cc3eb8 100644 (file)
@@ -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);
index bc857a6..9a2ff7b 100644 (file)
@@ -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);