[gnome-shell] network: initialize the agent asynchronously
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] network: initialize the agent asynchronously
- Date: Mon, 23 Apr 2018 11:59:30 +0000 (UTC)
commit c82cb918ae8d2dc0b737dc83d4669d3e4bd15ef0
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Thu Jan 11 10:50:45 2018 +0100
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
js/ui/components/networkAgent.js | 21 +++++++++++++--------
meson.build | 2 +-
2 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js
index 75f420373..9050b8a50 100644
--- a/js/ui/components/networkAgent.js
+++ b/js/ui/components/networkAgent.js
@@ -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);
},
diff --git a/meson.build b/meson.build
index bfc2ff76c..1c0b68c71 100644
--- a/meson.build
+++ b/meson.build
@@ -31,7 +31,7 @@ ibus_req = '>= 1.5.2'
bt_req = '>= 3.9.0'
gst_req = '>= 0.11.92'
-nm_req = '>= 0.9.8'
+nm_req = '>= 1.10.4'
secret_req = '>= 0.18'
gnome = import('gnome')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]