[network-manager-openvpn/th/include-cleanup] properties: split libnm-vpn-plugin-openvpn.so in two libraries



commit 84cb5a8bdd7a3eda66de4f060b33d3124d1ef00d
Author: Thomas Haller <thaller redhat com>
Date:   Thu Apr 28 21:19:44 2016 +0200

    properties: split libnm-vpn-plugin-openvpn.so in two libraries
    
    Split "libnm-vpn-plugin-openvpn-editor.so" out of "libnm-vpn-plugin-openvpn.so".
    The new library contains the GTK dependent code, making the remaining
    core plugin independent of the GUI.
    
    This requires a new libnm, which supports loading of separate editor
    plugins.

 nm-openvpn-service.name.in                     |    1 +
 properties/Makefile.am                         |   48 ++++++++++++++++++-----
 properties/auth-helpers.c                      |    1 -
 properties/libnm-vpn-plugin-openvpn-editor.ver |    6 +++
 properties/nm-openvpn-editor-plugin.c          |    9 +++-
 properties/nm-openvpn-editor.c                 |   16 +++++++-
 6 files changed, 66 insertions(+), 15 deletions(-)
---
diff --git a/nm-openvpn-service.name.in b/nm-openvpn-service.name.in
index 973fa0a..a8abc77 100644
--- a/nm-openvpn-service.name.in
+++ b/nm-openvpn-service.name.in
@@ -8,6 +8,7 @@ supports-multiple-connections=true
 plugin= PLUGINDIR@/libnm-vpn-plugin-openvpn.so
 
 [GNOME]
+editor-plugin= PLUGINDIR@/libnm-vpn-plugin-openvpn-editor.so
 auth-dialog= LIBEXECDIR@/nm-openvpn-auth-dialog
 properties= PLUGINDIR@/libnm-openvpn-properties
 supports-external-ui-mode=true
diff --git a/properties/Makefile.am b/properties/Makefile.am
index 2270024..4ad32a5 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -1,7 +1,9 @@
 SUBDIRS = . tests
 
 plugindir = $(libdir)/NetworkManager
-plugin_LTLIBRARIES = libnm-vpn-plugin-openvpn.la
+plugin_LTLIBRARIES = \
+    libnm-vpn-plugin-openvpn.la \
+    libnm-vpn-plugin-openvpn-editor.la
 if WITH_LIBNM_GLIB
 plugin_LTLIBRARIES += libnm-openvpn-properties.la
 endif
@@ -9,21 +11,21 @@ endif
 plugin_sources = \
         nm-openvpn-editor-plugin.c \
         nm-openvpn-editor-plugin.h \
+        import-export.c \
+        import-export.h
+
+editor_sources = \
         nm-openvpn-editor.c \
         nm-openvpn-editor.h \
         auth-helpers.c \
-        auth-helpers.h \
-        import-export.c \
-        import-export.h
+        auth-helpers.h
 
 uidir = $(datadir)/gnome-vpn-properties/openvpn
 ui_DATA = nm-openvpn-dialog.ui
 
 common_CFLAGS =                                         \
         $(GLIB_CFLAGS)                                  \
-        $(GTK_CFLAGS)                                   \
         -I$(top_srcdir)/shared                          \
-        -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \
         -DICONDIR=\""$(datadir)/pixmaps"\"              \
         -DUIDIR=\""$(uidir)"\"                          \
         -DLOCALEDIR=\"$(datadir)/locale\"
@@ -35,13 +37,11 @@ libnm_vpn_plugin_openvpn_la_SOURCES = \
 
 libnm_vpn_plugin_openvpn_la_CFLAGS =                    \
         $(common_CFLAGS)                                \
-        $(LIBNM_CFLAGS)                                 \
-        $(LIBNMA_CFLAGS)
+        -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_BASE \
+        $(LIBNM_CFLAGS)
 
 libnm_vpn_plugin_openvpn_la_LIBADD =                    \
-        $(GTK_LIBS)                                     \
         $(LIBNM_LIBS)                                   \
-        $(LIBNMA_LIBS)                                  \
         $(top_builddir)/shared/libnm-vpn-plugin-openvpn-shared.la
 
 libnm_vpn_plugin_openvpn_la_LDFLAGS = \
@@ -50,12 +50,37 @@ libnm_vpn_plugin_openvpn_la_LDFLAGS = \
 
 ###############################################################################
 
+libnm_vpn_plugin_openvpn_editor_la_SOURCES = \
+        $(editor_sources)
+
+libnm_vpn_plugin_openvpn_editor_la_CFLAGS = \
+        $(common_CFLAGS) \
+        $(GTK_CFLAGS) \
+        -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_EDITOR \
+        $(LIBNM_CFLAGS) \
+        $(LIBNMA_CFLAGS)
+
+libnm_vpn_plugin_openvpn_editor_la_LIBADD = \
+        $(GTK_LIBS) \
+        $(LIBNM_LIBS) \
+        $(LIBNMA_LIBS) \
+        $(top_builddir)/shared/libnm-vpn-plugin-openvpn-shared.la
+
+libnm_vpn_plugin_openvpn_editor_la_LDFLAGS = \
+        -avoid-version \
+        -Wl,--version-script=$(srcdir)/libnm-vpn-plugin-openvpn-editor.ver
+
+###############################################################################
+
 libnm_openvpn_properties_la_SOURCES = \
-        $(plugin_sources)
+        $(plugin_sources) \
+        $(editor_sources)
 
 libnm_openvpn_properties_la_CFLAGS =                \
         -DNM_OPENVPN_OLD \
         $(common_CFLAGS)                                \
+        $(GTK_CFLAGS) \
+        -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \
         $(LIBNM_GLIB_CFLAGS)                            \
         $(LIBNM_GTK_CFLAGS)
 
@@ -95,6 +120,7 @@ CLEANFILES = *.bak *~
 
 EXTRA_DIST = \
         libnm-vpn-plugin-openvpn.ver \
+        libnm-vpn-plugin-openvpn-editor.ver \
         libnm-openvpn-properties.ver \
         $(ui_DATA)
 
diff --git a/properties/auth-helpers.c b/properties/auth-helpers.c
index c56fc0d..746709b 100644
--- a/properties/auth-helpers.c
+++ b/properties/auth-helpers.c
@@ -33,7 +33,6 @@
 #include <unistd.h>
 #include <errno.h>
 
-#include "nm-openvpn-editor.h"
 #include "utils.h"
 
 #define BLOCK_HANDLER_ID "block-handler-id"
diff --git a/properties/libnm-vpn-plugin-openvpn-editor.ver b/properties/libnm-vpn-plugin-openvpn-editor.ver
new file mode 100644
index 0000000..36f1d97
--- /dev/null
+++ b/properties/libnm-vpn-plugin-openvpn-editor.ver
@@ -0,0 +1,6 @@
+{
+global:
+       nm_vpn_editor_factory;
+local:
+       *;
+};
diff --git a/properties/nm-openvpn-editor-plugin.c b/properties/nm-openvpn-editor-plugin.c
index 50c7fb2..4b21077 100644
--- a/properties/nm-openvpn-editor-plugin.c
+++ b/properties/nm-openvpn-editor-plugin.c
@@ -33,8 +33,10 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "auth-helpers.h"
+#ifdef NM_OPENVPN_OLD
 #include "nm-openvpn-editor.h"
+#endif
+
 #include "import-export.h"
 
 #define OPENVPN_PLUGIN_NAME    _("OpenVPN")
@@ -122,11 +124,13 @@ get_capabilities (NMVpnEditorPlugin *iface)
                NM_VPN_EDITOR_PLUGIN_CAPABILITY_IPV6);
 }
 
+#ifdef NM_OPENVPN_OLD
 static NMVpnEditor *
 get_editor (NMVpnEditorPlugin *iface, NMConnection *connection, GError **error)
 {
        return openvpn_editor_new (connection, error);
 }
+#endif
 
 /*****************************************************************************/
 
@@ -158,8 +162,9 @@ openvpn_editor_plugin_init (OpenvpnEditorPlugin *plugin)
 static void
 openvpn_editor_plugin_interface_init (NMVpnEditorPluginInterface *iface_class)
 {
-       /* interface implementation */
+#ifdef NM_OPENVPN_OLD
        iface_class->get_editor = get_editor;
+#endif
        iface_class->get_capabilities = get_capabilities;
        iface_class->import_from_file = import;
        iface_class->export_to_file = export;
diff --git a/properties/nm-openvpn-editor.c b/properties/nm-openvpn-editor.c
index d1d1c9c..b1e06dd 100644
--- a/properties/nm-openvpn-editor.c
+++ b/properties/nm-openvpn-editor.c
@@ -37,7 +37,6 @@
 #include <gtk/gtk.h>
 
 #include "auth-helpers.h"
-#include "import-export.h"
 
 /*****************************************************************************/
 
@@ -593,3 +592,18 @@ openvpn_editor_plugin_widget_class_init (OpenvpnEditorClass *req_class)
        object_class->dispose = dispose;
 }
 
+/*****************************************************************************/
+
+#ifndef NM_OPENVPN_OLD
+G_MODULE_EXPORT NMVpnEditor *
+nm_vpn_editor_factory (NMVpnEditorPlugin *editor_plugin,
+                       NMConnection *connection,
+                       NMVpnEditorLoadData *load_data,
+                       GError **error)
+{
+       g_return_val_if_fail (!error || !*error, NULL);
+
+       return openvpn_editor_new (connection, error);
+}
+#endif
+


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