[network-manager-applet] connection-editor: show the IPv6 page for VPNs that support it



commit 2d564dab4c26045748b0efe4d016aabdb2a36dc3
Author: Dan Winship <danw gnome org>
Date:   Thu May 31 06:50:42 2012 -0400

    connection-editor: show the IPv6 page for VPNs that support it

 src/connection-editor/nm-connection-editor.c |    4 ++++
 src/connection-editor/vpn-helpers.c          |   20 ++++++++++++++++++++
 src/connection-editor/vpn-helpers.h          |    2 ++
 3 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index 5540f96..65f8ba3 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -64,6 +64,7 @@
 #include "page-ppp.h"
 #include "page-vpn.h"
 #include "ce-polkit-button.h"
+#include "vpn-helpers.h"
 
 G_DEFINE_TYPE (NMConnectionEditor, nm_connection_editor, G_TYPE_OBJECT)
 
@@ -754,6 +755,9 @@ nm_connection_editor_set_connection (NMConnectionEditor *editor,
 			goto out;
 		if (!add_page (editor, ce_page_ip4_new, editor->connection, error))
 			goto out;
+		if (   vpn_supports_ipv6 (editor->connection)
+			&& !add_page (editor, ce_page_ip6_new, editor->connection, error))
+			goto out;
 	} else if (!strcmp (connection_type, NM_SETTING_PPPOE_SETTING_NAME)) {
 		if (!add_page (editor, ce_page_dsl_new, editor->connection, error))
 			goto out;
diff --git a/src/connection-editor/vpn-helpers.c b/src/connection-editor/vpn-helpers.c
index 8b16207..12547fe 100644
--- a/src/connection-editor/vpn-helpers.c
+++ b/src/connection-editor/vpn-helpers.c
@@ -552,3 +552,23 @@ out:
 	return NULL;
 }
 
+gboolean
+vpn_supports_ipv6 (NMConnection *connection)
+{
+	NMSettingVPN *s_vpn;
+	const char *service_type;
+	NMVpnPluginUiInterface *plugin;
+	guint32 capabilities;
+
+	s_vpn = nm_connection_get_setting_vpn (connection);
+	g_return_val_if_fail (s_vpn != NULL, FALSE);
+
+	service_type = nm_setting_vpn_get_service_type (s_vpn);
+	g_return_val_if_fail (service_type != NULL, FALSE);
+
+	plugin = vpn_get_plugin_by_service (service_type);
+	g_return_val_if_fail (plugin != NULL, FALSE);
+
+	capabilities = nm_vpn_plugin_ui_interface_get_capabilities (plugin);
+	return (capabilities & NM_VPN_PLUGIN_UI_CAPABILITY_IPV6) != 0;
+}
diff --git a/src/connection-editor/vpn-helpers.h b/src/connection-editor/vpn-helpers.h
index f7cd1cb..c46372d 100644
--- a/src/connection-editor/vpn-helpers.h
+++ b/src/connection-editor/vpn-helpers.h
@@ -41,4 +41,6 @@ void vpn_export (NMConnection *connection);
 
 char *vpn_ask_connection_type (GtkWindow *parent);
 
+gboolean vpn_supports_ipv6 (NMConnection *connection);
+
 #endif  /* _VPN_HELPERS_H_ */



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