[gnome-shell] networkAgent: Invalidate VPN plugin cache on changes
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] networkAgent: Invalidate VPN plugin cache on changes
- Date: Thu, 10 Nov 2016 13:40:00 +0000 (UTC)
commit 15be562fdf33c20b1b82035e78dabc9d0f269639
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Nov 3 13:32:40 2016 +0100
networkAgent: Invalidate VPN plugin cache on changes
Currently the cache is built once when the first VPN request is
handled, so plugins that are installed or uninstalled after that
aren't picked up. Fix this by invalidating the cache on changes
to the plugin directory.
https://bugzilla.gnome.org/show_bug.cgi?id=773893
js/ui/components/networkAgent.js | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js
index 9308ac0..205d2f7 100644
--- a/js/ui/components/networkAgent.js
+++ b/js/ui/components/networkAgent.js
@@ -615,6 +615,14 @@ const NetworkAgent = new Lang.Class({
this._vpnRequests = { };
this._notifications = { };
+ this._pluginDir = Gio.file_new_for_path(GLib.build_filenamev([Config.SYSCONFDIR,
'NetworkManager/VPN']));
+ try {
+ let monitor = this._pluginDir.monitor(Gio.FileMonitorFlags.NONE, null);
+ monitor.connect('changed', () => { this._vpnCacheBuilt = false; });
+ } catch(e) {
+ log('Failed to create monitor for VPN plugin dir: ' + e.message);
+ }
+
this._native.connect('new-request', Lang.bind(this, this._newRequest));
this._native.connect('cancel-request', Lang.bind(this, this._cancelRequest));
@@ -765,9 +773,8 @@ const NetworkAgent = new Lang.Class({
this._vpnCacheBuilt = true;
this._vpnBinaries = { };
- let dir = Gio.file_new_for_path(GLib.build_filenamev([Config.SYSCONFDIR, 'NetworkManager/VPN']));
try {
- let fileEnum = dir.enumerate_children('standard::name', Gio.FileQueryInfoFlags.NONE, null);
+ let fileEnum = this._pluginDir.enumerate_children('standard::name', Gio.FileQueryInfoFlags.NONE,
null);
let info;
while ((info = fileEnum.next_file(null))) {
@@ -777,7 +784,7 @@ const NetworkAgent = new Lang.Class({
try {
let keyfile = new GLib.KeyFile();
- keyfile.load_from_file(dir.get_child(name).get_path(), GLib.KeyFileFlags.NONE);
+ keyfile.load_from_file(this._pluginDir.get_child(name).get_path(),
GLib.KeyFileFlags.NONE);
let service = keyfile.get_string('VPN Connection', 'service');
let binary = keyfile.get_string('GNOME', 'auth-dialog');
let externalUIMode = false;
@@ -810,7 +817,7 @@ const NetworkAgent = new Lang.Class({
}
} catch(e) {
log('Error \'%s\' while processing VPN keyfile \'%s\''.
- format(e.message, dir.get_child(name).get_path()));
+ format(e.message, this._pluginDir.get_child(name).get_path()));
continue;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]