[gnome-weather] CurrentLocationController: be more resilient against Geoclue not starting
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-weather] CurrentLocationController: be more resilient against Geoclue not starting
- Date: Tue, 10 Feb 2015 06:43:09 +0000 (UTC)
commit f63f5dc6e5227a200ba6dfd754c758d001b29c19
Author: Giovanni Campagna <scampa giovanni gmail com>
Date: Mon Feb 9 22:39:59 2015 -0800
CurrentLocationController: be more resilient against Geoclue not starting
In weird configurations geoclue can refuse to start (for example
when masked with "systemctl mask"), in which case we will get an
error creating the proxy, before we can even call GetClientRemote().
Just bail in that case, as if geolocation is disabled.
https://bugzilla.gnome.org/show_bug.cgi?id=742460
src/app/currentLocationController.js | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/src/app/currentLocationController.js b/src/app/currentLocationController.js
index dd64c9b..f6db793 100644
--- a/src/app/currentLocationController.js
+++ b/src/app/currentLocationController.js
@@ -81,17 +81,27 @@ const CurrentLocationController = new Lang.Class({
_startGeolocationService: function() {
this._processStarted = true;
- this._managerProxy = new ManagerProxy(Gio.DBus.system,
- "org.freedesktop.GeoClue2",
- "/org/freedesktop/GeoClue2/Manager");
+ try {
+ this._managerProxy = new ManagerProxy(Gio.DBus.system,
+ "org.freedesktop.GeoClue2",
+ "/org/freedesktop/GeoClue2/Manager");
+
+ this._managerProxy.GetClientRemote(this._onGetClientReady.bind(this));
+ } catch(e) {
+ this._geoLocationFailed(e);
+ }
+ },
- this._managerProxy.GetClientRemote(this._onGetClientReady.bind(this));
+ _geoLocationFailed: function(e) {
+ log ("Failed to connect to GeoClue2 service: " + e.message);
+ GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, function() {
+ this._world.currentLocationChanged(null);
+ }));
},
_onGetClientReady: function(result, e) {
if (e) {
- log ("Failed to connect to GeoClue2 service: " + e.message);
- this._world.currentLocationChanged(null);
+ this._geoLocationFailed(e);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]