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