[network-manager-applet/bg/ipv6-disabled] editor: support IPv6 disabled method



commit c1286da33b7d33eabd64f2396618e16547537a3f
Author: Beniamino Galvani <bgalvani redhat com>
Date:   Wed May 29 10:55:32 2019 +0200

    editor: support IPv6 disabled method

 src/connection-editor/page-ip6.c | 26 ++++++++++++++++++++++++--
 1 file 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);


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