[network-manager-openvpn/lr/libnm: 7/13] fixup! service: port to libnm



commit 7af418575ec61b85c6530954a594c4f7115c790a
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Fri Aug 14 18:06:47 2015 +0200

    fixup! service: port to libnm
    
    Initialize a GInitable.

 src/nm-openvpn-service.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
index 17a2412..f392515 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -1626,13 +1626,19 @@ NMOpenvpnPlugin *
 nm_openvpn_plugin_new (void)
 {
        NMOpenvpnPlugin *plugin;
+       GError *error = NULL;
 
-       plugin =  (NMOpenvpnPlugin *) g_object_new (NM_TYPE_OPENVPN_PLUGIN,
-                                                   NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME,
-                                                   NM_DBUS_SERVICE_OPENVPN,
-                                                   NULL);
-       if (plugin)
+       plugin =  (NMOpenvpnPlugin *) g_initable_new (NM_TYPE_OPENVPN_PLUGIN, NULL, &error,
+                                                     NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME,
+                                                     NM_DBUS_SERVICE_OPENVPN,
+                                                     NULL);
+
+       if (plugin) {
                g_signal_connect (G_OBJECT (plugin), "state-changed", G_CALLBACK (plugin_state_changed), 
NULL);
+       } else {
+               g_warning ("Failed to initialize a plugin instance: %s", error->message);
+               g_error_free (error);
+       }
 
        return plugin;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]