[network-manager-vpnc/th/vpn-editor-split-bgo766170: 7/20] shared: use "nm-default.h" header



commit 0651da5cc12412c3370a41b14123e15f8f624a47
Author: Thomas Haller <thaller redhat com>
Date:   Sun May 8 22:30:41 2016 +0200

    shared: use "nm-default.h" header

 auth-dialog/main.c                    |    9 +------
 properties/Makefile.am                |    3 +-
 properties/nm-vpnc-helper.c           |    8 ++----
 properties/nm-vpnc.c                  |   42 ++------------------------------
 properties/nm-vpnc.h                  |    2 -
 properties/tests/Makefile.am          |    4 ++-
 properties/tests/test-import-export.c |   15 ++++-------
 shared/nm-default.h                   |    5 ++++
 src/nm-vpnc-service-vpnc-helper.c     |    7 +----
 src/nm-vpnc-service.c                 |    9 ++----
 src/nm-vpnc-service.h                 |    6 ----
 src/test-vpnc-output.c                |    3 ++
 src/utils.c                           |    5 +++-
 src/utils.h                           |    2 -
 14 files changed, 35 insertions(+), 85 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index 4ddacaa..2370208 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -20,23 +20,16 @@
  * (C) Copyright 2004 - 2011 Red Hat, Inc.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "nm-default.h"
 
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
-#include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <libsecret/secret.h>
 
-#include <NetworkManager.h>
-#include <nm-vpn-service-plugin.h>
 #include <nma-vpn-password-dialog.h>
 
-#include "nm-service-defines.h"
-
 #define KEYRING_UUID_TAG "connection-uuid"
 #define KEYRING_SN_TAG "setting-name"
 #define KEYRING_SK_TAG "setting-key"
diff --git a/properties/Makefile.am b/properties/Makefile.am
index 50ecc3c..abce74b 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -24,7 +24,8 @@ common_CFLAGS = \
        -I"$(top_srcdir)/shared/" \
        -DICONDIR=\""$(datadir)/pixmaps"\" \
        -DUIDIR=\""$(uidir)"\" \
-       -DLOCALEDIR=\"$(datadir)/locale\"
+       -DLOCALEDIR=\"$(datadir)/locale\" \
+       -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB
 
 libnm_vpn_plugin_vpnc_la_CFLAGS = \
        $(common_CFLAGS) \
diff --git a/properties/nm-vpnc-helper.c b/properties/nm-vpnc-helper.c
index 1ea66f8..33d7166 100644
--- a/properties/nm-vpnc-helper.c
+++ b/properties/nm-vpnc-helper.c
@@ -20,15 +20,13 @@
  *
  **************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "nm-default.h"
+
+#include "nm-vpnc-helper.h"
 
 #include <errno.h>
-#include <glib.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include "nm-vpnc-helper.h"
 
 gboolean
 key_file_get_boolean_helper (GKeyFile *keyfile,
diff --git a/properties/nm-vpnc.c b/properties/nm-vpnc.c
index f1b47a5..e1b3e43 100644
--- a/properties/nm-vpnc.c
+++ b/properties/nm-vpnc.c
@@ -24,9 +24,9 @@
  *
  **************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "nm-default.h"
+
+#include "nm-vpnc.h"
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -35,45 +35,9 @@
 #include <string.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-
-#include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
 
-#ifdef NM_VPN_OLD
-#define NM_VPN_LIBNM_COMPAT
-
-#include <nm-setting-vpn.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-ip4-config.h>
-#include <nm-ui-utils.h>
-#include <nm-vpn-plugin-ui-interface.h>
-
-#define nm_simple_connection_new() nm_connection_new ()
-
-#define NMSettingIPConfig NMSettingIP4Config
-#define NM_SETTING_IP_CONFIG(obj) NM_SETTING_IP4_CONFIG (obj)
-#define nm_setting_ip_config_get_num_routes nm_setting_ip4_config_get_num_routes
-#define nm_setting_ip_config_get_route nm_setting_ip4_config_get_route
-#define nm_setting_ip_config_add_route nm_setting_ip4_config_add_route
-#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
-
-#else /* !NM_VPN_OLD */
-
-#include <NetworkManager.h>
-#include <nma-ui-utils.h>
-
-#define NMV_EDITOR_PLUGIN_ERROR                  NM_CONNECTION_ERROR
-#define NMV_EDITOR_PLUGIN_ERROR_FAILED           NM_CONNECTION_ERROR_FAILED
-#define NMV_EDITOR_PLUGIN_ERROR_INVALID_PROPERTY NM_CONNECTION_ERROR_INVALID_PROPERTY
-#endif
-
-#include "nm-service-defines.h"
 #include "nm-vpnc-helper.h"
-#include "nm-vpnc.h"
 
 #define VPNC_PLUGIN_NAME    _("Cisco Compatible VPN (vpnc)")
 #define VPNC_PLUGIN_DESC    _("Compatible with various Cisco, Juniper, Netscreen, and Sonicwall IPsec-based 
VPN gateways.")
diff --git a/properties/nm-vpnc.h b/properties/nm-vpnc.h
index 6ffd148..6749668 100644
--- a/properties/nm-vpnc.h
+++ b/properties/nm-vpnc.h
@@ -23,8 +23,6 @@
 #ifndef _NM_VPNC_H_
 #define _NM_VPNC_H_
 
-#include <glib-object.h>
-
 #define VPNC_TYPE_EDITOR_PLUGIN            (vpnc_editor_plugin_get_type ())
 #define VPNC_EDITOR_PLUGIN(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), VPNC_TYPE_EDITOR_PLUGIN, 
VpncEditorPlugin))
 #define VPNC_EDITOR_PLUGIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), VPNC_TYPE_EDITOR_PLUGIN, 
VpncEditorPluginClass))
diff --git a/properties/tests/Makefile.am b/properties/tests/Makefile.am
index 083ce54..6602ef1 100644
--- a/properties/tests/Makefile.am
+++ b/properties/tests/Makefile.am
@@ -11,7 +11,9 @@ test_import_export_CPPFLAGS = \
        $(LIBNM_CFLAGS) \
        $(LIBNMA_CFLAGS) \
        $(DBUS_CFLAGS) \
-       -I"$(top_srcdir)/shared/"
+       -I"$(top_srcdir)/" \
+       -I"$(top_srcdir)/shared/" \
+       -I"$(top_srcdir)/properties/"
 
 test_import_export_LDADD = \
        $(GTHREAD_LIBS) \
diff --git a/properties/tests/test-import-export.c b/properties/tests/test-import-export.c
index 70db07f..a7d5009 100644
--- a/properties/tests/test-import-export.c
+++ b/properties/tests/test-import-export.c
@@ -19,21 +19,18 @@
  *
  */
 
+#include "nm-default.h"
+
 #include <string.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <locale.h>
 
-#include <NetworkManager.h>
-#include <nm-utils.h>
-#include <nm-setting-ip4-config.h>
-
-#include <nm-vpn-editor-plugin.h>
+#include "nm-vpnc.h"
+#include "nm-vpnc-helper.h"
 
-#include "../../nm-test-helpers.h"
-#include "../../properties/nm-vpnc.h"
-#include "nm-service-defines.h"
-#include "../../properties/nm-vpnc-helper.h"
+#include "nm-test-helpers.h"
+#include "nm-utils/nm-test-utils.h"
 
 typedef struct {
        const char *name;
diff --git a/shared/nm-default.h b/shared/nm-default.h
index 139dc74..9d5aa5f 100644
--- a/shared/nm-default.h
+++ b/shared/nm-default.h
@@ -79,6 +79,11 @@
 #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_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
diff --git a/src/nm-vpnc-service-vpnc-helper.c b/src/nm-vpnc-service-vpnc-helper.c
index 34e39c1..427d093 100644
--- a/src/nm-vpnc-service-vpnc-helper.c
+++ b/src/nm-vpnc-service-vpnc-helper.c
@@ -20,7 +20,8 @@
  * (C) Copyright 2005 Red Hat, Inc.
  */
 
-#include <glib.h>
+#include "nm-default.h"
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -29,10 +30,6 @@
 #include <arpa/inet.h>
 #include <errno.h>
 #include <locale.h>
-#include <NetworkManager.h>
-
-#include "nm-vpnc-service.h"
-#include "nm-utils.h"
 
 static void
 helper_failed (GDBusProxy *proxy, const char *reason)
diff --git a/src/nm-vpnc-service.c b/src/nm-vpnc-service.c
index 5a1c874..c386d08 100644
--- a/src/nm-vpnc-service.c
+++ b/src/nm-vpnc-service.c
@@ -19,7 +19,9 @@
  * (C) Copyright 2007 - 2008 Novell, Inc.
  */
 
-#include <config.h>
+#include "nm-default.h"
+
+#include "nm-vpnc-service.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -32,12 +34,7 @@
 #include <sys/ttydefaults.h>
 #include <errno.h>
 #include <locale.h>
-#include <glib/gi18n.h>
 
-#include <NetworkManager.h>
-#include <nm-utils.h>
-
-#include "nm-vpnc-service.h"
 #include "utils.h"
 
 #if !defined(DIST_VERSION)
diff --git a/src/nm-vpnc-service.h b/src/nm-vpnc-service.h
index 3bea2ff..ba5d0c4 100644
--- a/src/nm-vpnc-service.h
+++ b/src/nm-vpnc-service.h
@@ -22,12 +22,6 @@
 #ifndef NM_VPNC_PLUGIN_H
 #define NM_VPNC_PLUGIN_H
 
-#include <glib.h>
-#include <glib-object.h>
-#include <nm-vpn-service-plugin.h>
-
-#include "nm-service-defines.h"
-
 #define NM_TYPE_VPNC_PLUGIN            (nm_vpnc_plugin_get_type ())
 #define NM_VPNC_PLUGIN(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_VPNC_PLUGIN, 
NMVPNCPlugin))
 #define NM_VPNC_PLUGIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_VPNC_PLUGIN, 
NMVPNCPluginClass))
diff --git a/src/test-vpnc-output.c b/src/test-vpnc-output.c
index e722946..5eefb5e 100644
--- a/src/test-vpnc-output.c
+++ b/src/test-vpnc-output.c
@@ -18,7 +18,10 @@
  * (C) Copyright 2013 Red Hat, Inc.
  */
 
+#include "nm-default.h"
+
 #include <string.h>
+
 #include "utils.h"
 
 #define TEST_HEADER \
diff --git a/src/utils.c b/src/utils.c
index 6fde9d8..cb685b1 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -18,9 +18,12 @@
  * (C) Copyright 2013 Red Hat, Inc.
  */
 
-#include <string.h>
+#include "nm-default.h"
+
 #include "utils.h"
 
+#include <string.h>
+
 #define IS_EOL(a)  (a == '\r' || a == '\n')
 #define VPNC_VERSION_STR "vpnc version "
 
diff --git a/src/utils.h b/src/utils.h
index a2cb49a..d5e2cfd 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -21,8 +21,6 @@
 #ifndef _UTILS_H_
 #define _UTILS_H_
 
-#include <glib.h>
-
 typedef void (*PromptFn) (const char *data, gsize len, gpointer user_data);
 
 gsize utils_handle_output (GString *output,


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