summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-07-25 11:49:55 -0400
committerDan Winship <danw@gnome.org>2014-07-25 11:50:54 -0400
commit1c7f3792d5af9311ad85ff720503eec6f2c2a505 (patch)
tree894ac7c085436f5152a718301bd7f91481f69607
parent30f4df4c755ad2eb53bc00778c7aeca9dc37785f (diff)
parenta5e16733640465502bed43e55a2e0fc605f41822 (diff)
downloadnetwork-manager-applet-1c7f3792d5af9311ad85ff720503eec6f2c2a505.tar.gz
connection-editor: support IPv6 on mobile devices (bgo #733713)
-rw-r--r--src/connection-editor/Makefile.am4
-rw-r--r--src/connection-editor/connection-helpers.c (renamed from src/connection-editor/new-connection.c)34
-rw-r--r--src/connection-editor/connection-helpers.h (renamed from src/connection-editor/new-connection.h)3
-rw-r--r--src/connection-editor/nm-connection-editor.c16
-rw-r--r--src/connection-editor/nm-connection-list.c2
-rw-r--r--src/connection-editor/page-bond.c2
-rw-r--r--src/connection-editor/page-bridge.c2
-rw-r--r--src/connection-editor/page-ip4.c10
-rw-r--r--src/connection-editor/page-ip6.c4
-rw-r--r--src/connection-editor/page-master.h2
-rw-r--r--src/connection-editor/page-team.c2
-rw-r--r--src/connection-editor/page-vpn.c2
12 files changed, 54 insertions, 29 deletions
diff --git a/src/connection-editor/Makefile.am b/src/connection-editor/Makefile.am
index 5554c243..89923e7e 100644
--- a/src/connection-editor/Makefile.am
+++ b/src/connection-editor/Makefile.am
@@ -78,8 +78,8 @@ nm_connection_editor_SOURCES = \
ppp-auth-methods-dialog.h \
ce-polkit-button.c \
ce-polkit-button.h \
- new-connection.c \
- new-connection.h
+ connection-helpers.c \
+ connection-helpers.h
nm-connection-editor-service-glue.h: $(top_srcdir)/src/connection-editor/nm-connection-editor-service.xml
$(AM_V_GEN) dbus-binding-tool --prefix=nm_connection_editor_service --mode=glib-server --output=$@ $<
diff --git a/src/connection-editor/new-connection.c b/src/connection-editor/connection-helpers.c
index ed3a7424..1d748670 100644
--- a/src/connection-editor/new-connection.c
+++ b/src/connection-editor/connection-helpers.c
@@ -22,7 +22,7 @@
#include <glib/gi18n.h>
-#include "new-connection.h"
+#include "connection-helpers.h"
#include "nm-connection-list.h"
#include "nm-connection-editor.h"
#include "page-ethernet.h"
@@ -590,3 +590,35 @@ delete_connection (GtkWindow *parent_window,
nm_remote_connection_delete (connection, delete_cb, info);
}
+
+gboolean
+connection_supports_ip4 (NMConnection *connection)
+{
+ NMSettingConnection *s_con;
+
+ g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
+
+ s_con = nm_connection_get_setting_connection (connection);
+ return (nm_setting_connection_get_slave_type (s_con) == NULL);
+}
+
+gboolean
+connection_supports_ip6 (NMConnection *connection)
+{
+ NMSettingConnection *s_con;
+ const char *connection_type;
+
+ g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
+
+ s_con = nm_connection_get_setting_connection (connection);
+ if (nm_setting_connection_get_slave_type (s_con) != NULL)
+ return FALSE;
+
+ connection_type = nm_setting_connection_get_connection_type (s_con);
+ if (!strcmp (connection_type, NM_SETTING_VPN_SETTING_NAME))
+ return vpn_supports_ipv6 (connection);
+ else if (!strcmp (connection_type, NM_SETTING_PPPOE_SETTING_NAME))
+ return FALSE;
+ else
+ return TRUE;
+}
diff --git a/src/connection-editor/new-connection.h b/src/connection-editor/connection-helpers.h
index cef2afed..ae60ec0e 100644
--- a/src/connection-editor/new-connection.h
+++ b/src/connection-editor/connection-helpers.h
@@ -67,5 +67,8 @@ void delete_connection (GtkWindow *parent_window,
DeleteConnectionResultFunc result_func,
gpointer user_data);
+gboolean connection_supports_ip4 (NMConnection *connection);
+gboolean connection_supports_ip6 (NMConnection *connection);
+
#endif /* __CONNECTION_HELPERS_H__ */
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index b3a3772f..00a0f98b 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -729,7 +729,6 @@ nm_connection_editor_set_connection (NMConnectionEditor *editor,
const char *slave_type;
gboolean success = FALSE;
GSList *iter, *copy;
- gboolean add_ip4 = TRUE, add_ip6 = TRUE;
g_return_val_if_fail (NM_IS_CONNECTION_EDITOR (editor), FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (orig_connection), FALSE);
@@ -767,7 +766,6 @@ nm_connection_editor_set_connection (NMConnectionEditor *editor,
} else if (!strcmp (connection_type, NM_SETTING_VPN_SETTING_NAME)) {
if (!add_page (editor, ce_page_vpn_new, editor->connection, error))
goto out;
- add_ip6 = vpn_supports_ipv6 (editor->connection);
} else if (!strcmp (connection_type, NM_SETTING_PPPOE_SETTING_NAME)) {
if (!add_page (editor, ce_page_dsl_new, editor->connection, error))
goto out;
@@ -775,14 +773,12 @@ nm_connection_editor_set_connection (NMConnectionEditor *editor,
goto out;
if (!add_page (editor, ce_page_ppp_new, editor->connection, error))
goto out;
- add_ip6 = FALSE;
} else if (!strcmp (connection_type, NM_SETTING_GSM_SETTING_NAME) ||
!strcmp (connection_type, NM_SETTING_CDMA_SETTING_NAME)) {
if (!add_page (editor, ce_page_mobile_new, editor->connection, error))
goto out;
if (!add_page (editor, ce_page_ppp_new, editor->connection, error))
goto out;
- add_ip6 = FALSE;
} else if (!strcmp (connection_type, NM_SETTING_WIMAX_SETTING_NAME)) {
if (!add_page (editor, ce_page_wimax_new, editor->connection, error))
goto out;
@@ -806,21 +802,19 @@ nm_connection_editor_set_connection (NMConnectionEditor *editor,
}
slave_type = nm_setting_connection_get_slave_type (s_con);
- if (!g_strcmp0 (slave_type, NM_SETTING_BOND_SETTING_NAME))
- add_ip4 = add_ip6 = FALSE;
- else if (!g_strcmp0 (slave_type, NM_SETTING_TEAM_SETTING_NAME)) {
- add_ip4 = add_ip6 = FALSE;
+ if (!g_strcmp0 (slave_type, NM_SETTING_TEAM_SETTING_NAME)) {
if (!add_page (editor, ce_page_team_port_new, editor->connection, error))
goto out;
} else if (!g_strcmp0 (slave_type, NM_SETTING_BRIDGE_SETTING_NAME)) {
- add_ip4 = add_ip6 = FALSE;
if (!add_page (editor, ce_page_bridge_port_new, editor->connection, error))
goto out;
}
- if (add_ip4 && !add_page (editor, ce_page_ip4_new, editor->connection, error))
+ if ( connection_supports_ip4 (editor->connection)
+ && !add_page (editor, ce_page_ip4_new, editor->connection, error))
goto out;
- if (add_ip6 && !add_page (editor, ce_page_ip6_new, editor->connection, error))
+ if ( connection_supports_ip6 (editor->connection)
+ && !add_page (editor, ce_page_ip6_new, editor->connection, error))
goto out;
/* After all pages are created, then kick off secrets requests that any
diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c
index ceb7432d..1e6846a7 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -52,7 +52,7 @@
#include "nm-connection-list.h"
#include "vpn-helpers.h"
#include "ce-polkit-button.h"
-#include "new-connection.h"
+#include "connection-helpers.h"
G_DEFINE_TYPE (NMConnectionList, nm_connection_list, G_TYPE_OBJECT)
diff --git a/src/connection-editor/page-bond.c b/src/connection-editor/page-bond.c
index 718a3985..d05b0b70 100644
--- a/src/connection-editor/page-bond.c
+++ b/src/connection-editor/page-bond.c
@@ -31,7 +31,7 @@
#include "page-bond.h"
#include "page-infiniband.h"
#include "nm-connection-editor.h"
-#include "new-connection.h"
+#include "connection-helpers.h"
G_DEFINE_TYPE (CEPageBond, ce_page_bond, CE_TYPE_PAGE_MASTER)
diff --git a/src/connection-editor/page-bridge.c b/src/connection-editor/page-bridge.c
index 05936512..2221e070 100644
--- a/src/connection-editor/page-bridge.c
+++ b/src/connection-editor/page-bridge.c
@@ -30,7 +30,7 @@
#include "page-bridge.h"
#include "nm-connection-editor.h"
-#include "new-connection.h"
+#include "connection-helpers.h"
G_DEFINE_TYPE (CEPageBridge, ce_page_bridge, CE_TYPE_PAGE_MASTER)
diff --git a/src/connection-editor/page-ip4.c b/src/connection-editor/page-ip4.c
index e35e8ac9..fe1a5759 100644
--- a/src/connection-editor/page-ip4.c
+++ b/src/connection-editor/page-ip4.c
@@ -45,6 +45,7 @@
#include "page-ip4.h"
#include "ip4-routes-dialog.h"
+#include "connection-helpers.h"
G_DEFINE_TYPE (CEPageIP4, ce_page_ip4, CE_TYPE_PAGE)
@@ -134,8 +135,8 @@ ip4_private_init (CEPageIP4 *self, NMConnection *connection)
str_auto_only = _("Automatic (VPN) addresses only");
} else if ( priv->connection_type == NM_TYPE_SETTING_GSM
|| priv->connection_type == NM_TYPE_SETTING_CDMA) {
- str_auto = _("Automatic (PPP)");
- str_auto_only = _("Automatic (PPP) addresses only");
+ str_auto = _("Automatic");
+ str_auto_only = _("Automatic, addresses only");
} else if (priv->connection_type == NM_TYPE_SETTING_PPPOE) {
str_auto = _("Automatic (PPPoE)");
str_auto_only = _("Automatic (PPPoE) addresses only");
@@ -189,9 +190,8 @@ ip4_private_init (CEPageIP4 *self, NMConnection *connection)
-1);
}
- /* At the moment, Disabled is only supported for Ethernet & Wi-Fi */
- if ( priv->connection_type == NM_TYPE_SETTING_WIRED
- || priv->connection_type == NM_TYPE_SETTING_WIRELESS) {
+ /* Disabled is only supported for types that also support IPv6 */
+ if (connection_supports_ip6 (connection)) {
gtk_list_store_append (priv->method_store, &iter);
gtk_list_store_set (priv->method_store, &iter,
METHOD_COL_NAME, _("Disabled"),
diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c
index 7dfea809..57964417 100644
--- a/src/connection-editor/page-ip6.c
+++ b/src/connection-editor/page-ip6.c
@@ -139,10 +139,6 @@ ip6_private_init (CEPageIP6 *self, NMConnection *connection)
if (priv->connection_type == NM_TYPE_SETTING_VPN) {
str_auto = _("Automatic (VPN)");
str_auto_only = _("Automatic (VPN) addresses only");
- } else if ( priv->connection_type == NM_TYPE_SETTING_GSM
- || priv->connection_type == NM_TYPE_SETTING_CDMA) {
- str_auto = _("Automatic (PPP)");
- str_auto_only = _("Automatic (PPP) addresses only");
} else if (priv->connection_type == NM_TYPE_SETTING_PPPOE) {
str_auto = _("Automatic (PPPoE)");
str_auto_only = _("Automatic (PPPoE) addresses only");
diff --git a/src/connection-editor/page-master.h b/src/connection-editor/page-master.h
index 56cc6c41..380d8964 100644
--- a/src/connection-editor/page-master.h
+++ b/src/connection-editor/page-master.h
@@ -27,7 +27,7 @@
#include <glib-object.h>
#include "ce-page.h"
-#include "new-connection.h"
+#include "connection-helpers.h"
#define CE_TYPE_PAGE_MASTER (ce_page_master_get_type ())
#define CE_PAGE_MASTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CE_TYPE_PAGE_MASTER, CEPageMaster))
diff --git a/src/connection-editor/page-team.c b/src/connection-editor/page-team.c
index 05be62d3..26e3432f 100644
--- a/src/connection-editor/page-team.c
+++ b/src/connection-editor/page-team.c
@@ -30,7 +30,7 @@
#include "page-team.h"
#include "page-infiniband.h"
#include "nm-connection-editor.h"
-#include "new-connection.h"
+#include "connection-helpers.h"
G_DEFINE_TYPE (CEPageTeam, ce_page_team, CE_TYPE_PAGE_MASTER)
diff --git a/src/connection-editor/page-vpn.c b/src/connection-editor/page-vpn.c
index 080b422c..81592c8d 100644
--- a/src/connection-editor/page-vpn.c
+++ b/src/connection-editor/page-vpn.c
@@ -35,7 +35,7 @@
#include <nm-vpn-plugin-ui-interface.h>
#include "page-vpn.h"
-#include "new-connection.h"
+#include "connection-helpers.h"
#include "nm-connection-editor.h"
#include "vpn-helpers.h"