[network-manager-pptp/th/vpn-editor-split-bgo766623: 12/21] shared: use "nm-default.h" header



commit 4989afc6683e8db5cc0dd990e38862d0cbe7b864
Author: Thomas Haller <thaller redhat com>
Date:   Wed May 18 18:24:53 2016 +0200

    shared: use "nm-default.h" header

 auth-dialog/main.c           |    8 +-------
 properties/Makefile.am       |    2 ++
 properties/advanced-dialog.c |   21 ++++-----------------
 properties/advanced-dialog.h |    3 ---
 properties/import-export.c   |   12 +++---------
 properties/import-export.h   |    3 ---
 properties/nm-pptp.c         |   22 +++-------------------
 properties/nm-pptp.h         |   22 +---------------------
 shared/nm-default.h          |    3 +++
 src/nm-pptp-pppd-plugin.c    |   15 +++++++++------
 src/nm-pptp-service.c        |   11 +++--------
 src/nm-pptp-service.h        |    7 -------
 12 files changed, 29 insertions(+), 100 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index 82ff3ad..5583e42 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -20,24 +20,18 @@
  * (C) Copyright 2008 - 2011 Red Hat, Inc.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "nm-default.h"
 
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
-#include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-
 #define SECRET_API_SUBJECT_TO_CHANGE
 #include <libsecret/secret.h>
 
-#include <NetworkManager.h>
 #include <nma-vpn-password-dialog.h>
 
-#include "nm-service-defines.h"
 
 #define KEYRING_UUID_TAG "connection-uuid"
 #define KEYRING_SN_TAG "setting-name"
diff --git a/properties/Makefile.am b/properties/Makefile.am
index 909a2e0..da16f8f 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -31,6 +31,7 @@ libnm_vpn_plugin_pptp_la_SOURCES = \
     $(plugin_sources)
 
 libnm_vpn_plugin_pptp_la_CFLAGS = \
+    -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \
     $(common_CFLAGS) \
     $(LIBNMA_CFLAGS) \
     $(LIBNM_CFLAGS)
@@ -50,6 +51,7 @@ libnm_pptp_properties_la_SOURCES = \
 
 libnm_pptp_properties_la_CFLAGS = \
     -DNM_VPN_OLD \
+    -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \
     $(common_CFLAGS) \
     $(LIBNM_GLIB_CFLAGS) \
     $(LIBNM_GTK_CFLAGS)
diff --git a/properties/advanced-dialog.c b/properties/advanced-dialog.c
index 67332e5..4ccae14 100644
--- a/properties/advanced-dialog.c
+++ b/properties/advanced-dialog.c
@@ -20,9 +20,9 @@
  *
  **************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "nm-default.h"
+
+#include "advanced-dialog.h"
 
 #include <string.h>
 #include <sys/types.h>
@@ -32,21 +32,8 @@
 #include <unistd.h>
 #include <errno.h>
 
-#include <glib.h>
-#include <glib/gi18n-lib.h>
-
-#ifdef NM_VPN_OLD
-#define NM_VPN_LIBNM_COMPAT
-#include <nm-connection.h>
-#include <nm-setting-vpn.h>
-
-#else /* !NM_VPN_OLD */
-#include <NetworkManager.h>
-#endif
-
-#include "advanced-dialog.h"
 #include "nm-pptp.h"
-#include "nm-service-defines.h"
+
 
 #define COL_NAME  0
 #define COL_VALUE 1
diff --git a/properties/advanced-dialog.h b/properties/advanced-dialog.h
index d907ef3..e645673 100644
--- a/properties/advanced-dialog.h
+++ b/properties/advanced-dialog.h
@@ -22,11 +22,8 @@
 #ifndef _AUTH_HELPERS_H_
 #define _AUTH_HELPERS_H_
 
-#include <glib.h>
 #include <gtk/gtk.h>
 
-#include <nm-connection.h>
-
 GtkWidget *advanced_dialog_new (GHashTable *hash);
 
 GHashTable *advanced_dialog_new_hash_from_connection (NMConnection *connection, GError **error);
diff --git a/properties/import-export.c b/properties/import-export.c
index 5e94145..3b27df7 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -19,9 +19,9 @@
  *
  **************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "nm-default.h"
+
+#include "import-export.h"
 
 #include <string.h>
 #include <sys/types.h>
@@ -32,13 +32,7 @@
 #include <errno.h>
 #include <ctype.h>
 
-#include <glib/gi18n-lib.h>
-
-#include <NetworkManager.h>
-
-#include "import-export.h"
 #include "nm-pptp.h"
-#include "nm-service-defines.h"
 
 NMConnection *
 do_import (const char *path, char **lines, GError **error)
diff --git a/properties/import-export.h b/properties/import-export.h
index 1c5fbc9..0e787ef 100644
--- a/properties/import-export.h
+++ b/properties/import-export.h
@@ -22,9 +22,6 @@
 #ifndef _IMPORT_EXPORT_H_
 #define _IMPORT_EXPORT_H_
 
-#include <glib.h>
-#include <nm-connection.h>
-
 NMConnection *do_import (const char *path, char **lines, GError **error);
 
 gboolean do_export (const char *path, NMConnection *connection, GError **error);
diff --git a/properties/nm-pptp.c b/properties/nm-pptp.c
index 0fb8af6..506dad4 100644
--- a/properties/nm-pptp.c
+++ b/properties/nm-pptp.c
@@ -22,9 +22,9 @@
  *
  **************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "nm-default.h"
+
+#include "nm-pptp.h"
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -34,22 +34,6 @@
 #include <string.h>
 #include <gtk/gtk.h>
 
-#ifdef NM_VPN_OLD
-#define NM_VPN_LIBNM_COMPAT
-#include <nm-vpn-plugin-ui-interface.h>
-#include <nm-setting-vpn.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-ip4-config.h>
-#include <nm-ui-utils.h>
-
-#else /* !NM_VPN_OLD */
-
-#include <NetworkManager.h>
-#include <nma-ui-utils.h>
-#endif
-
-#include "nm-service-defines.h"
-#include "nm-pptp.h"
 #include "import-export.h"
 #include "advanced-dialog.h"
 
diff --git a/properties/nm-pptp.h b/properties/nm-pptp.h
index 850e4b9..bf3c8c6 100644
--- a/properties/nm-pptp.h
+++ b/properties/nm-pptp.h
@@ -23,26 +23,6 @@
 #ifndef _NM_PPTP_H_
 #define _NM_PPTP_H_
 
-#include <glib-object.h>
-
-#ifdef NM_VPN_OLD
-
-#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_FILE_NOT_VPN        NM_SETTING_VPN_ERROR_UNKNOWN
-#define NMV_EDITOR_PLUGIN_ERROR_FILE_NOT_READABLE   NM_SETTING_VPN_ERROR_UNKNOWN
-
-#else
-
-#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
-#define NMV_EDITOR_PLUGIN_ERROR_FILE_NOT_VPN      NM_CONNECTION_ERROR_FAILED
-#define NMV_EDITOR_PLUGIN_ERROR_FILE_NOT_READABLE NM_CONNECTION_ERROR_FAILED
-
-#endif
-
 #define PPTP_TYPE_PLUGIN_UI            (pptp_plugin_ui_get_type ())
 #define PPTP_PLUGIN_UI(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PPTP_TYPE_PLUGIN_UI, 
PptpPluginUi))
 #define PPTP_PLUGIN_UI_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PPTP_TYPE_PLUGIN_UI, 
PptpPluginUiClass))
@@ -84,5 +64,5 @@ struct _PptpPluginUiWidgetClass {
 
 GType pptp_plugin_ui_widget_get_type (void);
 
-#endif /* _NM_PPTP_H_ */
+#endif /* _NM_PPTP_H_ */
 
diff --git a/shared/nm-default.h b/shared/nm-default.h
index ff0f8da..ae548fb 100644
--- a/shared/nm-default.h
+++ b/shared/nm-default.h
@@ -38,7 +38,10 @@
 
 /*****************************************************************************/
 
+#ifndef ___CONFIG_H__
+#define ___CONFIG_H__
 #include <config.h>
+#endif
 
 /* always include these headers for our internal source files. */
 
diff --git a/src/nm-pptp-pppd-plugin.c b/src/nm-pptp-pppd-plugin.c
index 4567fcc..1ef433e 100644
--- a/src/nm-pptp-pppd-plugin.c
+++ b/src/nm-pptp-pppd-plugin.c
@@ -20,23 +20,26 @@
  *
  */
 
-#include <string.h>
-#include <stdlib.h>
+#include <config.h>
+#define ___CONFIG_H__
+
+/* pppd headers *sigh* */
 #include <pppd/pppd.h>
 #include <pppd/fsm.h>
 #include <pppd/ipcp.h>
+
+#include "nm-default.h"
+
+#include <string.h>
+#include <stdlib.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <dlfcn.h>
-#include <glib.h>
-#include <gio/gio.h>
 
 #include "nm-pptp-service.h"
 #include "nm-ppp-status.h"
 
-#include <NetworkManager.h>
-
 int plugin_init (void);
 
 char pppd_version[] = VERSION;
diff --git a/src/nm-pptp-service.c b/src/nm-pptp-service.c
index 41d2990..a9280fc 100644
--- a/src/nm-pptp-service.c
+++ b/src/nm-pptp-service.c
@@ -20,9 +20,9 @@
  * (C) Copyright 2008 - 2014 Red Hat, Inc.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "nm-default.h"
+
+#include "nm-pptp-service.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -43,11 +43,6 @@
 #include <arpa/inet.h>
 #include <netdb.h>
 
-#include <glib/gi18n.h>
-
-#include <NetworkManager.h>
-
-#include "nm-pptp-service.h"
 #include "nm-ppp-status.h"
 #include "nm-pptp-pppd-service-dbus.h"
 
diff --git a/src/nm-pptp-service.h b/src/nm-pptp-service.h
index 451c6be..1b3ce31 100644
--- a/src/nm-pptp-service.h
+++ b/src/nm-pptp-service.h
@@ -23,13 +23,6 @@
 #ifndef NM_PPTP_PLUGIN_H
 #define NM_PPTP_PLUGIN_H
 
-#include <glib.h>
-#include <glib-object.h>
-#include <NetworkManager.h>
-#include <nm-vpn-service-plugin.h>
-
-#include "nm-service-defines.h"
-
 #define NM_TYPE_PPTP_PLUGIN            (nm_pptp_plugin_get_type ())
 #define NM_PPTP_PLUGIN(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_PPTP_PLUGIN, 
NMPptpPlugin))
 #define NM_PPTP_PLUGIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_PPTP_PLUGIN, 
NMPptpPluginClass))


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