[network-manager-applet/th/proxy-bgo621767: 6/6] proxy: add compatibility for building against libnm-1-4 without proxy support
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/th/proxy-bgo621767: 6/6] proxy: add compatibility for building against libnm-1-4 without proxy support
- Date: Tue, 6 Dec 2016 13:58:21 +0000 (UTC)
commit 8eca6fdc4f449aa17e6e41b2ba075fd5665eb584
Author: Thomas Haller <thaller redhat com>
Date: Tue Oct 4 15:00:47 2016 +0200
proxy: add compatibility for building against libnm-1-4 without proxy support
shared/nm-libnm-compat.h | 16 ++++++++++++++++
src/connection-editor/connection-helpers.c | 5 ++++-
src/connection-editor/nm-connection-editor.c | 4 ++++
src/connection-editor/nm-connection-list.c | 4 ++++
src/connection-editor/page-proxy.c | 7 ++++++-
src/connection-editor/page-proxy.h | 7 ++++---
6 files changed, 38 insertions(+), 5 deletions(-)
---
diff --git a/shared/nm-libnm-compat.h b/shared/nm-libnm-compat.h
index 7023cb3..dd6b48c 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 a4a37d4..4ad014a 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 ea7d399..6032a98 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 525b68b..7fc482a 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 29f18a7..af0c2e5 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)
@@ -312,3 +315,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 dc78185..9e5afb3 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__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]