[network-manager-libreswan/th/vpn-service-info-bgo767197: 2/2] TEST: hack nm-libreswan to allow it to actually create and edit two sevice-types (libreswan and open



commit 3aed8bee7b9a0013cd2f97683262dce9cf81177f
Author: Thomas Haller <thaller redhat com>
Date:   Tue Jun 7 14:54:57 2016 +0200

    TEST: hack nm-libreswan to allow it to actually create and edit two sevice-types (libreswan and openswan)
    
    This will not be commited, as nm-libreswan support openswan only
    to preseve backward compatibility.

 properties/nm-libreswan-editor-plugin.c |    2 +-
 properties/nm-libreswan-editor.c        |    7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/properties/nm-libreswan-editor-plugin.c b/properties/nm-libreswan-editor-plugin.c
index d59bfea..96ccd58 100644
--- a/properties/nm-libreswan-editor-plugin.c
+++ b/properties/nm-libreswan-editor-plugin.c
@@ -157,7 +157,7 @@ call (NMVpnEditorPlugin *plugin,
                        g_value_set_string (args_out[0], "openswan");
                        g_value_set_string (args_out[1], _("IPSec based VPN (openswan)"));
                        g_value_set_string (args_out[2], _("IPsec based VPN using IKEv1 (openswan)"));
-                       g_value_set_uint (args_out[3], NM_VPN_EDITOR_PLUGIN_SERVICE_FLAGS_NONE);
+                       g_value_set_uint (args_out[3], NM_VPN_EDITOR_PLUGIN_SERVICE_FLAGS_CAN_ADD);
                        return TRUE;
                }
                g_set_error (error, NM_VPN_PLUGIN_ERROR, NM_VPN_PLUGIN_ERROR_CALL_INVALID_ARGUMENT,
diff --git a/properties/nm-libreswan-editor.c b/properties/nm-libreswan-editor.c
index b4e4a39..02f23e8 100644
--- a/properties/nm-libreswan-editor.c
+++ b/properties/nm-libreswan-editor.c
@@ -352,12 +352,17 @@ update_connection (NMVpnEditor *iface,
        NMSettingVpn *s_vpn;
        GtkWidget *widget;
        char *str;
+       const char *service_type = NULL;
 
        if (!check_validity (self, error))
                return FALSE;
 
+       s_vpn = nm_connection_get_setting_vpn (connection);
+       if (s_vpn)
+               service_type = nm_setting_vpn_get_service_type (s_vpn);
+
        s_vpn = NM_SETTING_VPN (nm_setting_vpn_new ());
-       g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, NM_VPN_SERVICE_TYPE_LIBRESWAN, NULL);
+       g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, service_type ?: NM_VPN_SERVICE_TYPE_LIBRESWAN, 
NULL);
 
        /* Gateway */
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "gateway_entry"));


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