[network-manager-vpnc/lr/libnm: 3/3] fixup! properties: build separate libnm-based and libnm-glib-based plugin
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-vpnc/lr/libnm: 3/3] fixup! properties: build separate libnm-based and libnm-glib-based plugin
- Date: Fri, 17 Jul 2015 15:34:53 +0000 (UTC)
commit 62bf15eede579a02eb66154b079a9c09b7184112
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Fri Jul 17 17:32:06 2015 +0200
fixup! properties: build separate libnm-based and libnm-glib-based plugin
nm-vpnc-service.name.in | 2 +-
properties/Makefile.am | 42 +++++++++++---------------------
properties/nm-vpnc.c | 60 +++++++++++++++++++++++-----------------------
3 files changed, 46 insertions(+), 58 deletions(-)
---
diff --git a/nm-vpnc-service.name.in b/nm-vpnc-service.name.in
index 3c5bf0e..16200fd 100644
--- a/nm-vpnc-service.name.in
+++ b/nm-vpnc-service.name.in
@@ -4,7 +4,7 @@ service=org.freedesktop.NetworkManager.vpnc
program= LIBEXECDIR@/nm-vpnc-service
[libnm]
-properties= PLUGINDIR@/libnm-vpnc-properties-new
+properties= PLUGINDIR@/libnm-vpnc-properties
[GNOME]
auth-dialog= LIBEXECDIR@/nm-vpnc-auth-dialog
diff --git a/properties/Makefile.am b/properties/Makefile.am
index 7b36bd1..c4d1d81 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -1,62 +1,50 @@
SUBDIRS=. tests
plugindir = $(libdir)/NetworkManager
-plugin_LTLIBRARIES = libnm-vpnc-properties-new.la libnm-vpnc-properties-old.la
+plugin_LTLIBRARIES = libnm-vpnc-properties.la libnm-vpnc-properties-old.la
-libnm_vpnc_properties_new_la_SOURCES = \
+libnm_vpnc_properties_la_SOURCES = \
nm-vpnc.c \
nm-vpnc.h \
nm-vpnc-helper.c \
nm-vpnc-helper.h
libnm_vpnc_properties_old_la_SOURCES = \
- nm-vpnc.c \
- nm-vpnc.h \
- nm-vpnc-helper.c \
- nm-vpnc-helper.h
+ $(libnm_vpnc_properties_la_SOURCES)
uidir = $(datadir)/gnome-vpn-properties/vpnc
ui_DATA = nm-vpnc-dialog.ui
-libnm_vpnc_properties_new_la_CPPFLAGS = \
- -DNM_VPNC_NEW \
+common_CFLAGS = \
$(GLIB_CFLAGS) \
$(GTK_CFLAGS) \
- $(LIBNM_CFLAGS) \
- $(LIBNMA_CFLAGS) \
-I$(top_srcdir)/src/ \
-DICONDIR=\""$(datadir)/pixmaps"\" \
-DUIDIR=\""$(uidir)"\" \
-DLOCALEDIR=\"$(datadir)/locale\" \
-DVERSION=\"$(VERSION)\"
-libnm_vpnc_properties_new_la_LIBADD = \
- $(GTK_LIBS) \
- $(LIBNM_LIBS) \
- $(LIBNMA_LIBS)
-
-libnm_vpnc_properties_new_la_LDFLAGS = \
- -avoid-version
+libnm_vpnc_properties_la_CFLAGS = \
+ $(common_CFLAGS) \
+ $(LIBNM_CFLAGS) \
+ $(LIBNMA_CFLAGS)
-libnm_vpnc_properties_old_la_CPPFLAGS = \
+libnm_vpnc_properties_old_la_CFLAGS = \
-DNM_VPNC_OLD \
- $(GLIB_CFLAGS) \
- $(GTK_CFLAGS) \
+ $(common_CFLAGS) \
$(NM_CFLAGS) \
- $(NMGTK_CFLAGS) \
- -I$(top_srcdir)/src \
- -DICONDIR=\""$(datadir)/pixmaps"\" \
- -DUIDIR=\""$(uidir)"\" \
- -DLOCALEDIR=\"$(datadir)/locale\" \
- -DVERSION=\"$(VERSION)\"
+ $(NMGTK_CFLAGS)
libnm_vpnc_properties_old_la_LIBADD = \
$(GTK_LIBS) \
$(NM_LIBS) \
$(NMGTK_LIBS)
+libnm_vpnc_properties_new_la_LDFLAGS = \
+ -avoid-version
+
libnm_vpnc_properties_old_la_LDFLAGS = \
- -avoid-version
+ $(libnm_vpnc_properties_new_la_LDFLAGS)
CLEANFILES = *.bak *~
diff --git a/properties/nm-vpnc.c b/properties/nm-vpnc.c
index ad8e9c0..a81086c 100644
--- a/properties/nm-vpnc.c
+++ b/properties/nm-vpnc.c
@@ -39,15 +39,6 @@
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
-#ifdef NM_VPNC_NEW
-#include <NetworkManager.h>
-#include <nma-ui-utils.h>
-
-#define VPNC_PLUGIN_UI_ERROR NM_CONNECTION_ERROR
-#define VPNC_PLUGIN_UI_ERROR_FAILED NM_CONNECTION_ERROR_FAILED
-#define VPNC_PLUGIN_UI_ERROR_INVALID_PROPERTY NM_CONNECTION_ERROR_INVALID_PROPERTY
-#endif
-
#ifdef NM_VPNC_OLD
#include <nm-setting-vpn.h>
#include <nm-setting-connection.h>
@@ -70,6 +61,15 @@
#define VPNC_PLUGIN_UI_ERROR NM_SETTING_VPN_ERROR
#define VPNC_PLUGIN_UI_ERROR_FAILED NM_SETTING_VPN_ERROR_UNKNOWN
#define VPNC_PLUGIN_UI_ERROR_INVALID_PROPERTY NM_SETTING_VPN_ERROR_INVALID_PROPERTY
+
+#else /* !NM_VPNC_OLD */
+
+#include <NetworkManager.h>
+#include <nma-ui-utils.h>
+
+#define VPNC_PLUGIN_UI_ERROR NM_CONNECTION_ERROR
+#define VPNC_PLUGIN_UI_ERROR_FAILED NM_CONNECTION_ERROR_FAILED
+#define VPNC_PLUGIN_UI_ERROR_INVALID_PROPERTY NM_CONNECTION_ERROR_INVALID_PROPERTY
#endif
#include "nm-vpnc-service-defines.h"
@@ -1092,11 +1092,11 @@ 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_VPNC_NEW
+#ifdef NM_VPNC_OLD
+ struct in_addr tmp;
+#else
NMIPRoute *route;
GError *error = NULL;
-#else
- struct in_addr tmp;
#endif
str_route = g_strdup (substrs[i]);
@@ -1114,16 +1114,7 @@ add_routes (NMSettingIPConfig *s_ip4, const char *routelist)
}
*p = '\0';
-#ifdef NM_VPNC_NEW
- route = nm_ip_route_new (AF_INET, str_route, prefix, NULL, -1, &error);
- if (route) {
- nm_setting_ip_config_add_route (s_ip4, route);
- nm_ip_route_unref (route);
- } else {
- g_warning ("Ignoring invalid route '%s': %s", str_route, error->message);
- g_clear_error (&error);
- }
-#else
+#ifdef NM_VPNC_OLD
if (inet_pton (AF_INET, str_route, &tmp) > 0) {
NMIP4Route *route = nm_ip4_route_new ();
@@ -1133,6 +1124,15 @@ add_routes (NMSettingIPConfig *s_ip4, const char *routelist)
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);
+ nm_ip_route_unref (route);
+ } else {
+ g_warning ("Ignoring invalid route '%s': %s", str_route, error->message);
+ g_clear_error (&error);
+ }
#endif
next:
@@ -1665,24 +1665,24 @@ export (NMVpnEditorPlugin *plugin,
int i;
for (i = 0; i < nm_setting_ip_config_get_num_routes (s_ip4); i++) {
-#ifdef NM_VPNC_NEW
- NMIPRoute *route = nm_setting_ip_config_get_route (s_ip4, i);
-#else
+#ifdef NM_VPNC_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_VPNC_NEW
- g_string_append_printf (routes, "%s/%d",
- nm_ip_route_get_dest (route),
- nm_ip_route_get_prefix (route));
-#else
+#ifdef NM_VPNC_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++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]