[gnome-shell] location: Translate accuracy level for geoclue
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] location: Translate accuracy level for geoclue
- Date: Thu, 11 Sep 2014 16:49:08 +0000 (UTC)
commit 7653175c6ff0b3842cbee4accc4fe9e94a28e7a5
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Thu Sep 11 14:57:15 2014 +0100
location: Translate accuracy level for geoclue
The enums values of geoclue have gaps in them (so more levels could be
added in future) but enum values of settings don't have such gaps so we
gotta translate between them.
Since desrt says that enums as integers in gsettings are bad, we now
treat accuracy level settings as string.
This fixes the recent regression of geoclue only allowing geiop level
accuracy to apps.
https://bugzilla.gnome.org/show_bug.cgi?id=736479
js/ui/status/location.js | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/status/location.js b/js/ui/status/location.js
index c6694d1..9dc736e 100644
--- a/js/ui/status/location.js
+++ b/js/ui/status/location.js
@@ -13,6 +13,15 @@ const LOCATION_SCHEMA = 'org.gnome.system.location';
const MAX_ACCURACY_LEVEL = 'max-accuracy-level';
const ENABLED = 'enabled';
+const GeoclueAccuracyLevel = {
+ NONE: 0,
+ COUNTRY: 1,
+ CITY: 4,
+ NEIGHBORHOOD: 5,
+ STREET: 6,
+ EXACT: 8
+};
+
var GeoclueIface = '<node> \
<interface name="org.freedesktop.GeoClue2.Manager"> \
<property name="InUse" type="b" access="read"/> \
@@ -181,10 +190,14 @@ const Indicator = new Lang.Class({
},
_getMaxAccuracyLevel: function() {
- if (this._settings.get_boolean(ENABLED))
- return this._settings.get_enum(MAX_ACCURACY_LEVEL);
- else
- return 0;
+ if (this._settings.get_boolean(ENABLED)) {
+ let level = this._settings.get_string(MAX_ACCURACY_LEVEL);
+
+ return GeoclueAccuracyLevel[level.toUpperCase()] ||
+ GeoclueAccuracyLevel.NONE;
+ } else {
+ return GeoclueAccuracyLevel.NONE;
+ }
},
_notifyMaxAccuracyLevel: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]