[network-manager-applet/th/vpn-service-info-bgo767197-1: 3/7] c-e: resolve VPN service-type as a short-name



commit 67e6cb58f899d5ff0859c00f21e36f8b597b6b8c
Author: Thomas Haller <thaller redhat com>
Date:   Wed Jun 8 13:03:57 2016 +0200

    c-e: resolve VPN service-type as a short-name
    
    Allow short-names for VPNs to select the service-type.
    This allows for shortnames lke:
    
      $ nm-connection-editor -c -t vpn:openconnect

 src/connection-editor/page-vpn.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/connection-editor/page-vpn.c b/src/connection-editor/page-vpn.c
index c59195f..2f93e23 100644
--- a/src/connection-editor/page-vpn.c
+++ b/src/connection-editor/page-vpn.c
@@ -287,6 +287,8 @@ vpn_connection_new (GtkWindow *parent,
 {
        NMConnection *connection;
        NMSetting *s_vpn;
+       const char *service_type;
+       gs_free char *service_type_free = NULL;
 
        if (!detail) {
                NewVpnInfo *info;
@@ -306,13 +308,16 @@ vpn_connection_new (GtkWindow *parent,
                return;
        }
 
+       service_type_free = nm_vpn_plugin_info_list_find_service_type (vpn_get_plugin_infos (), detail);
+       service_type = service_type_free ?: detail;
+
        connection = ce_page_new_connection (_("VPN connection %d"),
                                             NM_SETTING_VPN_SETTING_NAME,
                                             FALSE,
                                             client,
                                             user_data);
        s_vpn = nm_setting_vpn_new ();
-       g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, detail, NULL);
+       g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, service_type, NULL);
        nm_connection_add_setting (connection, s_vpn);
 
        (*result_func) (connection, FALSE, NULL, user_data);


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