Commit 31c0d3c6 authored by Beniamino Galvani's avatar Beniamino Galvani

editor: support IPv6 'disabled' method

NetworkManager 1.20 introduced the 'disabled' IPv6 method. Support it.

!59
parent 9255dd08
Pipeline #114616 passed with stages
in 18 minutes and 21 seconds
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment