summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2019-05-29 10:55:32 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2019-09-06 16:20:45 +0200
commit72d2e5c394a7d31a6d966b1a21b0b9c839a5b997 (patch)
tree1af26e8b96c11a8be6eaecf5b0e3f98baec3afa7
parent6c40bef29e11f0cd3f60262731150c1a152159bb (diff)
downloadnetwork-manager-applet-bg/ipv6-disabled.tar.gz
editor: support IPv6 'disabled' methodbg/ipv6-disabled
NetworkManager 1.20 introduced the 'disabled' IPv6 method. Support it.
-rw-r--r--src/connection-editor/page-ip6.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c
index 0c82b33d..3c5ba520 100644
--- a/src/connection-editor/page-ip6.c
+++ b/src/connection-editor/page-ip6.c
@@ -43,6 +43,11 @@ G_DEFINE_TYPE (CEPageIP6, ce_page_ip6, CE_TYPE_PAGE)
#define COL_GATEWAY 2
#define COL_LAST COL_GATEWAY
+/* Disabled method was added in NM 1.20 */
+#ifndef NM_SETTING_IP6_CONFIG_METHOD_DISABLED
+#define NM_SETTING_IP6_CONFIG_METHOD_DISABLED "disabled"
+#endif
+
typedef struct {
NMSettingIPConfig *setting;
char *connection_id;
@@ -105,6 +110,7 @@ typedef struct {
#define IP6_METHOD_MANUAL 4
#define IP6_METHOD_LINK_LOCAL 5
#define IP6_METHOD_SHARED 6
+#define IP6_METHOD_DISABLED 7
#define IP6_PRIVACY_DISABLED 0
#define IP6_PRIVACY_PREFER_PUBLIC 1
@@ -215,6 +221,13 @@ ip6_private_init (CEPageIP6 *self, NMConnection *connection)
-1);
}
+ gtk_list_store_append (priv->method_store, &iter);
+ gtk_list_store_set (priv->method_store, &iter,
+ METHOD_COL_NAME, _("Disabled"),
+ METHOD_COL_NUM, IP6_METHOD_DISABLED,
+ METHOD_COL_ENABLED, TRUE,
+ -1);
+
gtk_combo_box_set_model (priv->method, GTK_TREE_MODEL (priv->method_store));
priv->addr_label = GTK_WIDGET (gtk_builder_get_object (builder, "ip6_addr_label"));
@@ -300,6 +313,7 @@ method_changed (GtkComboBox *combo, gpointer user_data)
label = CE_LABEL_ADDR_SHARED;
break;
case IP6_METHOD_IGNORE:
+ case IP6_METHOD_DISABLED:
ip6_required_enabled = FALSE;
ip6_addr_gen_mode_enabled = FALSE;
break;
@@ -414,6 +428,8 @@ populate_ui (CEPageIP6 *self)
method = IP6_METHOD_MANUAL;
else if (!strcmp (str_method, NM_SETTING_IP6_CONFIG_METHOD_SHARED))
method = IP6_METHOD_SHARED;
+ else if (!strcmp (str_method, NM_SETTING_IP6_CONFIG_METHOD_DISABLED))
+ method = IP6_METHOD_DISABLED;
}
if (method == IP6_METHOD_AUTO && nm_setting_ip_config_get_ignore_auto_dns (setting))
@@ -1252,6 +1268,9 @@ ui_to_setting (CEPageIP6 *self, GError **error)
case IP6_METHOD_IGNORE:
method = NM_SETTING_IP6_CONFIG_METHOD_IGNORE;
break;
+ case IP6_METHOD_DISABLED:
+ method = NM_SETTING_IP6_CONFIG_METHOD_DISABLED;
+ break;
case IP6_METHOD_LINK_LOCAL:
method = NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL;
break;
@@ -1481,9 +1500,12 @@ change_method_combo (CEPage *page, gboolean is_hotspot)
if (is_hotspot) {
if (priv->hotspot_method_idx == -1) {
int method = IP6_METHOD_SHARED;
- if (g_strcmp0 (nm_setting_ip_config_get_method (priv->setting),
- NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0)
+ if (nm_streq0 (nm_setting_ip_config_get_method (priv->setting),
+ NM_SETTING_IP6_CONFIG_METHOD_IGNORE))
method = IP6_METHOD_IGNORE;
+ else if (nm_streq0 (nm_setting_ip_config_get_method (priv->setting),
+ NM_SETTING_IP6_CONFIG_METHOD_DISABLED))
+ method = IP6_METHOD_DISABLED;
gtk_combo_box_set_active (priv->method, method);
} else
gtk_combo_box_set_active (priv->method, priv->hotspot_method_idx);