[network-manager-pptp/lr/libnm: 11/14] fixup! service: port pptp plugin to libnm



commit 21df8e72ae55445b2bcb7d9c43ab8db2f4a0374d
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Sat Jul 25 09:05:24 2015 +0200

    fixup! service: port pptp plugin to libnm
    
    Don't use the old API.

 auth-dialog/main.c    |    4 ++--
 src/nm-pptp-service.c |   34 +++++++++++++++++-----------------
 src/nm-pptp-service.h |    6 +++---
 3 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index 147c4e2..a1a4e1a 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -270,13 +270,13 @@ main (int argc, char *argv[])
                return 1;
        }
 
-       if (!nm_vpn_plugin_old_read_vpn_details (0, &data, &secrets)) {
+       if (!nm_vpn_service_plugin_read_vpn_details (0, &data, &secrets)) {
                fprintf (stderr, "Failed to read '%s' (%s) data and secrets from stdin.\n",
                         vpn_name, vpn_uuid);
                return 1;
        }
 
-       nm_vpn_plugin_old_get_secret_flags (secrets, NM_PPTP_KEY_PASSWORD, &pw_flags);
+       nm_vpn_service_plugin_get_secret_flags (secrets, NM_PPTP_KEY_PASSWORD, &pw_flags);
 
        if (!get_secrets (vpn_uuid, vpn_name, retry, allow_interaction, external_ui_mode,
                          g_hash_table_lookup (secrets, NM_PPTP_KEY_PASSWORD),
diff --git a/src/nm-pptp-service.c b/src/nm-pptp-service.c
index a31c5f5..638f9be 100644
--- a/src/nm-pptp-service.c
+++ b/src/nm-pptp-service.c
@@ -462,7 +462,7 @@ impl_pptp_service_set_ip4_config (NMPptpPppService *self,
 /* The VPN plugin service                               */
 /********************************************************/
 
-G_DEFINE_TYPE (NMPptpPlugin, nm_pptp_plugin, NM_TYPE_VPN_PLUGIN_OLD)
+G_DEFINE_TYPE (NMPptpPlugin, nm_pptp_plugin, NM_TYPE_VPN_SERVICE_PLUGIN)
 
 typedef struct {
        GPid pid;
@@ -699,21 +699,21 @@ pppd_watch_cb (GPid pid, gint status, gpointer user_data)
        case 16:
                /* hangup */
                // FIXME: better failure reason
-               nm_vpn_plugin_old_failure (NM_VPN_PLUGIN_OLD (plugin), NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
+               nm_vpn_service_plugin_failure (NM_VPN_SERVICE_PLUGIN (plugin), 
NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
                break;
        case 2:
                /* Couldn't log in due to bad user/pass */
-               nm_vpn_plugin_old_failure (NM_VPN_PLUGIN_OLD (plugin), NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED);
+               nm_vpn_service_plugin_failure (NM_VPN_SERVICE_PLUGIN (plugin), 
NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED);
                break;
        case 1:
                /* Other error (couldn't bind to address, etc) */
-               nm_vpn_plugin_old_failure (NM_VPN_PLUGIN_OLD (plugin), NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
+               nm_vpn_service_plugin_failure (NM_VPN_SERVICE_PLUGIN (plugin), 
NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
                break;
        default:
                break;
        }
 
-       nm_vpn_plugin_old_set_state (NM_VPN_PLUGIN_OLD (plugin), NM_VPN_SERVICE_STATE_STOPPED);
+       nm_vpn_service_plugin_set_state (NM_VPN_SERVICE_PLUGIN (plugin), NM_VPN_SERVICE_STATE_STOPPED);
 }
 
 static inline const char *
@@ -766,7 +766,7 @@ pppd_timed_out (gpointer user_data)
        NMPptpPlugin *plugin = NM_PPTP_PLUGIN (user_data);
 
        g_warning ("Looks like pppd didn't initialize our dbus module");
-       nm_vpn_plugin_old_failure (NM_VPN_PLUGIN_OLD (plugin), 
NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_TIMEOUT);
+       nm_vpn_service_plugin_failure (NM_VPN_SERVICE_PLUGIN (plugin), 
NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_TIMEOUT);
 
        return FALSE;
 }
@@ -1044,15 +1044,15 @@ service_ppp_state_cb (NMPptpPppService *service,
                       guint32 ppp_state,
                       NMPptpPlugin *plugin)
 {
-       NMVpnServiceState plugin_state = nm_vpn_plugin_old_get_state (NM_VPN_PLUGIN_OLD (plugin));
+       NMVpnServiceState plugin_state = nm_vpn_service_plugin_get_state (NM_VPN_SERVICE_PLUGIN (plugin));
 
        switch (ppp_state) {
        case NM_PPP_STATUS_DEAD:
        case NM_PPP_STATUS_DISCONNECT:
                if (plugin_state == NM_VPN_SERVICE_STATE_STARTED)
-                       nm_vpn_plugin_old_disconnect (NM_VPN_PLUGIN_OLD (plugin), NULL);
+                       nm_vpn_service_plugin_disconnect (NM_VPN_SERVICE_PLUGIN (plugin), NULL);
                else if (plugin_state == NM_VPN_SERVICE_STATE_STARTING)
-                       nm_vpn_plugin_old_failure (NM_VPN_PLUGIN_OLD (plugin), 
NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
+                       nm_vpn_service_plugin_failure (NM_VPN_SERVICE_PLUGIN (plugin), 
NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
                break;
        default:
                break;
@@ -1062,7 +1062,7 @@ service_ppp_state_cb (NMPptpPppService *service,
 static void
 service_ip4_config_cb (NMPptpPppService *service,
                        GHashTable *config_hash,
-                       NMVpnPluginOld *plugin)
+                       NMVpnServicePlugin *plugin)
 {
        NMPptpPppServicePrivate *priv = NM_PPTP_PPP_SERVICE_GET_PRIVATE (service);
        GHashTableIter iter;
@@ -1096,12 +1096,12 @@ service_ip4_config_cb (NMPptpPppService *service,
        new_config = g_variant_builder_end (&builder);
        g_variant_ref_sink (new_config);
 
-       nm_vpn_plugin_old_set_ip4_config (plugin, new_config);
+       nm_vpn_service_plugin_set_ip4_config (plugin, new_config);
        g_variant_unref (new_config);
 }
 
 static gboolean
-real_connect (NMVpnPluginOld *plugin,
+real_connect (NMVpnServicePlugin *plugin,
               NMConnection *connection,
               GError **error)
 {
@@ -1152,7 +1152,7 @@ real_connect (NMVpnPluginOld *plugin,
 }
 
 static gboolean
-real_need_secrets (NMVpnPluginOld *plugin,
+real_need_secrets (NMVpnServicePlugin *plugin,
                    NMConnection *connection,
                    const char **setting_name,
                    GError **error)
@@ -1160,7 +1160,7 @@ real_need_secrets (NMVpnPluginOld *plugin,
        NMSettingVpn *s_vpn;
        NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE;
 
-       g_return_val_if_fail (NM_IS_VPN_PLUGIN_OLD (plugin), FALSE);
+       g_return_val_if_fail (NM_IS_VPN_SERVICE_PLUGIN (plugin), FALSE);
        g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
 
        s_vpn = nm_connection_get_setting_vpn (connection);
@@ -1192,7 +1192,7 @@ ensure_killed (gpointer data)
 }
 
 static gboolean
-real_disconnect (NMVpnPluginOld *plugin, GError **err)
+real_disconnect (NMVpnServicePlugin *plugin, GError **err)
 {
        NMPptpPluginPrivate *priv = NM_PPTP_PLUGIN_GET_PRIVATE (plugin);
 
@@ -1255,7 +1255,7 @@ static void
 nm_pptp_plugin_class_init (NMPptpPluginClass *pptp_class)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (pptp_class);
-       NMVpnPluginOldClass *parent_class = NM_VPN_PLUGIN_OLD_CLASS (pptp_class);
+       NMVpnServicePluginClass *parent_class = NM_VPN_SERVICE_PLUGIN_CLASS (pptp_class);
 
        g_type_class_add_private (object_class, sizeof (NMPptpPluginPrivate));
 
@@ -1273,7 +1273,7 @@ nm_pptp_plugin_new (void)
        GError *error = NULL;
 
        plugin = g_initable_new (NM_TYPE_PPTP_PLUGIN, NULL, &error,
-                                NM_VPN_PLUGIN_OLD_DBUS_SERVICE_NAME,
+                                NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME,
                                 NM_DBUS_SERVICE_PPTP,
                                 NULL);
        if (plugin)
diff --git a/src/nm-pptp-service.h b/src/nm-pptp-service.h
index 7872527..e73f792 100644
--- a/src/nm-pptp-service.h
+++ b/src/nm-pptp-service.h
@@ -26,7 +26,7 @@
 #include <glib.h>
 #include <glib-object.h>
 #include <NetworkManager.h>
-#include <nm-vpn-plugin-old.h>
+#include <nm-vpn-service-plugin.h>
 
 #include "nm-pptp-service-defines.h"
 
@@ -41,11 +41,11 @@
 #define DBUS_TYPE_G_MAP_OF_VARIANT (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE))
 
 typedef struct {
-       NMVpnPluginOld parent;
+       NMVpnServicePlugin parent;
 } NMPptpPlugin;
 
 typedef struct {
-       NMVpnPluginOldClass parent;
+       NMVpnServicePluginClass parent;
 } NMPptpPluginClass;
 
 GType nm_pptp_plugin_get_type (void);


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