summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-10-04 15:00:47 +0200
committerThomas Haller <thaller@redhat.com>2016-12-16 15:04:50 +0100
commit90b9f92d42a491521d463925543ba4c8b0d94066 (patch)
treebfa4c49d70ea02b41de8697ba2c70f052f9c57b4
parent68b93510a85fb13c32117e46c047ee273b7e868d (diff)
downloadnetwork-manager-applet-90b9f92d42a491521d463925543ba4c8b0d94066.tar.gz
proxy: add compatibility for building against libnm-1-4 without proxy support
-rw-r--r--shared/nm-libnm-compat.h16
-rw-r--r--src/connection-editor/connection-helpers.c5
-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.c7
-rw-r--r--src/connection-editor/page-proxy.h7
6 files changed, 38 insertions, 5 deletions
diff --git a/shared/nm-libnm-compat.h b/shared/nm-libnm-compat.h
index 7023cb3f..dd6b48c6 100644
--- a/shared/nm-libnm-compat.h
+++ b/shared/nm-libnm-compat.h
@@ -22,4 +22,20 @@
#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))
+
+#define nm_setting_proxy_new(setting) NM_LIBNM_COMPAT_UNDEPRECATE (nm_setting_proxy_new (setting))
+#define nm_setting_proxy_get_method(setting) NM_LIBNM_COMPAT_UNDEPRECATE (nm_setting_proxy_get_method (setting))
+#define nm_setting_proxy_get_pac_url(setting) NM_LIBNM_COMPAT_UNDEPRECATE (nm_setting_proxy_get_pac_url (setting))
+#define nm_setting_proxy_get_pac_script(setting) NM_LIBNM_COMPAT_UNDEPRECATE (nm_setting_proxy_get_pac_script (setting))
+#define nm_setting_proxy_get_browser_only(setting) NM_LIBNM_COMPAT_UNDEPRECATE (nm_setting_proxy_get_browser_only (setting))
+#define nm_connection_get_setting_proxy(connection) NM_LIBNM_COMPAT_UNDEPRECATE (nm_connection_get_setting_proxy (connection))
+
#endif /* __NM_LIBNM_COMPAT_H__ */
diff --git a/src/connection-editor/connection-helpers.c b/src/connection-editor/connection-helpers.c
index a4a37d4a..4ad014a9 100644
--- a/src/connection-editor/connection-helpers.c
+++ b/src/connection-editor/connection-helpers.c
@@ -795,9 +795,12 @@ connection_supports_proxy (NMConnection *connection)
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
- /* Same Stuff as IP4 */
+#if NM_LIBNM_COMPAT_PROXY_SUPPORTED
s_con = nm_connection_get_setting_connection (connection);
return (nm_setting_connection_get_slave_type (s_con) == NULL);
+#else
+ return FALSE;
+#endif
}
gboolean
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index ea7d3992..6032a98a 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -813,9 +813,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 525b68ba..7fc482af 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -278,8 +278,12 @@ really_add_connection (FUNC_TAG_NEW_CONNECTION_RESULT_IMPL,
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 47bbe35e..45436e28 100644
--- a/src/connection-editor/page-proxy.c
+++ b/src/connection-editor/page-proxy.c
@@ -20,11 +20,14 @@
#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)
@@ -314,3 +317,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__ */