[network-manager-libreswan/th/vpn-editor-split-bgo766623: 17/18] properties: split GTK dependent editor plugin
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-libreswan/th/vpn-editor-split-bgo766623: 17/18] properties: split GTK dependent editor plugin
- Date: Wed, 18 May 2016 19:03:49 +0000 (UTC)
commit 2ab53429f9c4001a1824b2210c368d04b4e06fd4
Author: Thomas Haller <thaller redhat com>
Date: Tue May 10 15:51:37 2016 +0200
properties: split GTK dependent editor plugin
Makefile.am | 4 +-
properties/Makefile.am | 43 +++++++++++++++++-----
properties/libnm-vpn-plugin-libreswan-editor.ver | 6 +++
properties/nm-libreswan-editor-plugin.c | 36 ++++++++++++++++++-
properties/nm-libreswan-editor-plugin.h | 8 ++++
properties/nm-libreswan-editor.c | 17 +++++++++
6 files changed, 102 insertions(+), 12 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 6173068..c63f238 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,9 +1,9 @@
AUTOMAKE_OPTIONS = foreign
-SUBDIRS = shared src
+SUBDIRS = shared properties src
if WITH_GNOME
-SUBDIRS += auth-dialog properties po
+SUBDIRS += auth-dialog po
endif
dbusservicedir = $(sysconfdir)/dbus-1/system.d
diff --git a/properties/Makefile.am b/properties/Makefile.am
index f1030e2..101bd83 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -1,8 +1,11 @@
plugindir = $(libdir)/NetworkManager
plugin_LTLIBRARIES = libnm-vpn-plugin-libreswan.la
+if WITH_GNOME
+plugin_LTLIBRARIES += libnm-vpn-plugin-libreswan-editor.la
if WITH_LIBNM_GLIB
plugin_LTLIBRARIES += libnm-libreswan-properties.la
endif
+endif
plugin_sources = \
nm-libreswan-editor-plugin.c \
@@ -13,11 +16,12 @@ editor_sources = \
nm-libreswan-editor.h
uidir = $(datadir)/gnome-vpn-properties/libreswan
+if WITH_GNOME
ui_DATA = nm-libreswan-dialog.ui
+endif
common_CFLAGS = \
$(GLIB_CFLAGS) \
- $(GTK_CFLAGS) \
-I"$(top_srcdir)/shared/" \
-DICONDIR=\""$(datadir)/pixmaps"\" \
-DUIDIR=\""$(uidir)"\" \
@@ -26,20 +30,18 @@ common_CFLAGS = \
###############################################################################
libnm_vpn_plugin_libreswan_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) \
- $(LIBNMA_CFLAGS)
+ $(LIBNM_CFLAGS)
libnm_vpn_plugin_libreswan_la_SOURCES = \
- $(plugin_sources) \
- $(editor_sources)
+ $(plugin_sources)
libnm_vpn_plugin_libreswan_la_LIBADD = \
- $(GTK_LIBS) \
$(LIBNM_LIBS) \
- $(LIBNMA_LIBS) \
- $(top_builddir)/shared/libnm-vpn-plugin-libreswan-shared.la
+ $(top_builddir)/shared/libnm-vpn-plugin-libreswan-shared.la \
+ $(top_builddir)/shared/libnm-vpn-editor-utils-shared.la
libnm_vpn_plugin_libreswan_la_LDFLAGS = \
-avoid-version \
@@ -47,10 +49,32 @@ libnm_vpn_plugin_libreswan_la_LDFLAGS = \
###############################################################################
+libnm_vpn_plugin_libreswan_editor_la_CFLAGS = \
+ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_EDITOR \
+ $(common_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(LIBNM_CFLAGS) \
+ $(LIBNMA_CFLAGS)
+
+libnm_vpn_plugin_libreswan_editor_la_SOURCES = \
+ $(editor_sources)
+
+libnm_vpn_plugin_libreswan_editor_la_LIBADD = \
+ $(GTK_LIBS) \
+ $(LIBNM_LIBS) \
+ $(LIBNMA_LIBS)
+
+libnm_vpn_plugin_libreswan_editor_la_LDFLAGS = \
+ -avoid-version \
+ -Wl,--version-script="$(srcdir)/libnm-vpn-plugin-libreswan-editor.ver"
+
+###############################################################################
+
libnm_libreswan_properties_la_CFLAGS = \
-DNM_VPN_OLD \
-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \
$(common_CFLAGS) \
+ $(GTK_CFLAGS) \
$(LIBNM_GLIB_CFLAGS) \
$(LIBNM_GTK_CFLAGS)
@@ -75,4 +99,5 @@ CLEANFILES = *.bak *~
EXTRA_DIST = \
libnm-libreswan-properties.ver \
libnm-vpn-plugin-libreswan.ver \
+ libnm-vpn-plugin-libreswan-editor.ver \
nm-libreswan-dialog.ui
diff --git a/properties/libnm-vpn-plugin-libreswan-editor.ver
b/properties/libnm-vpn-plugin-libreswan-editor.ver
new file mode 100644
index 0000000..bd1a402
--- /dev/null
+++ b/properties/libnm-vpn-plugin-libreswan-editor.ver
@@ -0,0 +1,6 @@
+{
+global:
+ nm_vpn_editor_factory_libreswan;
+local:
+ *;
+};
diff --git a/properties/nm-libreswan-editor-plugin.c b/properties/nm-libreswan-editor-plugin.c
index 44b0f5b..3c8922f 100644
--- a/properties/nm-libreswan-editor-plugin.c
+++ b/properties/nm-libreswan-editor-plugin.c
@@ -34,7 +34,11 @@
#include "utils.h"
+#ifdef NM_VPN_OLD
#include "nm-libreswan-editor.h"
+#else
+#include "nm-vpn/nm-vpn-plugin-utils.h"
+#endif
#define LIBRESWAN_PLUGIN_NAME _("IPsec based VPN")
#define LIBRESWAN_PLUGIN_DESC _("IPsec based VPN using IKEv1")
@@ -112,10 +116,40 @@ get_capabilities (NMVpnEditorPlugin *iface)
return NM_VPN_EDITOR_PLUGIN_CAPABILITY_EXPORT | NM_VPN_EDITOR_PLUGIN_CAPABILITY_IMPORT;
}
+#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_vpn_editor_new (connection, error);
+ g_return_val_if_fail (LIBRESWAN_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_vpn_editor_new (connection, error);
+#else
+ return nm_vpn_plugin_utils_load_editor (NM_PLUGIN_DIR"/libnm-vpn-plugin-libreswan-editor.so",
+ "nm_vpn_editor_factory_libreswan",
+ _call_editor_factory,
+ iface,
+ connection,
+ NULL,
+ error);
+#endif
+ }
}
static void
diff --git a/properties/nm-libreswan-editor-plugin.h b/properties/nm-libreswan-editor-plugin.h
index 9780ffe..12a6466 100644
--- a/properties/nm-libreswan-editor-plugin.h
+++ b/properties/nm-libreswan-editor-plugin.h
@@ -42,6 +42,14 @@ struct _LibreswanEditorPluginClass {
GType libreswan_editor_plugin_get_type (void);
+typedef NMVpnEditor *(*NMVpnEditorFactory) (NMVpnEditorPlugin *editor_plugin,
+ NMConnection *connection,
+ GError **error);
+
+NMVpnEditor *
+nm_vpn_editor_factory_libreswan (NMVpnEditorPlugin *editor_plugin,
+ NMConnection *connection,
+ GError **error);
#endif /* __NM_LIBRESWAN_EDITOR_PLUGIN_H__ */
diff --git a/properties/nm-libreswan-editor.c b/properties/nm-libreswan-editor.c
index 09518be..b4e4a39 100644
--- a/properties/nm-libreswan-editor.c
+++ b/properties/nm-libreswan-editor.c
@@ -529,3 +529,20 @@ libreswan_editor_interface_init (NMVpnEditorInterface *iface_class)
iface_class->update_connection = update_connection;
}
+/*****************************************************************************/
+
+#ifndef NM_VPN_OLD
+
+#include "nm-libreswan-editor-plugin.h"
+
+G_MODULE_EXPORT NMVpnEditor *
+nm_vpn_editor_factory_libreswan (NMVpnEditorPlugin *editor_plugin,
+ NMConnection *connection,
+ GError **error)
+{
+ g_return_val_if_fail (!error || !*error, NULL);
+
+ return nm_vpn_editor_new (connection, error);
+}
+#endif
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]