networkAgent: Don't register/unregister, just refuse to handle requests
https://bugzilla.gnome.org/show_bug.cgi?id=693746
This commit is contained in:
parent
e3eb4a20a5
commit
24984458de
@ -587,18 +587,19 @@ const NetworkAgent = new Lang.Class({
|
|||||||
Name: 'NetworkAgent',
|
Name: 'NetworkAgent',
|
||||||
|
|
||||||
_init: function() {
|
_init: function() {
|
||||||
this._native = new Shell.NetworkAgent({ auto_register: false,
|
this._native = new Shell.NetworkAgent({ identifier: 'org.gnome.Shell.NetworkAgent' });
|
||||||
identifier: 'org.gnome.Shell.NetworkAgent' });
|
|
||||||
|
|
||||||
this._dialogs = { };
|
this._dialogs = { };
|
||||||
this._vpnRequests = { };
|
this._vpnRequests = { };
|
||||||
|
|
||||||
this._native.connect('new-request', Lang.bind(this, this._newRequest));
|
this._native.connect('new-request', Lang.bind(this, this._newRequest));
|
||||||
this._native.connect('cancel-request', Lang.bind(this, this._cancelRequest));
|
this._native.connect('cancel-request', Lang.bind(this, this._cancelRequest));
|
||||||
|
|
||||||
|
this._enabled = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
enable: function() {
|
enable: function() {
|
||||||
this._native.auto_register = true;
|
this._enabled = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
disable: function() {
|
disable: function() {
|
||||||
@ -612,12 +613,15 @@ const NetworkAgent = new Lang.Class({
|
|||||||
this._vpnRequests[requestId].cancel(true);
|
this._vpnRequests[requestId].cancel(true);
|
||||||
this._vpnRequests = { };
|
this._vpnRequests = { };
|
||||||
|
|
||||||
this._native.auto_register = false;
|
this._enabled = false;
|
||||||
if (this._native.registered)
|
|
||||||
this._native.unregister();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_newRequest: function(agent, requestId, connection, settingName, hints, flags) {
|
_newRequest: function(agent, requestId, connection, settingName, hints, flags) {
|
||||||
|
if (!this._enabled) {
|
||||||
|
agent.respond(requestId, Shell.NetworkAgentResponse.USER_CANCELED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (settingName == 'vpn') {
|
if (settingName == 'vpn') {
|
||||||
this._vpnRequest(requestId, connection, hints, flags);
|
this._vpnRequest(requestId, connection, hints, flags);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user