[network-manager-iodine/lr/multiple-vpn: 16/17] service: streamline the plugin instance creation a bit



commit 4887a17cbbeac7a54efdeab9b6e13659f8f2799a
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Wed Jan 27 18:33:31 2016 +0100

    service: streamline the plugin instance creation a bit

 src/nm-iodine-service.c |   31 ++++++++++---------------------
 1 files changed, 10 insertions(+), 21 deletions(-)
---
diff --git a/src/nm-iodine-service.c b/src/nm-iodine-service.c
index 9604320..0589d65 100644
--- a/src/nm-iodine-service.c
+++ b/src/nm-iodine-service.c
@@ -623,25 +623,6 @@ nm_iodine_plugin_class_init (NMIodinePluginClass *iodine_class)
        parent_class->disconnect = real_disconnect;
 }
 
-NMIodinePlugin *
-nm_iodine_plugin_new (const char *bus_name)
-{
-       NMIodinePlugin *plugin;
-       GError *error = NULL;
-
-       plugin = (NMIodinePlugin *) g_initable_new (NM_TYPE_IODINE_PLUGIN, NULL, &error,
-                                                   NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME,
-                                                   bus_name,
-                                                   NULL);
-
-       if (!plugin) {
-               g_warning ("Failed to initialize a plugin instance: %s", error->message);
-               g_error_free (error);
-       }
-
-       return plugin;
-}
-
 static void
 quit_mainloop (NMIodinePlugin *plugin, gpointer user_data)
 {
@@ -653,6 +634,7 @@ int main (int argc, char *argv[])
        NMIodinePlugin *plugin;
        GMainLoop *main_loop;
        gchar *bus_name = NM_DBUS_SERVICE_IODINE;
+       GError *error = NULL;
 
 #if !GLIB_CHECK_VERSION(2,36,0)
        g_type_init ();
@@ -665,9 +647,16 @@ int main (int argc, char *argv[])
                exit (EXIT_FAILURE);
        }
 
-       plugin = nm_iodine_plugin_new (bus_name);
-       if (!plugin)
+       plugin = (NMIodinePlugin *) g_initable_new (NM_TYPE_IODINE_PLUGIN, NULL, &error,
+                                                   NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME,
+                                                   bus_name,
+                                                   NULL);
+
+       if (!plugin) {
+               g_warning ("Failed to initialize a plugin instance: %s", error->message);
+               g_error_free (error);
                exit (EXIT_FAILURE);
+       }
 
        main_loop = g_main_loop_new (NULL, FALSE);
 


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