[network-manager-fortisslvpn/th/gtk-split-and-log-bgo771544: 14/25] properties: split GTK dependent editor plugin



commit 1b0dc3e292e97ed5e06982cbf116dd5b87572935
Author: Thomas Haller <thaller redhat com>
Date:   Fri Sep 16 14:44:53 2016 +0200

    properties: split GTK dependent editor plugin

 Makefile.am                                        |    4 +-
 configure.ac                                       |    4 +-
 properties/Makefile.am                             |   53 +++++++++++++++++---
 properties/libnm-fortisslvpn-properties.ver        |    6 ++
 properties/libnm-vpn-plugin-fortisslvpn-editor.ver |    6 ++
 properties/libnm-vpn-plugin-fortisslvpn.ver        |    6 ++
 properties/nm-fortisslvpn-editor-plugin.c          |   36 +++++++++++++-
 properties/nm-fortisslvpn-editor-plugin.h          |    9 +++
 properties/nm-fortisslvpn-editor.c                 |   17 ++++++
 9 files changed, 129 insertions(+), 12 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 690bed8..14b01be 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,9 +1,9 @@
 AUTOMAKE_OPTIONS = foreign
 
-SUBDIRS = shared src
+SUBDIRS = shared src properties
 
 if WITH_GNOME
-SUBDIRS += auth-dialog properties po
+SUBDIRS += auth-dialog po
 endif
 
 dbusservicedir = $(sysconfdir)/dbus-1/system.d
diff --git a/configure.ac b/configure.ac
index 99f0141..05e6d77 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ AC_INIT(NetworkManager-fortisslvpn,
         1.2.3,
         https://bugzilla.gnome.org/enter_bug.cgi?product=NetworkManager,
         NetworkManager-fortisslvpn)
-AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-xz subdir-objects])
+AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-xz])
 AM_MAINTAINER_MODE
 
 AC_CONFIG_MACRO_DIR([m4])
@@ -53,6 +53,8 @@ AC_CHECK_FUNCS(select socket uname)
 
 GIT_SHA_RECORD(NM_GIT_SHA)
 
+AC_SEARCH_LIBS([dlopen], [dl dld], [], [ac_cv_search_dlopen=])
+AC_SUBST([DL_LIBS], "$ac_cv_search_dlopen")
 
 dnl
 dnl GNOME support
diff --git a/properties/Makefile.am b/properties/Makefile.am
index dcf6a26..30c72e8 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -1,9 +1,12 @@
 plugindir = $(libdir)/NetworkManager
 
 plugin_LTLIBRARIES = libnm-vpn-plugin-fortisslvpn.la
+if WITH_GNOME
+plugin_LTLIBRARIES += libnm-vpn-plugin-fortisslvpn-editor.la
 if WITH_LIBNM_GLIB
 plugin_LTLIBRARIES += libnm-fortisslvpn-properties.la
 endif
+endif
 
 shared_sources = \
     $(top_srcdir)/shared/nm-service-defines.h \
@@ -11,12 +14,16 @@ shared_sources = \
 
 plugin_sources = \
     nm-fortisslvpn-editor-plugin.c \
-    nm-fortisslvpn-editor-plugin.h \
+    nm-fortisslvpn-editor-plugin.h
+
+editor_sources = \
     nm-fortisslvpn-editor.c \
     nm-fortisslvpn-editor.h
 
 uidir = $(datadir)/gnome-vpn-properties/fortisslvpn
+if WITH_GNOME
 ui_DATA = nm-fortisslvpn-dialog.ui
+endif
 
 common_CFLAGS = \
     $(GLIB_CFLAGS) \
@@ -29,29 +36,55 @@ common_CFLAGS = \
 
 libnm_vpn_plugin_fortisslvpn_la_SOURCES = \
     $(shared_sources) \
+    $(top_srcdir)/shared/nm-utils/nm-vpn-plugin-utils.c \
+    $(top_srcdir)/shared/nm-utils/nm-vpn-plugin-utils.h \
     $(plugin_sources)
 
 libnm_vpn_plugin_fortisslvpn_la_CFLAGS = \
-    -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \
+    -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_BASE \
+    -DNM_PLUGIN_DIR=\"$(NM_PLUGIN_DIR)\" \
+    $(common_CFLAGS) \
+    $(LIBNM_CFLAGS) \
+    $(NULL)
+
+libnm_vpn_plugin_fortisslvpn_la_LIBADD = \
+    $(LIBNM_LIBS) \
+    $(DL_LIBS) \
+    $(NULL)
+
+libnm_vpn_plugin_fortisslvpn_la_LDFLAGS = \
+    -avoid-version \
+    -Wl,--version-script=$(srcdir)/libnm-vpn-plugin-fortisslvpn.ver
+
+###############################################################################
+
+libnm_vpn_plugin_fortisslvpn_editor_la_SOURCES = \
+    $(shared_sources) \
+    $(editor_sources)
+
+libnm_vpn_plugin_fortisslvpn_editor_la_CFLAGS = \
+    -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_EDITOR \
     $(common_CFLAGS) \
     $(GTK_CFLAGS) \
     $(LIBNM_CFLAGS) \
     $(LIBNMA_CFLAGS) \
     $(NULL)
 
-libnm_vpn_plugin_fortisslvpn_la_LIBADD = \
+libnm_vpn_plugin_fortisslvpn_editor_la_LIBADD = \
     $(GTK_LIBS) \
     $(LIBNM_LIBS) \
     $(LIBNMA_LIBS)
 
-libnm_vpn_plugin_fortisslvpn_la_LDFLAGS = \
-    -avoid-version
+libnm_vpn_plugin_fortisslvpn_editor_la_LDFLAGS = \
+    -avoid-version \
+    -Wl,--version-script=$(srcdir)/libnm-vpn-plugin-fortisslvpn-editor.ver
 
 ###############################################################################
 
 libnm_fortisslvpn_properties_la_SOURCES = \
     $(shared_sources) \
-    $(plugin_sources)
+    $(plugin_sources) \
+    $(editor_sources)
 
 libnm_fortisslvpn_properties_la_CFLAGS = \
     -DNM_VPN_OLD \
@@ -68,11 +101,15 @@ libnm_fortisslvpn_properties_la_LIBADD = \
     $(LIBNM_GTK_LIBS)
 
 libnm_fortisslvpn_properties_la_LDFLAGS = \
-    -avoid-version
+    -avoid-version \
+    -Wl,--version-script=$(srcdir)/libnm-fortisslvpn-properties.ver
 
 ###############################################################################
 
 CLEANFILES = *.bak *~
 
 EXTRA_DIST = \
-    $(ui_DATA)
+    libnm-vpn-plugin-fortisslvpn.ver \
+    libnm-vpn-plugin-fortisslvpn-editor.ver \
+    libnm-fortisslvpn-properties.ver \
+    nm-fortisslvpn-dialog.ui
diff --git a/properties/libnm-fortisslvpn-properties.ver b/properties/libnm-fortisslvpn-properties.ver
new file mode 100644
index 0000000..271c506
--- /dev/null
+++ b/properties/libnm-fortisslvpn-properties.ver
@@ -0,0 +1,6 @@
+{
+global:
+       nm_vpn_plugin_ui_factory;
+local:
+       *;
+};
diff --git a/properties/libnm-vpn-plugin-fortisslvpn-editor.ver 
b/properties/libnm-vpn-plugin-fortisslvpn-editor.ver
new file mode 100644
index 0000000..763e9d4
--- /dev/null
+++ b/properties/libnm-vpn-plugin-fortisslvpn-editor.ver
@@ -0,0 +1,6 @@
+{
+global:
+       nm_vpn_editor_factory_fortisslvpn;
+local:
+       *;
+};
diff --git a/properties/libnm-vpn-plugin-fortisslvpn.ver b/properties/libnm-vpn-plugin-fortisslvpn.ver
new file mode 100644
index 0000000..92a7b14
--- /dev/null
+++ b/properties/libnm-vpn-plugin-fortisslvpn.ver
@@ -0,0 +1,6 @@
+{
+global:
+       nm_vpn_editor_plugin_factory;
+local:
+       *;
+};
diff --git a/properties/nm-fortisslvpn-editor-plugin.c b/properties/nm-fortisslvpn-editor-plugin.c
index b16228d..67b97f4 100644
--- a/properties/nm-fortisslvpn-editor-plugin.c
+++ b/properties/nm-fortisslvpn-editor-plugin.c
@@ -29,7 +29,11 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef NM_VPN_OLD
 #include "nm-fortisslvpn-editor.h"
+#else
+#include "nm-utils/nm-vpn-plugin-utils.h"
+#endif
 
 #define FORTISSLVPN_PLUGIN_NAME    _("Fortinet SSLVPN")
 #define FORTISSLVPN_PLUGIN_DESC    _("Compatible with Fortinet SSLVPN servers.")
@@ -58,10 +62,40 @@ get_capabilities (NMVpnEditorPlugin *iface)
        return NM_VPN_EDITOR_PLUGIN_CAPABILITY_NONE;
 }
 
+#ifndef NM_VPN_OLD
+static NMVpnEditor *
+_call_editor_factory (gpointer factory,
+                      NMVpnEditorPlugin *editor_plugin,
+                      NMConnection *connection,
+                      gpointer user_data,
+                      GError **error)
+{
+       return ((NMVpnEditorFactory) factory) (editor_plugin,
+                                              connection,
+                                              error);
+}
+#endif
+
 static NMVpnEditor *
 get_editor (NMVpnEditorPlugin *iface, NMConnection *connection, GError **error)
 {
-       return nm_fortisslvpn_editor_new (connection, error);
+       g_return_val_if_fail (FORTISSLVPN_IS_EDITOR_PLUGIN (iface), NULL);
+       g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
+       g_return_val_if_fail (!error || !*error, NULL);
+
+       {
+#ifdef NM_VPN_OLD
+               return nm_fortisslvpn_editor_new (connection, error);
+#else
+               return nm_vpn_plugin_utils_load_editor 
(NM_PLUGIN_DIR"/libnm-vpn-plugin-fortisslvpn-editor.so",
+                                                       "nm_vpn_editor_factory_fortisslvpn",
+                                                       _call_editor_factory,
+                                                       iface,
+                                                       connection,
+                                                       NULL,
+                                                       error);
+#endif
+       }
 }
 
 static void
diff --git a/properties/nm-fortisslvpn-editor-plugin.h b/properties/nm-fortisslvpn-editor-plugin.h
index 36da55d..292f7b3 100644
--- a/properties/nm-fortisslvpn-editor-plugin.h
+++ b/properties/nm-fortisslvpn-editor-plugin.h
@@ -40,4 +40,13 @@ struct _FortisslvpnEditorPluginClass {
 
 GType fortisslvpn_editor_plugin_get_type (void);
 
+typedef NMVpnEditor *(*NMVpnEditorFactory) (NMVpnEditorPlugin *editor_plugin,
+                                            NMConnection *connection,
+                                            GError **error);
+
+NMVpnEditor *
+nm_vpn_editor_factory_fortisslvpn (NMVpnEditorPlugin *editor_plugin,
+                                   NMConnection *connection,
+                                   GError **error);
+
 #endif /* __NM_FORTISSLVPN_EDITOR_PLUGIN_H__ */
diff --git a/properties/nm-fortisslvpn-editor.c b/properties/nm-fortisslvpn-editor.c
index b672de2..2476054 100644
--- a/properties/nm-fortisslvpn-editor.c
+++ b/properties/nm-fortisslvpn-editor.c
@@ -542,3 +542,20 @@ fortisslvpn_editor_interface_init (NMVpnEditorInterface *iface_class)
        iface_class->get_widget = get_widget;
        iface_class->update_connection = update_connection;
 }
+
+/*****************************************************************************/
+
+#ifndef NM_VPN_OLD
+
+#include "nm-fortisslvpn-editor-plugin.h"
+
+G_MODULE_EXPORT NMVpnEditor *
+nm_vpn_editor_factory_fortisslvpn (NMVpnEditorPlugin *editor_plugin,
+                                   NMConnection *connection,
+                                   GError **error)
+{
+       g_return_val_if_fail (!error || !*error, NULL);
+
+       return nm_fortisslvpn_editor_new (connection, error);
+}
+#endif


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