[NetworkManager-vpnc/lr/test: 1/8] xno-glib




commit e20f8e705f0c5ecc5d7a7f20ec9e5d6f2271b532
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Mon Jun 27 16:15:03 2022 +0200

    xno-glib

 .gitlab-ci.yml                        |  4 --
 Makefile.am                           | 78 -----------------------------------
 configure.ac                          | 26 ------------
 properties/nm-vpnc-editor-plugin.c    | 40 ------------------
 properties/nm-vpnc-editor.c           | 19 +--------
 properties/tests/test-import-export.c | 47 +++++----------------
 shared/nm-default.h                   | 44 --------------------
 7 files changed, 12 insertions(+), 246 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bdee7c5..c93c060 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -37,7 +37,6 @@
     - cd NetworkManager-vpnc-*/
     - ./configure
       --disable-silent-rules
-      --without-libnm-glib
     - make -j
     - make -j check
     - make -j install
@@ -52,9 +51,6 @@ fedora28_dist:
     - dnf -y install
       /usr/bin/autopoint
       autoconf automake make
-      NetworkManager-devel
-      NetworkManager-glib-devel
-      libnm-gtk-devel
     - sh autogen.sh
     - make -j dist
   artifacts:
diff --git a/Makefile.am b/Makefile.am
index 17ec0e6..c221a7d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -85,9 +85,6 @@ plugindir = $(libdir)/NetworkManager
 plugin_LTLIBRARIES = properties/libnm-vpn-plugin-vpnc.la
 if WITH_GNOME
 plugin_LTLIBRARIES += properties/libnm-vpn-plugin-vpnc-editor.la
-if WITH_LIBNM_GLIB
-plugin_LTLIBRARIES += properties/libnm-vpnc-properties.la
-endif
 endif
 if WITH_GTK4
 plugin_LTLIBRARIES += properties/libnm-gtk4-vpn-plugin-vpnc-editor.la
@@ -195,35 +192,6 @@ properties_libnm_vpn_plugin_vpnc_editor_la_LDFLAGS = \
 
 ###############################################################################
 
-properties_libnm_vpnc_properties_la_SOURCES = \
-       $(shared_sources) \
-       $(plugin_sources) \
-       $(editor_sources)
-
-nodist_properties_libnm_vpnc_properties_la_SOURCES = \
-       properties/resources.h \
-       properties/resources.c
-
-properties_libnm_vpnc_properties_la_CFLAGS = \
-       -DNM_VPN_OLD \
-       -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \
-       -DLOCALEDIR=\"$(datadir)/locale\"
-       $(common_cppflags) \
-       $(GTK_CFLAGS) \
-       $(LIBNM_GLIB_CFLAGS) \
-       $(LIBNM_GTK_CFLAGS)
-
-properties_libnm_vpnc_properties_la_LIBADD = \
-       $(GTK_LIBS) \
-       $(LIBNM_GLIB_LIBS) \
-       $(LIBNM_GTK_LIBS)
-
-properties_libnm_vpnc_properties_la_LDFLAGS = \
-       -avoid-version \
-       -Wl,--version-script=$(srcdir)/libnm-vpnc-properties.ver
-
-###############################################################################
-
 noinst_LTLIBRARIES += properties/libnm-vpn-plugin-vpnc-test.la
 
 properties_libnm_vpn_plugin_vpnc_test_la_SOURCES = $(properties_libnm_vpn_plugin_vpnc_la_SOURCES)
@@ -232,16 +200,6 @@ properties_libnm_vpn_plugin_vpnc_test_la_LIBADD = $(properties_libnm_vpn_plugin_
 properties_libnm_vpn_plugin_vpnc_test_la_LDFLAGS = \
        -avoid-version
 
-if WITH_LIBNM_GLIB
-noinst_LTLIBRARIES += properties/libnm-vpnc-properties-test.la
-endif
-
-properties_libnm_vpnc_properties_test_la_SOURCES = $(properties_libnm_vpnc_properties_la_SOURCES)
-properties_libnm_vpnc_properties_test_la_CFLAGS = $(properties_libnm_vpnc_properties_la_CFLAGS)
-properties_libnm_vpnc_properties_test_la_LIBADD = $(properties_libnm_vpnc_properties_la_LIBADD)
-properties_libnm_vpnc_properties_test_la_LDFLAGS = \
-       -avoid-version
-
 ###############################################################################
 
 test_cppflags = \
@@ -269,27 +227,6 @@ properties_tests_test_import_export_LDADD = \
        $(LIBNM_LIBS) \
        $(top_builddir)/properties/libnm-vpn-plugin-vpnc-test.la
 
-if WITH_LIBNM_GLIB
-noinst_PROGRAMS += properties/tests/test-import-export-glib
-TESTS += properties/tests/test-import-export-glib
-endif
-
-properties_tests_test_import_export_glib_SOURCES = \
-       properties/tests/test-import-export.c
-
-properties_tests_test_import_export_glib_CPPFLAGS = \
-       -DNM_VPN_OLD \
-       $(test_cppflags) \
-       $(LIBNM_GLIB_CFLAGS) \
-       $(LIBNM_GTK_CFLAGS)
-
-properties_tests_test_import_export_glib_LDADD = \
-       $(GTHREAD_LIBS) \
-       $(GTK_LIBS) \
-       $(LIBNM_GLIB_LIBS) \
-       $(LIBNM_GTK_LIBS) \
-       $(top_builddir)/properties/libnm-vpnc-properties-test.la
-
 ###############################################################################
 
 libexec_PROGRAMS += auth-dialog/nm-vpnc-auth-dialog
@@ -317,21 +254,6 @@ dbusservice_DATA = nm-vpnc-service.conf
 nmvpnservicedir = $(NM_VPN_SERVICE_DIR)
 nmvpnservice_DATA = nm-vpnc-service.name
 
-if WITH_LIBNM_GLIB
-# Install a file with full path to plugins for an old gnome-shell
-# https://bugzilla.gnome.org/show_bug.cgi?id=693590
-install-data-hook:
-       mkdir -p $(DESTDIR)$(sysconfdir)/NetworkManager/VPN
-       sed -e "1s|^|# This file is obsoleted by a file in $(NM_VPN_SERVICE_DIR)\n\n|" \
-           -e 's|[@]LIBEXECDIR[@]|$(libexecdir)|g' \
-           -e 's|[@]PLUGINDIR[@]|@NM_PLUGIN_DIR@|g' \
-           <$(srcdir)/nm-vpnc-service.name.in \
-           >$(DESTDIR)$(sysconfdir)/NetworkManager/VPN/nm-vpnc-service.name
-
-uninstall-hook:
-        rm -f $(DESTDIR)$(sysconfdir)/NetworkManager/VPN/nm-vpnc-service.name
-endif
-
 appdatadir = $(datadir)/metainfo
 appdata_files = $(appdata_in_files:.xml.in=.xml)
 if WITH_GNOME
diff --git a/configure.ac b/configure.ac
index 7ba9f66..4c0ac3b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,12 +70,6 @@ dnl GNOME support
 dnl
 AC_ARG_WITH(gnome, AS_HELP_STRING([--without-gnome], [Build NetworkManager-vpnc without GNOME support, e.g. 
vpn service only]), [], [with_gnome_specified=no])
 AC_ARG_WITH(gtk4, AS_HELP_STRING([--with-gtk4], [Build NetworkManager-vpnc with libnma-gtk4 support]), [], 
[with_gtk4_specified=no])
-AC_ARG_WITH(libnm-glib, AS_HELP_STRING([--without-libnm-glib], [Build NetworkManager-vpnc without libnm-glib 
comatibility]), [], [with_libnm_glib_specified=no])
-if test "$with_libnm_glib_specified" != no -a "$with_libnm_glib" != no; then
-       if test "$with_gnome_specified" != no -a "$with_gnome" == no; then
-               AC_MSG_ERROR(Building --with-libnm-glib conflicts with --without-gnome)
-       fi
-fi
 if test "$with_gnome" != no; then
        with_gnome=yes
 fi
@@ -85,15 +79,8 @@ fi
 if test "$with_gtk4" != yes; then
        with_gtk4=no
 fi
-if test "$with_libnm_glib_specified" == no; then
-       with_libnm_glib=no
-fi
-if test "$with_libnm_glib" != yes; then
-       with_libnm_glib=no
-fi
 AM_CONDITIONAL(WITH_GNOME, test "$with_gnome" != no)
 AM_CONDITIONAL(WITH_GTK4, test "$with_gtk4" != no)
-AM_CONDITIONAL(WITH_LIBNM_GLIB, test "$with_libnm_glib" != no)
 
 AC_ARG_ENABLE(absolute-paths, AS_HELP_STRING([--enable-absolute-paths], [Use absolute paths to in .name 
files. Useful for development. (default is no)]))
 
@@ -115,18 +102,6 @@ if test x"$with_gnome" != xno; then
 
        PKG_CHECK_MODULES(LIBNMA, libnma >= 1.2.0)
        PKG_CHECK_MODULES(LIBSECRET, libsecret-1 >= 0.18)
-
-       if test x"$with_libnm_glib" != xno; then
-               PKG_CHECK_MODULES(LIBNM_GTK, libnm-gtk >= 1.2.0)
-               PKG_CHECK_MODULES(LIBNM_GLIB,
-                       NetworkManager >= 1.2.0
-                       libnm-util >= 1.2.0
-                       libnm-glib >= 1.2.0
-                       libnm-glib-vpn >= 1.2.0);
-
-               LIBNM_GLIB_CFLAGS="$LIBNM_GLIB_CFLAGS -DNM_VERSION_MIN_REQUIRED=NM_VERSION_1_2"
-               LIBNM_GLIB_CFLAGS="$LIBNM_GLIB_CFLAGS -DNM_VERSION_MAX_ALLOWED=NM_VERSION_1_2"
-       fi
 fi
 
 if test x"$with_gtk4" != xno; then
@@ -173,6 +148,5 @@ echo ""
 echo "Build configuration: "
 echo "  --with-gnome=$with_gnome"
 echo "  --with-gtk4=$with_gtk4"
-echo "  --with-libnm-glib=$with_libnm_glib"
 echo "  --enable-absolute-paths=$enable_absolute_paths"
 echo "  --enable-more-warnings=$set_more_warnings"
diff --git a/properties/nm-vpnc-editor-plugin.c b/properties/nm-vpnc-editor-plugin.c
index 53de7c2..b512b2b 100644
--- a/properties/nm-vpnc-editor-plugin.c
+++ b/properties/nm-vpnc-editor-plugin.c
@@ -35,12 +35,7 @@
 #include <fcntl.h>
 
 #include "nm-vpnc-helper.h"
-
-#ifdef NM_VPN_OLD
-#include "nm-vpnc-editor.h"
-#else
 #include "nm-utils/nm-vpn-plugin-utils.h"
-#endif
 
 #define VPNC_PLUGIN_NAME    _("Cisco Compatible VPN (vpnc)")
 #define VPNC_PLUGIN_DESC    _("Compatible with various Cisco, Juniper, Netscreen, and Sonicwall IPsec-based 
VPN gateways.")
@@ -70,12 +65,8 @@ add_routes (NMSettingIPConfig *s_ip4, const char *routelist)
        for (i = 0; substrs[i] != NULL; i++) {
                char *p, *str_route;
                long int prefix = 32;
-#ifdef NM_VPN_OLD
-               struct in_addr tmp;
-#else
                NMIPRoute *route;
                GError *error = NULL;
-#endif
 
                str_route = g_strdup (substrs[i]);
                p = strchr (str_route, '/');
@@ -92,17 +83,6 @@ add_routes (NMSettingIPConfig *s_ip4, const char *routelist)
                }
                *p = '\0';
 
-#ifdef NM_VPN_OLD
-               if (inet_pton (AF_INET, str_route, &tmp) > 0) {
-                       NMIP4Route *route = nm_ip4_route_new ();
-
-                       nm_ip4_route_set_dest (route, tmp.s_addr);
-                       nm_ip4_route_set_prefix (route, (guint32) prefix);
-
-                       nm_setting_ip_config_add_route (s_ip4, route);
-               } else
-                       g_warning ("Ignoring invalid route '%s'", str_route);
-#else
                route = nm_ip_route_new (AF_INET, str_route, prefix, NULL, -1, &error);
                if (route) {
                        nm_setting_ip_config_add_route (s_ip4, route);
@@ -111,7 +91,6 @@ add_routes (NMSettingIPConfig *s_ip4, const char *routelist)
                        g_warning ("Ignoring invalid route '%s': %s", str_route, error->message);
                        g_clear_error (&error);
                }
-#endif
 
 next:
                g_free (str_route);
@@ -670,26 +649,13 @@ export (NMVpnEditorPlugin *plugin,
                int i;
 
                for (i = 0; i < nm_setting_ip_config_get_num_routes (s_ip4); i++) {
-#ifdef NM_VPN_OLD
-                       NMIP4Route *route = nm_setting_ip_config_get_route (s_ip4, i);
-                       char str_addr[INET_ADDRSTRLEN + 1];
-                       struct in_addr num_addr;
-#else
                        NMIPRoute *route = nm_setting_ip_config_get_route (s_ip4, i);
-#endif
 
                        if (routes_count)
                                g_string_append_c (routes, ' ');
-#ifdef NM_VPN_OLD
-                       num_addr.s_addr = nm_ip4_route_get_dest (route);
-                       if (inet_ntop (AF_INET, &num_addr, &str_addr[0], INET_ADDRSTRLEN + 1))
-                               g_string_append_printf (routes, "%s/%d", str_addr, nm_ip4_route_get_prefix 
(route));
-#else
                        g_string_append_printf (routes, "%s/%d",
                                                nm_ip_route_get_dest (route),
                                                nm_ip_route_get_prefix (route));
-#endif
-
                        routes_count++;
                }
        }
@@ -801,7 +767,6 @@ get_capabilities (NMVpnEditorPlugin *plugin)
        return (NM_VPN_EDITOR_PLUGIN_CAPABILITY_IMPORT | NM_VPN_EDITOR_PLUGIN_CAPABILITY_EXPORT);
 }
 
-#ifndef NM_VPN_OLD
 static NMVpnEditor *
 _call_editor_factory (gpointer factory,
                       NMVpnEditorPlugin *editor_plugin,
@@ -813,7 +778,6 @@ _call_editor_factory (gpointer factory,
                                               connection,
                                               error);
 }
-#endif
 
 static NMVpnEditor *
 get_editor (NMVpnEditorPlugin *iface, NMConnection *connection, GError **error)
@@ -836,9 +800,6 @@ get_editor (NMVpnEditorPlugin *iface, NMConnection *connection, GError **error)
                editor = "libnm-gtk4-vpn-plugin-vpnc-editor.so";
        }
 
-#ifdef NM_VPN_OLD
-       return nm_vpnc_editor_new (connection, error);
-#else
        return nm_vpn_plugin_utils_load_editor (editor,
                                                "nm_vpn_editor_factory_vpnc",
                                                _call_editor_factory,
@@ -846,7 +807,6 @@ get_editor (NMVpnEditorPlugin *iface, NMConnection *connection, GError **error)
                                                connection,
                                                NULL,
                                                error);
-#endif
 }
 
 static void
diff --git a/properties/nm-vpnc-editor.c b/properties/nm-vpnc-editor.c
index b7d3ca3..e2c0f62 100644
--- a/properties/nm-vpnc-editor.c
+++ b/properties/nm-vpnc-editor.c
@@ -27,6 +27,7 @@
 #include "nm-default.h"
 
 #include "nm-vpnc-editor.h"
+#include "nm-vpnc-editor-plugin.h"
 
 #include <nma-cert-chooser.h>
 #include <netinet/in.h>
@@ -1015,21 +1016,3 @@ vpnc_editor_interface_init (NMVpnEditorInterface *iface)
        iface->get_widget = get_widget;
        iface->update_connection = update_connection;
 }
-
-/*****************************************************************************/
-
-#ifndef NM_VPN_OLD
-
-#include "nm-vpnc-editor-plugin.h"
-
-G_MODULE_EXPORT NMVpnEditor *
-nm_vpn_editor_factory_vpnc (NMVpnEditorPlugin *editor_plugin,
-                            NMConnection *connection,
-                            GError **error)
-{
-       g_return_val_if_fail (!error || !*error, NULL);
-
-       return nm_vpnc_editor_new (connection, error);
-}
-#endif
-
diff --git a/properties/tests/test-import-export.c b/properties/tests/test-import-export.c
index c26ca5d..4117f45 100644
--- a/properties/tests/test-import-export.c
+++ b/properties/tests/test-import-export.c
@@ -34,12 +34,7 @@
 #include "nm-utils/nm-test-utils.h"
 
 #define SRCDIR TEST_SRCDIR"/pcf"
-
-#ifdef NM_VPN_OLD
-#define TMPDIR TEST_BUILDDIR"/pcf-tmp-old"
-#else
-#define TMPDIR TEST_BUILDDIR"/pcf-tmp-new"
-#endif
+#define TMPDIR TEST_BUILDDIR"/pcf-tmp"
 
 /*****************************************************************************/
 
@@ -155,6 +150,7 @@ test_basic_import (void)
        NMSettingConnection *s_con;
        NMSettingIPConfig *s_ip4;
        NMSettingVpn *s_vpn;
+       NMIPRoute *route;
        const char *expected_id = "Basic VPN";
 
        connection = get_basic_connection ("basic-import", plugin, SRCDIR, "basic.pcf");
@@ -182,37 +178,16 @@ test_basic_import (void)
        g_assert_cmpint (nm_setting_ip_config_get_num_dns (s_ip4), ==, 0);
        g_assert_cmpint (nm_setting_ip_config_get_num_routes (s_ip4), ==, 2);
 
-#ifdef NM_VPN_OLD
-       {
-               NMIP4Route *route;
-
-               route = nm_setting_ip4_config_get_route (s_ip4, 0);
-               g_assert (!nm_ip4_route_get_next_hop (route));
-               g_assert_cmpint (nm_ip4_route_get_prefix (route), ==, 8);
-               g_assert_cmpint (nm_ip4_route_get_metric (route), ==, 0);
+       route = nm_setting_ip_config_get_route (s_ip4, 0);
+       g_assert (!nm_ip_route_get_next_hop (route));
+       g_assert_cmpint (nm_ip_route_get_prefix (route), ==, 8);
+       g_assert_cmpint (nm_ip_route_get_metric (route), ==, -1);
 
-               route = nm_setting_ip4_config_get_route (s_ip4, 1);
-               g_assert_cmpint (nm_ip4_route_get_dest (route), ==, nmtst_inet4_from_string ("172.16.0.0"));
-               g_assert (!nm_ip4_route_get_next_hop (route));
-               g_assert_cmpint (nm_ip4_route_get_prefix (route), ==, 16);
-               g_assert_cmpint (nm_ip4_route_get_metric (route), ==, 0);
-       }
-#else
-       {
-               NMIPRoute *route;
-
-               route = nm_setting_ip_config_get_route (s_ip4, 0);
-               g_assert (!nm_ip_route_get_next_hop (route));
-               g_assert_cmpint (nm_ip_route_get_prefix (route), ==, 8);
-               g_assert_cmpint (nm_ip_route_get_metric (route), ==, -1);
-
-               route = nm_setting_ip_config_get_route (s_ip4, 1);
-               g_assert_cmpstr (nm_ip_route_get_dest (route), ==, "172.16.0.0");
-               g_assert (!nm_ip_route_get_next_hop (route));
-               g_assert_cmpint (nm_ip_route_get_prefix (route), ==, 16);
-               g_assert_cmpint (nm_ip_route_get_metric (route), ==, -1);
-       }
-#endif
+       route = nm_setting_ip_config_get_route (s_ip4, 1);
+       g_assert_cmpstr (nm_ip_route_get_dest (route), ==, "172.16.0.0");
+       g_assert (!nm_ip_route_get_next_hop (route));
+       g_assert_cmpint (nm_ip_route_get_prefix (route), ==, 16);
+       g_assert_cmpint (nm_ip_route_get_metric (route), ==, -1);
 
        /* VPN setting */
        s_vpn = nm_connection_get_setting_vpn (connection);
diff --git a/shared/nm-default.h b/shared/nm-default.h
index c8317db..23a77d5 100644
--- a/shared/nm-default.h
+++ b/shared/nm-default.h
@@ -63,44 +63,6 @@
 
 /*****************************************************************************/
 
-#ifdef NM_VPN_OLD
-
-#define NM_VPN_LIBNM_COMPAT
-#include <nm-connection.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-8021x.h>
-#include <nm-setting-ip4-config.h>
-#include <nm-setting-vpn.h>
-#include <nm-utils.h>
-#include <nm-vpn-plugin-ui-interface.h>
-
-#define nm_simple_connection_new nm_connection_new
-#define NM_SETTING_IP_CONFIG NM_SETTING_IP4_CONFIG
-#define NM_SETTING_IP_CONFIG_METHOD NM_SETTING_IP4_CONFIG_METHOD
-#define NMSettingIPConfig NMSettingIP4Config
-
-#define nm_setting_ip_config_get_num_routes         nm_setting_ip4_config_get_num_routes
-#define nm_setting_ip_config_add_route              nm_setting_ip4_config_add_route
-#define nm_setting_ip_config_get_route              nm_setting_ip4_config_get_route
-#define nm_setting_ip_config_get_num_addresses      nm_setting_ip4_config_get_num_addresses
-#define nm_setting_ip_config_get_num_dns_searches   nm_setting_ip4_config_get_num_dns_searches
-#define nm_setting_ip_config_get_never_default      nm_setting_ip4_config_get_never_default
-#define nm_setting_ip_config_get_dhcp_hostname      nm_setting_ip4_config_get_dhcp_hostname
-#define nm_setting_ip_config_get_method             nm_setting_ip4_config_get_method
-#define nm_setting_ip_config_get_dhcp_hostname      nm_setting_ip4_config_get_dhcp_hostname
-#define nm_setting_ip_config_get_num_dns            nm_setting_ip4_config_get_num_dns
-#define NM_SETTING_IP_CONFIG_NEVER_DEFAULT          NM_SETTING_IP4_CONFIG_NEVER_DEFAULT
-
-#define NMV_EDITOR_PLUGIN_ERROR                     NM_SETTING_VPN_ERROR
-#define NMV_EDITOR_PLUGIN_ERROR_FAILED              NM_SETTING_VPN_ERROR_UNKNOWN
-#define NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY    NM_SETTING_VPN_ERROR_INVALID_PROPERTY
-#define NMV_EDITOR_PLUGIN_ERROR_MISSING_PROPERTY    NM_SETTING_VPN_ERROR_MISSING_PROPERTY
-#define NMV_EDITOR_PLUGIN_ERROR_FILE_NOT_VPN        NM_SETTING_VPN_ERROR_UNKNOWN
-#define NMV_EDITOR_PLUGIN_ERROR_FILE_NOT_READABLE   NM_SETTING_VPN_ERROR_UNKNOWN
-#define NMV_EDITOR_PLUGIN_ERROR_FILE_INVALID        NM_SETTING_VPN_ERROR_UNKNOWN
-
-#else /* !NM_VPN_OLD */
-
 #include <NetworkManager.h>
 
 #define NMV_EDITOR_PLUGIN_ERROR                     NM_CONNECTION_ERROR
@@ -111,17 +73,11 @@
 #define NMV_EDITOR_PLUGIN_ERROR_FILE_NOT_READABLE   NM_CONNECTION_ERROR_FAILED
 #define NMV_EDITOR_PLUGIN_ERROR_FILE_INVALID        NM_CONNECTION_ERROR_FAILED
 
-#endif /* NM_VPN_OLD */
-
 /*****************************************************************************/
 
 #if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_LIB_EDITOR
 
-#ifdef NM_VPN_OLD
-#include <nm-ui-utils.h>
-#else /* NM_VPN_OLD */
 #include <nma-ui-utils.h>
-#endif /* NM_VPN_OLD */
 
 #endif /* NM_NETWORKMANAGER_COMPILATION_LIB_EDITOR */
 


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