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-13 12:31:27 +0200
commit31c0d3c6b8db22ba464024be7e7cbe31da983a29 (patch)
tree69a251bbb97e56da4515e6e08c60d585fcdd8e9c
parent9255dd0879983abae59b105bded869f3bf30d97a (diff)
downloadnetwork-manager-applet-31c0d3c6b8db22ba464024be7e7cbe31da983a29.tar.gz
editor: support IPv6 'disabled' method
NetworkManager 1.20 introduced the 'disabled' IPv6 method. Support it. https://gitlab.gnome.org/GNOME/network-manager-applet/merge_requests/59
-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 98397f6d..13cbc3cc 100644
--- a/src/connection-editor/page-ip6.c
+++ b/src/connection-editor/page-ip6.c
@@ -29,6 +29,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;
@@ -91,6 +96,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
@@ -201,6 +207,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"));
@@ -286,6 +299,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;
@@ -400,6 +414,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))
@@ -1238,6 +1254,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;
@@ -1467,9 +1486,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);