network: initialize the agent asynchronously

This also bumps the NM requirement. We actually already use API from
1.0, but regularly hit various NetworkManager bugs with versions prior
to 1.10.2. 1.10.4 fixes the asynchronous agent initialization.

https://bugzilla.gnome.org/show_bug.cgi?id=789811
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/63
This commit is contained in:
Lubomir Rintel 2018-01-11 10:50:45 +01:00
parent 38cdaa6c20
commit c82cb918ae
2 changed files with 14 additions and 9 deletions

View File

@ -604,12 +604,17 @@ var NetworkAgent = new Lang.Class({
this._native.connect('new-request', this._newRequest.bind(this)); this._native.connect('new-request', this._newRequest.bind(this));
this._native.connect('cancel-request', this._cancelRequest.bind(this)); this._native.connect('cancel-request', this._cancelRequest.bind(this));
try {
this._native.init(null); this._initialized = false;
} catch(e) { this._native.init_async(GLib.PRIORITY_DEFAULT, null, (o, res) => {
this._native = null; try {
logError(e, 'error initializing the NetworkManager Agent'); this._native.init_finish(res);
} this._initialized = true;
} catch(e) {
this._native = null;
logError(e, 'error initializing the NetworkManager Agent');
}
});
}, },
enable() { enable() {
@ -617,7 +622,7 @@ var NetworkAgent = new Lang.Class({
return; return;
this._native.auto_register = true; this._native.auto_register = true;
if (!this._native.registered) if (this._initialized && !this._native.registered)
this._native.register_async(null, null); this._native.register_async(null, null);
}, },
@ -640,7 +645,7 @@ var NetworkAgent = new Lang.Class({
return; return;
this._native.auto_register = false; this._native.auto_register = false;
if (this._native.registered) if (this._initialized && this._native.registered)
this._native.unregister_async(null, null); this._native.unregister_async(null, null);
}, },

View File

@ -31,7 +31,7 @@ ibus_req = '>= 1.5.2'
bt_req = '>= 3.9.0' bt_req = '>= 3.9.0'
gst_req = '>= 0.11.92' gst_req = '>= 0.11.92'
nm_req = '>= 0.9.8' nm_req = '>= 1.10.4'
secret_req = '>= 0.18' secret_req = '>= 0.18'
gnome = import('gnome') gnome = import('gnome')