[network-manager-applet/th/c-e-import-fixes-bgo774290: 10/11] c-e: allow specifying vpn types directly on command line



commit 82df4441203e036e2e76b25ddb4e6ecb4a0e0861
Author: Thomas Haller <thaller redhat com>
Date:   Fri Nov 11 19:09:41 2016 +0100

    c-e: allow specifying vpn types directly on command line
    
    Previously, we would only support
    
      nm-connection-editor --create --type vpn:openvpn
    
    Now, support
    
      nm-connection-editor --create --type openvpn
    
    directly.

 src/connection-editor/main.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/connection-editor/main.c b/src/connection-editor/main.c
index e28aa8e..e0318a9 100644
--- a/src/connection-editor/main.c
+++ b/src/connection-editor/main.c
@@ -31,6 +31,7 @@
 #include "nm-connection-list.h"
 #include "nm-connection-editor.h"
 #include "connection-helpers.h"
+#include "vpn-helpers.h"
 
 gboolean nm_ce_keep_above;
 
@@ -104,6 +105,16 @@ handle_arguments (NMConnectionList *list,
                        detail = p + 1;
                }
                ctype = nm_setting_lookup_type (type);
+               if (ctype == 0 && !p) {
+                       gs_free char *service_type = NULL;
+
+                       /* allow using the VPN name directly, without "vpn:" prefix. */
+                       service_type = nm_vpn_plugin_info_list_find_service_type (vpn_get_plugin_infos (), 
type);
+                       if (service_type) {
+                               ctype = NM_TYPE_SETTING_VPN;
+                               detail = type;
+                       }
+               }
                if (ctype == 0) {
                        g_warning ("Unknown connection type '%s'", type);
                        return TRUE;


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