summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-10-04 15:00:47 +0200
committerThomas Haller <thaller@redhat.com>2016-10-04 15:24:56 +0200
commit1daaf4984fdbe3df70ce1b7c05620df3d7aef566 (patch)
tree54a66ccc6f5203ace2b0a50ebeed93f9724a7522
parentca7b32430a2b7627ca729e66bf6ef19e026acec5 (diff)
downloadnetwork-manager-applet-th/proxy.tar.gz
WIP: proxy: add compatibility for building against libnm-1-4 without proxy supportth/proxy-bgo621767-1th/proxy
-rw-r--r--shared/nm-libnm-compat.h9
-rw-r--r--src/connection-editor/nm-connection-editor.c4
-rw-r--r--src/connection-editor/nm-connection-list.c4
-rw-r--r--src/connection-editor/page-proxy.c10
-rw-r--r--src/connection-editor/page-proxy.h7
5 files changed, 30 insertions, 4 deletions
diff --git a/shared/nm-libnm-compat.h b/shared/nm-libnm-compat.h
index 7023cb3f..d2579b91 100644
--- a/shared/nm-libnm-compat.h
+++ b/shared/nm-libnm-compat.h
@@ -22,4 +22,13 @@
#ifndef __NM_LIBNM_COMPAT_H__
#define __NM_LIBNM_COMPAT_H__
+#define NM_LIBNM_COMPAT_UNDEPRECATE(cmd) \
+ ({ \
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
+ (cmd); \
+ G_GNUC_END_IGNORE_DEPRECATIONS \
+ })
+
+#define NM_LIBNM_COMPAT_PROXY_SUPPORTED (NM_CHECK_VERSION (1, 5, 0))
+
#endif /* __NM_LIBNM_COMPAT_H__ */
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index 0a7416ef..c3e57532 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -831,9 +831,13 @@ nm_connection_editor_set_connection (NMConnectionEditor *editor,
goto out;
}
+#if NM_LIBNM_COMPAT_PROXY_SUPPORTED
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if ( nm_connection_get_setting_proxy (editor->connection)
&& !add_page (editor, ce_page_proxy_new, editor->connection, error))
goto out;
+ G_GNUC_END_IGNORE_DEPRECATIONS
+#endif
if ( nm_connection_get_setting_ip4_config (editor->connection)
&& !add_page (editor, ce_page_ip4_new, editor->connection, error))
goto out;
diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c
index 85173fc7..62564794 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -277,8 +277,12 @@ really_add_connection (NMConnection *connection,
return;
}
+#if NM_LIBNM_COMPAT_PROXY_SUPPORTED
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (connection_supports_proxy (connection) && !nm_connection_get_setting_proxy (connection))
nm_connection_add_setting (connection, nm_setting_proxy_new ());
+ G_GNUC_END_IGNORE_DEPRECATIONS
+#endif
if (connection_supports_ip4 (connection) && !nm_connection_get_setting_ip4_config (connection))
nm_connection_add_setting (connection, nm_setting_ip4_config_new ());
if (connection_supports_ip6 (connection) && !nm_connection_get_setting_ip6_config (connection))
diff --git a/src/connection-editor/page-proxy.c b/src/connection-editor/page-proxy.c
index 8711f9dc..015dd5b3 100644
--- a/src/connection-editor/page-proxy.c
+++ b/src/connection-editor/page-proxy.c
@@ -18,13 +18,19 @@
* (C) Copyright 2016 Atul Anand <atulhjp@gmail.com>.
*/
+#undef NM_VERSION_MAX_ALLOWED
+#define NM_VERSION_MAX_ALLOWED NM_VERSION_1_6
+
#include "nm-default.h"
+#if NM_LIBNM_COMPAT_PROXY_SUPPORTED
+
+#include "page-proxy.h"
+
#include <string.h>
#include <errno.h>
#include <stdlib.h>
-#include "page-proxy.h"
#include "nm-connection-editor.h"
G_DEFINE_TYPE (CEPageProxy, ce_page_proxy, CE_TYPE_PAGE)
@@ -484,3 +490,5 @@ ce_page_proxy_class_init (CEPageProxyClass *proxy_class)
/* virtual methods */
parent_class->ce_page_validate_v = ce_page_validate_v;
}
+
+#endif /* NM_LIBNM_COMPAT_PROXY_SUPPORTED */
diff --git a/src/connection-editor/page-proxy.h b/src/connection-editor/page-proxy.h
index dc781859..9e5afb32 100644
--- a/src/connection-editor/page-proxy.h
+++ b/src/connection-editor/page-proxy.h
@@ -21,11 +21,10 @@
#ifndef __PAGE_PROXY_H__
#define __PAGE_PROXY_H__
-#include <glib.h>
-#include <glib-object.h>
-
#include "ce-page.h"
+#if NM_LIBNM_COMPAT_PROXY_SUPPORTED
+
#define CE_TYPE_PAGE_PROXY (ce_page_proxy_get_type ())
#define CE_PAGE_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CE_TYPE_PAGE_PROXY, CEPageProxy))
#define CE_PAGE_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CE_TYPE_PAGE_PROXY, CEPageProxyClass))
@@ -50,4 +49,6 @@ CEPage *ce_page_proxy_new (NMConnectionEditor *editor,
const char **out_secrets_setting_name,
GError **error);
+#endif /* NM_LIBNM_COMPAT_PROXY_SUPPORTED */
+
#endif /* __PAGE_PROXY_H__ */