[network-manager-applet/lr/vlan-connection-add: 1/2] editor: don't add L3 configuration automatically



commit f06b8e3f972c76cb48437d384622cbb2f8ee8584
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Mon Jun 8 05:13:18 2015 +0200

    editor: don't add L3 configuration automatically
    
    Don't add it to connections which don't have it already and only add it if
    we're creating a new top-level connections (not a master connection or a vlan
    parent).

 src/connection-editor/nm-connection-editor.c |    4 ++--
 src/connection-editor/nm-connection-list.c   |    5 +++++
 src/connection-editor/page-ip4.c             |    5 +----
 src/connection-editor/page-ip6.c             |    5 +----
 4 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index 30742c8..9e74e8c 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -803,10 +803,10 @@ nm_connection_editor_set_connection (NMConnectionEditor *editor,
                        goto out;
        }
 
-       if (   connection_supports_ip4 (editor->connection)
+       if (   nm_connection_get_setting_ip4_config (editor->connection)
            && !add_page (editor, ce_page_ip4_new, editor->connection, error))
                goto out;
-       if (   connection_supports_ip6 (editor->connection)
+       if (   nm_connection_get_setting_ip6_config (editor->connection)
            && !add_page (editor, ce_page_ip6_new, editor->connection, error))
                goto out;
 
diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c
index bfed52a..3b6b064 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -280,6 +280,11 @@ really_add_connection (NMConnection *connection,
                return;
        }
 
+       if (connection_supports_ip4 (connection))
+               nm_connection_add_setting (connection, nm_setting_ip4_config_new ());
+       if (connection_supports_ip6 (connection))
+               nm_connection_add_setting (connection, nm_setting_ip6_config_new ());
+
        editor = nm_connection_editor_new (GTK_WINDOW (list->dialog), connection, list->client);
        if (!editor) {
                g_object_unref (connection);
diff --git a/src/connection-editor/page-ip4.c b/src/connection-editor/page-ip4.c
index b431552..30f3384 100644
--- a/src/connection-editor/page-ip4.c
+++ b/src/connection-editor/page-ip4.c
@@ -1160,10 +1160,7 @@ ce_page_ip4_new (NMConnection *connection,
        priv->connection_id = g_strdup (nm_setting_connection_get_id (s_con));
 
        priv->setting = nm_connection_get_setting_ip4_config (connection);
-       if (!priv->setting) {
-               priv->setting = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
-               nm_connection_add_setting (connection, NM_SETTING (priv->setting));
-       }
+       g_assert (priv->setting);
 
        g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
 
diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c
index 69dfd3a..6c0e9f4 100644
--- a/src/connection-editor/page-ip6.c
+++ b/src/connection-editor/page-ip6.c
@@ -1168,10 +1168,7 @@ ce_page_ip6_new (NMConnection *connection,
        priv->connection_id = g_strdup (nm_setting_connection_get_id (s_con));
 
        priv->setting = nm_connection_get_setting_ip6_config (connection);
-       if (!priv->setting) {
-               priv->setting = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ());
-               nm_connection_add_setting (connection, NM_SETTING (priv->setting));
-       }
+       g_assert (priv->setting);
 
        g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
 


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