[network-manager-applet] vpn: construct the editor only when the connection is finished



commit d6f462a8cf2d5e80170161fb9a2b8adf00d55f2a
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Tue Dec 12 14:28:56 2017 +0100

    vpn: construct the editor only when the connection is finished
    
    Otherwise the password always gets lost.

 src/connection-editor/page-vpn.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/src/connection-editor/page-vpn.c b/src/connection-editor/page-vpn.c
index 96cfb6c..ab40700 100644
--- a/src/connection-editor/page-vpn.c
+++ b/src/connection-editor/page-vpn.c
@@ -55,12 +55,20 @@ finish_setup (CEPageVpn *self, gpointer unused, GError *error, gpointer user_dat
 {
        CEPage *parent = CE_PAGE (self);
        CEPageVpnPrivate *priv = CE_PAGE_VPN_GET_PRIVATE (self);
+       GError *local = NULL;
 
        if (error)
                return;
 
        g_return_if_fail (NM_IS_VPN_EDITOR_PLUGIN (priv->plugin));
-       g_return_if_fail (NM_IS_VPN_EDITOR (priv->editor));
+
+       priv->editor = nm_vpn_editor_plugin_get_editor (priv->plugin, CE_PAGE (self)->connection, &local);
+       if (!priv->editor) {
+               g_warning (_("Could not load editor VPN plugin for ā€œ%sā€ (%s)."),
+                          priv->service_type, local ? local->message : _("unknown failure"));
+               g_clear_error (&local);
+               return;
+       }
 
        g_signal_connect (priv->editor, "changed", G_CALLBACK (vpn_plugin_changed_cb), self);
 
@@ -84,7 +92,6 @@ ce_page_vpn_new (NMConnectionEditor *editor,
        CEPageVpn *self;
        CEPageVpnPrivate *priv;
        const char *service_type;
-       GError *local = NULL;
 
        self = CE_PAGE_VPN (ce_page_new (CE_TYPE_PAGE_VPN,
                                         editor,
@@ -116,16 +123,6 @@ ce_page_vpn_new (NMConnectionEditor *editor,
        }
        priv->plugin = g_object_ref (priv->plugin);
 
-       priv->editor = nm_vpn_editor_plugin_get_editor (priv->plugin, CE_PAGE (self)->connection, &local);
-       if (!priv->editor) {
-               g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC,
-                            _("Could not load editor VPN plugin for ā€œ%sā€ (%s)."),
-                            service_type, local ? local->message : _("unknown failure"));
-               g_clear_error (&local);
-               g_object_unref (self);
-               return NULL;
-       }
-
        g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
 
        *out_secrets_setting_name = NM_SETTING_VPN_SETTING_NAME;


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