[network-manager-openvpn/lr/libnm: 3/13] properties: port to libnm



commit 275de79811471d02ee59aff67fd495f5dc73184d
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Fri Jul 24 11:47:28 2015 +0200

    properties: port to libnm

 auth-dialog/main.c                    |    2 +-
 common/Makefile.am                    |    4 +-
 common/utils.c                        |    4 +
 configure.ac                          |    8 +-
 nm-openvpn-service.name.in            |    6 +-
 properties/Makefile.am                |    8 +-
 properties/auth-helpers.c             |   31 ++++++----
 properties/auth-helpers.h             |   10 ++-
 properties/import-export.c            |   19 ++++--
 properties/import-export.h            |    5 ++
 properties/nm-openvpn.c               |  104 +++++++++++++++++++--------------
 properties/tests/test-import-export.c |    2 +-
 12 files changed, 125 insertions(+), 78 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index 3f870ad..8b279e6 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -40,7 +40,7 @@
 #include <nm-vpn-password-dialog.h>
 
 #include "../common/utils.h"
-#include "../src/nm-openvpn-service.h"
+#include "../src/nm-openvpn-service-defines.h"
 
 #define KEYRING_UUID_TAG "connection-uuid"
 #define KEYRING_SN_TAG "setting-name"
diff --git a/common/Makefile.am b/common/Makefile.am
index e8190cf..74a7681 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -1,7 +1,7 @@
 noinst_LTLIBRARIES=libnm-openvpn-common.la libnm-openvpn-common-old.la
 
 libnm_openvpn_common_la_CPPFLAGS = \
-       $(LIBNM_GLIB_CFLAGS) \
+       $(LIBNM_CFLAGS) \
         -I$(top_srcdir)/src/
 
 libnm_openvpn_common_old_la_CPPFLAGS = \
@@ -18,7 +18,7 @@ libnm_openvpn_common_old_la_SOURCES = \
        $(libnm_openvpn_common_la_SOURCES)
 
 libnm_openvpn_common_la_LIBADD = \
-       $(LIBNM_GLIB_LIBS)
+       $(LIBNM_LIBS)
 
 libnm_openvpn_common_old_la_LIBADD = \
        $(LIBNM_GLIB_LIBS)
diff --git a/common/utils.c b/common/utils.c
index 1c557f7..3cdfbe2 100644
--- a/common/utils.c
+++ b/common/utils.c
@@ -20,7 +20,11 @@
  */
 
 #include <string.h>
+#ifdef NM_OPENVPN_OLD
 #include <nm-setting-8021x.h>
+#else
+#include <NetworkManager.h>
+#endif
 #include "utils.h"
 
 gboolean
diff --git a/configure.ac b/configure.ac
index 5c896a9..e40fdd4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,11 +62,11 @@ GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32"
 
 PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.74)
 
-       NetworkManager >= 0.9.10
-       libnm-util >= 0.9.10
-       libnm-glib >= 0.9.10
-       libnm-glib-vpn >= 0.9.10)
 PKG_CHECK_MODULES(LIBNM_GLIB,
+       NetworkManager >= 1.1.0
+       libnm-util >= 1.1.0
+       libnm-glib >= 1.1.0
+       libnm-glib-vpn >= 1.1.0)
 LIBNM_GLIB_CFLAGS="$LIBNM_GLIB_CFLAGS -DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_1_0"
 LIBNM_GLIB_CFLAGS="$LIBNM_GLIB_CFLAGS -DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_1_0"
 
diff --git a/nm-openvpn-service.name.in b/nm-openvpn-service.name.in
index f4cce87..6329b1b 100644
--- a/nm-openvpn-service.name.in
+++ b/nm-openvpn-service.name.in
@@ -3,9 +3,11 @@ name=openvpn
 service=org.freedesktop.NetworkManager.openvpn
 program= LIBEXECDIR@/nm-openvpn-service
 
+[libnm]
+plugin= PLUGINDIR@/libnm-openvpn-properties
+
 [GNOME]
 auth-dialog= LIBEXECDIR@/nm-openvpn-auth-dialog
-properties= PLUGINDIR@/libnm-openvpn-properties
+properties= PLUGINDIR@/libnm-openvpn-properties-old
 supports-external-ui-mode=true
 supports-hints=true
-
diff --git a/properties/Makefile.am b/properties/Makefile.am
index 1dfd93b..861b9e3 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -28,8 +28,8 @@ common_CFLAGS =                                         \
 
 libnm_openvpn_properties_la_CFLAGS =                    \
         $(common_CFLAGS)                                \
-        $(LIBNM_GLIB_CFLAGS)                            \
-        $(LIBNM_GTK_CFLAGS)
+        $(LIBNM_CFLAGS)                                 \
+        $(LIBNMA_CFLAGS)
 
 libnm_openvpn_properties_old_la_CFLAGS =                \
         -DNM_OPENVPN_OLD                                \
@@ -39,8 +39,8 @@ libnm_openvpn_properties_old_la_CFLAGS =                \
 
 libnm_openvpn_properties_la_LIBADD =                    \
         $(GTK_LIBS)                                     \
-        $(LIBNM_GLIB_LIBS)                              \
-        $(LIBNM_GTK_LIBS)                               \
+        $(LIBNM_LIBS)                                   \
+        $(LIBNMA_LIBS)                                  \
         $(top_builddir)/common/libnm-openvpn-common.la
 
 libnm_openvpn_properties_old_la_LIBADD =                \
diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index 942771e..e1bddc7 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -34,14 +34,23 @@
 #include <errno.h>
 
 #include <glib/gi18n-lib.h>
+
+#ifdef NM_OPENVPN_OLD
+#define NM_VPN_LIBNM_COMPAT
 #include <nm-setting-connection.h>
 #include <nm-setting-8021x.h>
 #include <nm-utils.h>
 #include <nm-ui-utils.h>
 
+#else /* !NM_OPENVPN_OLD */
+
+#include <NetworkManager.h>
+#include <nma-ui-utils.h>
+#endif
+
 #include "auth-helpers.h"
 #include "nm-openvpn.h"
-#include "../src/nm-openvpn-service.h"
+#include "../src/nm-openvpn-service-defines.h"
 #include "../common/utils.h"
 
 #define BLOCK_HANDLER_ID "block-handler-id"
@@ -55,7 +64,7 @@ show_password (GtkToggleButton *togglebutton, GtkEntry *password_entry)
 static GtkWidget *
 setup_secret_widget (GtkBuilder *builder,
                      const char *widget_name,
-                     NMSettingVPN *s_vpn,
+                     NMSettingVpn *s_vpn,
                      const char *secret_key)
 {
        GtkWidget *widget;
@@ -148,7 +157,7 @@ tls_cert_changed_cb (GtkWidget *widget, gpointer data)
 static void
 tls_setup (GtkBuilder *builder,
            GtkSizeGroup *group,
-           NMSettingVPN *s_vpn,
+           NMSettingVpn *s_vpn,
            const char *prefix,
            GtkWidget *ca_chooser,
            ChangedCallback changed_cb,
@@ -234,7 +243,7 @@ tls_setup (GtkBuilder *builder,
 static void
 pw_setup (GtkBuilder *builder,
           GtkSizeGroup *group,
-          NMSettingVPN *s_vpn,
+          NMSettingVpn *s_vpn,
           const char *prefix,
           ChangedCallback changed_cb,
           gpointer user_data)
@@ -269,7 +278,7 @@ pw_setup (GtkBuilder *builder,
 void
 tls_pw_init_auth_widget (GtkBuilder *builder,
                          GtkSizeGroup *group,
-                         NMSettingVPN *s_vpn,
+                         NMSettingVpn *s_vpn,
                          const char *contype,
                          const char *prefix,
                          ChangedCallback changed_cb,
@@ -326,7 +335,7 @@ tls_pw_init_auth_widget (GtkBuilder *builder,
 void
 sk_init_auth_widget (GtkBuilder *builder,
                      GtkSizeGroup *group,
-                     NMSettingVPN *s_vpn,
+                     NMSettingVpn *s_vpn,
                      ChangedCallback changed_cb,
                      gpointer user_data)
 {
@@ -566,7 +575,7 @@ update_from_filechooser (GtkBuilder *builder,
                          const char *key,
                          const char *prefix,
                          const char *widget_name,
-                         NMSettingVPN *s_vpn)
+                         NMSettingVpn *s_vpn)
 {
        GtkWidget *widget;
        char *tmp, *filename;
@@ -588,7 +597,7 @@ update_from_filechooser (GtkBuilder *builder,
 }
 
 static void
-update_tls (GtkBuilder *builder, const char *prefix, NMSettingVPN *s_vpn)
+update_tls (GtkBuilder *builder, const char *prefix, NMSettingVpn *s_vpn)
 {
        GtkWidget *widget;
        NMSettingSecretFlags pw_flags;
@@ -614,7 +623,7 @@ update_tls (GtkBuilder *builder, const char *prefix, NMSettingVPN *s_vpn)
 }
 
 static void
-update_pw (GtkBuilder *builder, const char *prefix, NMSettingVPN *s_vpn)
+update_pw (GtkBuilder *builder, const char *prefix, NMSettingVpn *s_vpn)
 {
        GtkWidget *widget;
        NMSettingSecretFlags pw_flags;
@@ -651,7 +660,7 @@ update_pw (GtkBuilder *builder, const char *prefix, NMSettingVPN *s_vpn)
 gboolean
 auth_widget_update_connection (GtkBuilder *builder,
                                const char *contype,
-                               NMSettingVPN *s_vpn)
+                               NMSettingVpn *s_vpn)
 {
        GtkTreeModel *model;
        GtkTreeIter iter;
@@ -920,7 +929,7 @@ advanced_dialog_new_hash_from_connection (NMConnection *connection,
                                           GError **error)
 {
        GHashTable *hash;
-       NMSettingVPN *s_vpn;
+       NMSettingVpn *s_vpn;
        const char *secret, *flags;
 
        hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
diff --git a/properties/auth-helpers.h b/properties/auth-helpers.h
index 1c298e0..88b1529 100644
--- a/properties/auth-helpers.h
+++ b/properties/auth-helpers.h
@@ -25,14 +25,18 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 
+#ifdef NM_OPENVPN_OLD
 #include <nm-connection.h>
 #include <nm-setting-vpn.h>
+#else /* !NM_OPENVPN_OLD */
+#include <NetworkManager.h>
+#endif
 
 typedef void (*ChangedCallback) (GtkWidget *widget, gpointer user_data);
 
 void tls_pw_init_auth_widget (GtkBuilder *builder,
                               GtkSizeGroup *group,
-                              NMSettingVPN *s_vpn,
+                              NMSettingVpn *s_vpn,
                               const char *contype,
                               const char *prefix,
                               ChangedCallback changed_cb,
@@ -40,7 +44,7 @@ void tls_pw_init_auth_widget (GtkBuilder *builder,
 
 void sk_init_auth_widget (GtkBuilder *builder,
                           GtkSizeGroup *group,
-                          NMSettingVPN *s_vpn,
+                          NMSettingVpn *s_vpn,
                           ChangedCallback changed_cb,
                           gpointer user_data);
 
@@ -48,7 +52,7 @@ gboolean auth_widget_check_validity (GtkBuilder *builder, const char *contype, G
 
 gboolean auth_widget_update_connection (GtkBuilder *builder,
                                         const char *contype,
-                                        NMSettingVPN *s_vpn);
+                                        NMSettingVpn *s_vpn);
 
 GtkFileFilter *tls_file_chooser_filter_new (gboolean pkcs_allowed);
 
diff --git a/properties/import-export.c b/properties/import-export.c
index 9d1225a..e0f9fd6 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -35,13 +35,20 @@
 
 #include <glib/gi18n-lib.h>
 
+#ifdef NM_OPENVPN_OLD
+#define NM_VPN_LIBNM_COMPAT
 #include <nm-setting-vpn.h>
 #include <nm-setting-connection.h>
 #include <nm-setting-ip4-config.h>
 
+#define nm_simple_connection_new nm_connection_new
+#else /* !NM_OPENVPN_OLD */
+#include <NetworkManager.h>
+#endif
+
 #include "import-export.h"
 #include "nm-openvpn.h"
-#include "../src/nm-openvpn-service.h"
+#include "../src/nm-openvpn-service-defines.h"
 #include "../common/utils.h"
 
 #define AUTH_TAG "auth "
@@ -129,7 +136,7 @@ static gboolean
 handle_path_item (const char *line,
                   const char *tag,
                   const char *key,
-                  NMSettingVPN *s_vpn,
+                  NMSettingVpn *s_vpn,
                   const char *path,
                   char **leftover)
 {
@@ -178,7 +185,7 @@ get_args (const char *line, int *nitems)
 }
 
 static void
-handle_direction (const char *tag, const char *key, char *leftover, NMSettingVPN *s_vpn)
+handle_direction (const char *tag, const char *key, char *leftover, NMSettingVpn *s_vpn)
 {
        glong direction;
 
@@ -288,7 +295,7 @@ do_import (const char *path, char **lines, GError **error)
 {
        NMConnection *connection = NULL;
        NMSettingConnection *s_con;
-       NMSettingVPN *s_vpn;
+       NMSettingVpn *s_vpn;
        char *last_dot;
        char **line;
        gboolean have_client = FALSE, have_remote = FALSE;
@@ -299,7 +306,7 @@ do_import (const char *path, char **lines, GError **error)
        gboolean http_proxy = FALSE, socks_proxy = FALSE, proxy_set = FALSE;
        int nitems;
 
-       connection = nm_connection_new ();
+       connection = nm_simple_connection_new ();
        s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ());
        nm_connection_add_setting (connection, NM_SETTING (s_con));
 
@@ -797,7 +804,7 @@ gboolean
 do_export (const char *path, NMConnection *connection, GError **error)
 {
        NMSettingConnection *s_con;
-       NMSettingVPN *s_vpn;
+       NMSettingVpn *s_vpn;
        FILE *f;
        const char *value;
        const char *gateways = NULL;
diff --git a/properties/import-export.h b/properties/import-export.h
index 1c5fbc9..0293288 100644
--- a/properties/import-export.h
+++ b/properties/import-export.h
@@ -23,7 +23,12 @@
 #define _IMPORT_EXPORT_H_
 
 #include <glib.h>
+
+#ifdef NM_OPENVPN_OLD
 #include <nm-connection.h>
+#else /* !NM_OPENVPN_OLD */
+#include <NetworkManager.h>
+#endif
 
 NMConnection *do_import (const char *path, char **lines, GError **error);
 
diff --git a/properties/nm-openvpn.c b/properties/nm-openvpn.c
index 33dcc63..4c604b4 100644
--- a/properties/nm-openvpn.c
+++ b/properties/nm-openvpn.c
@@ -37,35 +37,51 @@
 #include <string.h>
 #include <gtk/gtk.h>
 
+#ifdef NM_OPENVPN_OLD
+#define NM_VPN_LIBNM_COMPAT
 #include <nm-vpn-plugin-ui-interface.h>
 #include <nm-setting-vpn.h>
 #include <nm-setting-connection.h>
 #include <nm-setting-ip4-config.h>
 
-#include "nm-openvpn-service-defines.h"
+#define OPENVPN_PLUGIN_NAME    _("OpenVPN")
+#define OPENVPN_PLUGIN_DESC    _("Compatible with the OpenVPN server.")
+
+#else /* !NM_OPENVPN_OLD */
+
+#include <NetworkManager.h>
+
+#define OPENVPN_PLUGIN_NAME    _("openvpn")
+#define OPENVPN_PLUGIN_DESC    _("OpenVPN")
+#endif
+
+#include "../src/nm-openvpn-service-defines.h"
 #include "nm-openvpn.h"
 #include "auth-helpers.h"
 #include "import-export.h"
 
-#define OPENVPN_PLUGIN_NAME    _("OpenVPN")
-#define OPENVPN_PLUGIN_DESC    _("Compatible with the OpenVPN server.")
-#define OPENVPN_PLUGIN_SERVICE NM_DBUS_SERVICE_OPENVPN
-
 
 /************** plugin class **************/
 
-static void openvpn_plugin_ui_interface_init (NMVpnPluginUiInterface *iface_class);
+enum {
+       PROP_0,
+       PROP_NAME,
+       PROP_DESC,
+       PROP_SERVICE
+};
+
+static void openvpn_plugin_ui_interface_init (NMVpnEditorPluginInterface *iface_class);
 
 G_DEFINE_TYPE_EXTENDED (OpenvpnPluginUi, openvpn_plugin_ui, G_TYPE_OBJECT, 0,
-                        G_IMPLEMENT_INTERFACE (NM_TYPE_VPN_PLUGIN_UI_INTERFACE,
+                        G_IMPLEMENT_INTERFACE (NM_TYPE_VPN_EDITOR_PLUGIN,
                                                openvpn_plugin_ui_interface_init))
 
 /************** UI widget class **************/
 
-static void openvpn_plugin_ui_widget_interface_init (NMVpnPluginUiWidgetInterface *iface_class);
+static void openvpn_plugin_ui_widget_interface_init (NMVpnEditorInterface *iface_class);
 
 G_DEFINE_TYPE_EXTENDED (OpenvpnPluginUiWidget, openvpn_plugin_ui_widget, G_TYPE_OBJECT, 0,
-                        G_IMPLEMENT_INTERFACE (NM_TYPE_VPN_PLUGIN_UI_WIDGET_INTERFACE,
+                        G_IMPLEMENT_INTERFACE (NM_TYPE_VPN_EDITOR,
                                                openvpn_plugin_ui_widget_interface_init))
 
 #define OPENVPN_PLUGIN_UI_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), 
OPENVPN_TYPE_PLUGIN_UI_WIDGET, OpenvpnPluginUiWidgetPrivate))
@@ -318,7 +334,7 @@ static gboolean
 init_plugin_ui (OpenvpnPluginUiWidget *self, NMConnection *connection, GError **error)
 {
        OpenvpnPluginUiWidgetPrivate *priv = OPENVPN_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
-       NMSettingVPN *s_vpn;
+       NMSettingVpn *s_vpn;
        GtkWidget *widget;
        GtkListStore *store;
        GtkTreeIter iter;
@@ -419,7 +435,7 @@ init_plugin_ui (OpenvpnPluginUiWidget *self, NMConnection *connection, GError **
 }
 
 static GObject *
-get_widget (NMVpnPluginUiWidgetInterface *iface)
+get_widget (NMVpnEditor *iface)
 {
        OpenvpnPluginUiWidget *self = OPENVPN_PLUGIN_UI_WIDGET (iface);
        OpenvpnPluginUiWidgetPrivate *priv = OPENVPN_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
@@ -430,7 +446,7 @@ get_widget (NMVpnPluginUiWidgetInterface *iface)
 static void
 hash_copy_advanced (gpointer key, gpointer data, gpointer user_data)
 {
-       NMSettingVPN *s_vpn = NM_SETTING_VPN (user_data);
+       NMSettingVpn *s_vpn = NM_SETTING_VPN (user_data);
        const char *value = (const char *) data;
 
        g_return_if_fail (value && strlen (value));
@@ -462,13 +478,13 @@ get_auth_type (GtkBuilder *builder)
 }
 
 static gboolean
-update_connection (NMVpnPluginUiWidgetInterface *iface,
+update_connection (NMVpnEditor *iface,
                    NMConnection *connection,
                    GError **error)
 {
        OpenvpnPluginUiWidget *self = OPENVPN_PLUGIN_UI_WIDGET (iface);
        OpenvpnPluginUiWidgetPrivate *priv = OPENVPN_PLUGIN_UI_WIDGET_GET_PRIVATE (self);
-       NMSettingVPN *s_vpn;
+       NMSettingVpn *s_vpn;
        GtkWidget *widget;
        char *str, *auth_type;
        gboolean valid = FALSE;
@@ -534,19 +550,19 @@ is_new_func (const char *key, const char *value, gpointer user_data)
        *is_new = FALSE;
 }
 
-static NMVpnPluginUiWidgetInterface *
+static NMVpnEditor *
 nm_vpn_plugin_ui_widget_interface_new (NMConnection *connection, GError **error)
 {
-       NMVpnPluginUiWidgetInterface *object;
+       NMVpnEditor *object;
        OpenvpnPluginUiWidgetPrivate *priv;
        char *ui_file;
        gboolean new = TRUE;
-       NMSettingVPN *s_vpn;
+       NMSettingVpn *s_vpn;
 
        if (error)
                g_return_val_if_fail (*error == NULL, NULL);
 
-       object = NM_VPN_PLUGIN_UI_WIDGET_INTERFACE (g_object_new (OPENVPN_TYPE_PLUGIN_UI_WIDGET, NULL));
+       object = g_object_new (OPENVPN_TYPE_PLUGIN_UI_WIDGET, NULL);
        if (!object) {
                g_set_error_literal (error, OPENVPN_PLUGIN_UI_ERROR, 0, _("could not create openvpn object"));
                return NULL;
@@ -641,7 +657,7 @@ openvpn_plugin_ui_widget_init (OpenvpnPluginUiWidget *plugin)
 }
 
 static void
-openvpn_plugin_ui_widget_interface_init (NMVpnPluginUiWidgetInterface *iface_class)
+openvpn_plugin_ui_widget_interface_init (NMVpnEditorInterface *iface_class)
 {
        /* interface implementation */
        iface_class->get_widget = get_widget;
@@ -649,7 +665,7 @@ openvpn_plugin_ui_widget_interface_init (NMVpnPluginUiWidgetInterface *iface_cla
 }
 
 static NMConnection *
-import (NMVpnPluginUiInterface *iface, const char *path, GError **error)
+import (NMVpnEditorPlugin *iface, const char *path, GError **error)
 {
        NMConnection *connection = NULL;
        char *contents = NULL;
@@ -707,7 +723,7 @@ out:
 }
 
 static gboolean
-export (NMVpnPluginUiInterface *iface,
+export (NMVpnEditorPlugin *iface,
         const char *path,
         NMConnection *connection,
         GError **error)
@@ -716,7 +732,7 @@ export (NMVpnPluginUiInterface *iface,
 }
 
 static char *
-get_suggested_name (NMVpnPluginUiInterface *iface, NMConnection *connection)
+get_suggested_filename (NMVpnEditorPlugin *iface, NMConnection *connection)
 {
        NMSettingConnection *s_con;
        const char *id;
@@ -733,15 +749,15 @@ get_suggested_name (NMVpnPluginUiInterface *iface, NMConnection *connection)
 }
 
 static guint32
-get_capabilities (NMVpnPluginUiInterface *iface)
+get_capabilities (NMVpnEditorPlugin *iface)
 {
-       return (NM_VPN_PLUGIN_UI_CAPABILITY_IMPORT |
-               NM_VPN_PLUGIN_UI_CAPABILITY_EXPORT |
-               NM_VPN_PLUGIN_UI_CAPABILITY_IPV6);
+       return (NM_VPN_EDITOR_PLUGIN_CAPABILITY_IMPORT |
+               NM_VPN_EDITOR_PLUGIN_CAPABILITY_EXPORT |
+               NM_VPN_EDITOR_PLUGIN_CAPABILITY_IPV6);
 }
 
-static NMVpnPluginUiWidgetInterface *
-ui_factory (NMVpnPluginUiInterface *iface, NMConnection *connection, GError **error)
+static NMVpnEditor *
+get_editor (NMVpnEditorPlugin *iface, NMConnection *connection, GError **error)
 {
        return nm_vpn_plugin_ui_widget_interface_new (connection, error);
 }
@@ -751,14 +767,14 @@ get_property (GObject *object, guint prop_id,
                          GValue *value, GParamSpec *pspec)
 {
        switch (prop_id) {
-       case NM_VPN_PLUGIN_UI_INTERFACE_PROP_NAME:
+       case PROP_NAME:
                g_value_set_string (value, OPENVPN_PLUGIN_NAME);
                break;
-       case NM_VPN_PLUGIN_UI_INTERFACE_PROP_DESC:
+       case PROP_DESC:
                g_value_set_string (value, OPENVPN_PLUGIN_DESC);
                break;
-       case NM_VPN_PLUGIN_UI_INTERFACE_PROP_SERVICE:
-               g_value_set_string (value, OPENVPN_PLUGIN_SERVICE);
+       case PROP_SERVICE:
+               g_value_set_string (value, NM_DBUS_SERVICE_OPENVPN);
                break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -774,16 +790,16 @@ openvpn_plugin_ui_class_init (OpenvpnPluginUiClass *req_class)
        object_class->get_property = get_property;
 
        g_object_class_override_property (object_class,
-                                         NM_VPN_PLUGIN_UI_INTERFACE_PROP_NAME,
-                                         NM_VPN_PLUGIN_UI_INTERFACE_NAME);
+                                         PROP_NAME,
+                                         NM_VPN_EDITOR_PLUGIN_NAME);
 
        g_object_class_override_property (object_class,
-                                         NM_VPN_PLUGIN_UI_INTERFACE_PROP_DESC,
-                                         NM_VPN_PLUGIN_UI_INTERFACE_DESC);
+                                         PROP_DESC,
+                                         NM_VPN_EDITOR_PLUGIN_DESCRIPTION);
 
        g_object_class_override_property (object_class,
-                                         NM_VPN_PLUGIN_UI_INTERFACE_PROP_SERVICE,
-                                         NM_VPN_PLUGIN_UI_INTERFACE_SERVICE);
+                                         PROP_SERVICE,
+                                         NM_VPN_EDITOR_PLUGIN_SERVICE);
 }
 
 static void
@@ -792,19 +808,19 @@ openvpn_plugin_ui_init (OpenvpnPluginUi *plugin)
 }
 
 static void
-openvpn_plugin_ui_interface_init (NMVpnPluginUiInterface *iface_class)
+openvpn_plugin_ui_interface_init (NMVpnEditorPluginInterface *iface_class)
 {
        /* interface implementation */
-       iface_class->ui_factory = ui_factory;
+       iface_class->get_editor = get_editor;
        iface_class->get_capabilities = get_capabilities;
        iface_class->import_from_file = import;
        iface_class->export_to_file = export;
-       iface_class->get_suggested_name = get_suggested_name;
+       iface_class->get_suggested_filename = get_suggested_filename;
 }
 
 
-G_MODULE_EXPORT NMVpnPluginUiInterface *
-nm_vpn_plugin_ui_factory (GError **error)
+G_MODULE_EXPORT NMVpnEditorPlugin *
+nm_vpn_editor_plugin_factory (GError **error)
 {
        if (error)
                g_return_val_if_fail (*error == NULL, NULL);
@@ -812,6 +828,6 @@ nm_vpn_plugin_ui_factory (GError **error)
        bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 
-       return NM_VPN_PLUGIN_UI_INTERFACE (g_object_new (OPENVPN_TYPE_PLUGIN_UI, NULL));
+       return g_object_new (OPENVPN_TYPE_PLUGIN_UI, NULL);
 }
 
diff --git a/properties/tests/test-import-export.c b/properties/tests/test-import-export.c
index 1d783bc..a6b714a 100644
--- a/properties/tests/test-import-export.c
+++ b/properties/tests/test-import-export.c
@@ -32,7 +32,7 @@
 
 #include "nm-test-helpers.h"
 #include "properties/nm-openvpn.h"
-#include "src/nm-openvpn-service.h"
+#include "src/nm-openvpn-service-defines.h"
 
 static NMConnection *
 get_basic_connection (const char *detail,


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