[gnome-shell/gnome-3-20] NetworkAgent: Handle VPN service aliases



commit 5d307c9ad5efcf904360786cb6a6a8c8e1bd0902
Author: David Woodhouse <David Woodhouse intel com>
Date:   Fri Jun 3 17:43:42 2016 +0100

    NetworkAgent: Handle VPN service aliases
    
    A VPN plugin can support multiple services, indicated by an 'aliases' key.
    
    We need to be able to spawn the appropriate auth-dialog for these aliases,
    as well as the base service.
    
    Covered as an afterthought (from comment 57) in
    https://bugzilla.gnome.org/show_bug.cgi?id=658484
    
    See also https://bugzilla.gnome.org/show_bug.cgi?id=746664 and
    https://bugzilla.gnome.org/show_bug.cgi?id=767197

 js/ui/components/networkAgent.js |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js
index b5f141d..9308ac0 100644
--- a/js/ui/components/networkAgent.js
+++ b/js/ui/components/networkAgent.js
@@ -796,10 +796,18 @@ const NetworkAgent = new Lang.Class({
                         path = GLib.build_filenamev([Config.LIBEXECDIR, path]);
                     }
 
-                    if (GLib.file_test(path, GLib.FileTest.IS_EXECUTABLE))
+                    if (GLib.file_test(path, GLib.FileTest.IS_EXECUTABLE)) {
                         this._vpnBinaries[service] = { fileName: path, externalUIMode: externalUIMode, 
supportsHints: hints };
-                    else
+                        try {
+                            let aliases = keyfile.get_string_list('VPN Connection', 'aliases');
+
+                            for (let alias of aliases) {
+                                this._vpnBinaries[alias] = { fileName: path, externalUIMode: externalUIMode, 
supportsHints: hints };
+                            }
+                        } catch(e) { } // ignore errors if key does not exist
+                    } else {
                         throw new Error('VPN plugin at %s is not executable'.format(path));
+                    }
                 } catch(e) {
                     log('Error \'%s\' while processing VPN keyfile \'%s\''.
                         format(e.message, dir.get_child(name).get_path()));


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