[network-manager-libreswan/th/vpn-editor-split: 9/18] shared: use "nm-default.h" header



commit 05e6c0a52163b0c461e69150dd6467e205a05ecc
Author: Thomas Haller <thaller redhat com>
Date:   Tue May 10 12:22:10 2016 +0200

    shared: use "nm-default.h" header

 auth-dialog/main.c                |   10 +---------
 properties/Makefile.am            |    2 ++
 properties/nm-libreswan.c         |   31 +++----------------------------
 properties/nm-libreswan.h         |    2 --
 src/nm-libreswan-service-helper.c |   12 ++++++------
 src/nm-libreswan-service.c        |    9 ++-------
 src/show-xfrm.c                   |    3 +--
 7 files changed, 15 insertions(+), 54 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index da5e221..92030dd 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -21,24 +21,16 @@
  * (C) Copyright 2004 - 2015 Red Hat, Inc.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "nm-default.h"
 
 #include <errno.h>
 #include <string.h>
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
 
 #define SECRET_API_SUBJECT_TO_CHANGE
 #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 602fab3..bfdf75f 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -19,6 +19,7 @@ common_CFLAGS = \
 ###############################################################################
 
 libnm_vpn_plugin_libreswan_la_CFLAGS = \
+    -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \
     $(common_CFLAGS) \
     $(LIBNM_CFLAGS) \
     $(LIBNMA_CFLAGS)
@@ -39,6 +40,7 @@ libnm_vpn_plugin_libreswan_la_LDFLAGS = \
 
 libnm_libreswan_properties_la_CFLAGS = \
     -DNM_VPN_OLD \
+    -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \
     $(common_CFLAGS) \
     $(LIBNM_GLIB_CFLAGS) \
     $(LIBNM_GTK_CFLAGS)
diff --git a/properties/nm-libreswan.c b/properties/nm-libreswan.c
index 7a5831a..0dbfec9 100644
--- a/properties/nm-libreswan.c
+++ b/properties/nm-libreswan.c
@@ -22,43 +22,18 @@
  *
  **************************************************************************/
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "nm-default.h"
+
+#include "nm-libreswan.h"
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <fcntl.h>
-#include <glib/gi18n-lib.h>
 #include <glib/gstdio.h>
 #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>
-
-#define NMV_EDITOR_PLUGIN_ERROR                  NM_SETTING_VPN_ERROR
-#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_INVALID_PROPERTY NM_CONNECTION_ERROR_INVALID_PROPERTY
-#endif
-
-#include "nm-service-defines.h"
-#include "nm-libreswan.h"
 #include "utils.h"
 
 #define LIBRESWAN_PLUGIN_NAME    _("IPsec based VPN")
diff --git a/properties/nm-libreswan.h b/properties/nm-libreswan.h
index e26ff97..06a05bc 100644
--- a/properties/nm-libreswan.h
+++ b/properties/nm-libreswan.h
@@ -24,8 +24,6 @@
 #ifndef _NM_LIBRESWAN_H_
 #define _NM_LIBRESWAN_H_
 
-#include <glib-object.h>
-
 #define LIBRESWAN_TYPE_EDITOR_PLUGIN            (libreswan_editor_plugin_get_type ())
 #define LIBRESWAN_EDITOR_PLUGIN(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
LIBRESWAN_TYPE_EDITOR_PLUGIN, LibreswanEditorPlugin))
 #define LIBRESWAN_EDITOR_PLUGIN_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), 
LIBRESWAN_TYPE_EDITOR_PLUGIN, LibreswanEditorPluginClass))
diff --git a/src/nm-libreswan-service-helper.c b/src/nm-libreswan-service-helper.c
index 8855619..75d55cb 100644
--- a/src/nm-libreswan-service-helper.c
+++ b/src/nm-libreswan-service-helper.c
@@ -20,12 +20,12 @@
  * Copyright 2015 Red Hat, Inc.
  */
 
-#include <glib.h>
+#include "nm-default.h"
+
 #include <stdlib.h>
 #include <string.h>
 
 #include "nm-libreswan-helper-service-dbus.h"
-#include "nm-service-defines.h"
 
 int
 main (int argc, char *argv[])
@@ -33,7 +33,7 @@ main (int argc, char *argv[])
        NMDBusLibreswanHelper *proxy;
        GVariantBuilder environment;
        GError *err = NULL;
-       gchar **environ;
+       gchar **env;
        gchar **p;
        const char *bus_name;
 
@@ -73,13 +73,13 @@ main (int argc, char *argv[])
        }
 
        g_variant_builder_init (&environment, G_VARIANT_TYPE ("a{ss}"));
-       environ = g_listenv ();
-       for (p = environ; *p; p++) {
+       env = g_listenv ();
+       for (p = env; *p; p++) {
                if (strncmp ("PLUTO_", *p, 6))
                        continue;
                g_variant_builder_add (&environment, "{ss}", *p, g_getenv (*p));
        }
-       g_strfreev (environ);
+       g_strfreev (env);
 
        if (!nmdbus_libreswan_helper_call_callback_sync (proxy,
                                                         g_variant_builder_end (&environment),
diff --git a/src/nm-libreswan-service.c b/src/nm-libreswan-service.c
index ece97cd..b5355d5 100644
--- a/src/nm-libreswan-service.c
+++ b/src/nm-libreswan-service.c
@@ -22,6 +22,8 @@
  * Copyright (C) 2010 - 2015 Red Hat, Inc.
  */
 
+#include "nm-default.h"
+
 #define _GNU_SOURCE 1
 
 #include <netinet/in.h>
@@ -48,14 +50,7 @@
 #include <pty.h>
 #include <sys/types.h>
 
-#include <glib/gi18n.h>
-
-#include <NetworkManager.h>
-#include <nm-vpn-service-plugin.h>
-
 #include "nm-libreswan-helper-service-dbus.h"
-#include "nm-service-defines.h"
-#include "nm-utils.h"
 #include "utils.h"
 
 #if !defined(DIST_VERSION)
diff --git a/src/show-xfrm.c b/src/show-xfrm.c
index daa3b9c..d5fb2c5 100644
--- a/src/show-xfrm.c
+++ b/src/show-xfrm.c
@@ -16,6 +16,7 @@
  * Copyright 2014 Red Hat, Inc.
  */
 
+#include "nm-default.h"
 
 #define _GNU_SOURCE 1
 #include <netlink/netlink.h>
@@ -26,8 +27,6 @@
 #define _LINUX_IN6_H 1
 #include <linux/xfrm.h>
 
-#include <glib.h>
-
 static int
 verify_source (struct nl_msg *msg, gpointer user_data)
 {


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