[network-manager-openvpn/jk/openvpn-plugin-init] core: NMVPNPlugin initialization changed to use GInitable (rh #1050934)



commit fd2a787e04aabf052ba0eb090b4d72be30781da4
Author: Jiří Klimeš <jklimes redhat com>
Date:   Mon Mar 17 17:06:04 2014 +0100

    core: NMVPNPlugin initialization changed to use GInitable (rh #1050934)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1050934

 configure.ac             |    2 +-
 src/nm-openvpn-service.c |   16 ++++++++++------
 2 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1c23469..cf8ecb7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,7 +57,7 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
 IT_PROG_INTLTOOL([0.35])
 AM_GLIB_GNU_GETTEXT
 
-PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.32)
+PKG_CHECK_MODULES(GLIB, gio-unix-2.0 >= 2.32)
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32"
diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c
index 66f2118..2b39566 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -28,6 +28,7 @@
 #endif
 
 #include <glib/gi18n.h>
+#include <gio/gio.h>
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib-lowlevel.h>
 #include <dbus/dbus-glib.h>
@@ -1521,12 +1522,15 @@ NMOpenvpnPlugin *
 nm_openvpn_plugin_new (void)
 {
        NMOpenvpnPlugin *plugin;
-
-       plugin =  (NMOpenvpnPlugin *) g_object_new (NM_TYPE_OPENVPN_PLUGIN,
-                                                   NM_VPN_PLUGIN_DBUS_SERVICE_NAME,
-                                                   NM_DBUS_SERVICE_OPENVPN,
-                                                   NULL);
-       if (plugin)
+       GError *error = NULL;
+
+       plugin = g_initable_new (NM_TYPE_OPENVPN_PLUGIN, NULL, &error,
+                                NM_VPN_PLUGIN_DBUS_SERVICE_NAME, NM_DBUS_SERVICE_OPENVPN,
+                                NULL);
+       if (!plugin) {
+               g_warning ("%s", error->message);
+               g_error_free (error);
+       } else
                g_signal_connect (G_OBJECT (plugin), "state-changed", G_CALLBACK (plugin_state_changed), 
NULL);
 
        return plugin;


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