123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- diff --git a/configure.ac b/configure.ac
- index f5810bd5d..d3d20a540 100644
- --- a/configure.ac
- +++ b/configure.ac
- @@ -33,7 +33,6 @@ PKG_CHECK_MODULES([DEPS], [gdk-3.0
- glib-2.0
- gobject-2.0
- gtk+-3.0 >= 3.11.4
- - libgeoclue-2.0 >= 2.3.1
- gjs-1.0 >= $GJS_MIN_VERSION
- gweather-3.0 >= 3.17.2])
-
- diff --git a/data/org.gnome.Weather.Application.desktop.in b/data/org.gnome.Weather.Application.desktop.in
- index 3cd54ba2e..9d59b4699 100644
- --- a/data/org.gnome.Weather.Application.desktop.in
- +++ b/data/org.gnome.Weather.Application.desktop.in
- @@ -8,4 +8,3 @@ DBusActivatable=true
- StartupNotify=true
- Categories=GNOME;GTK;Utility;Core;
- _Keywords=Weather;Forecast;
- -_X-Geoclue-Reason=Allows weather information to be displayed for your location.
- diff --git a/src/app/currentLocationController.js b/src/app/currentLocationController.js
- index c070598b3..10b436d54 100644
- --- a/src/app/currentLocationController.js
- +++ b/src/app/currentLocationController.js
- @@ -20,104 +20,14 @@ const GLib = imports.gi.GLib;
- const Gio = imports.gi.Gio;
- const Lang = imports.lang;
- const GWeather = imports.gi.GWeather;
- -const Geoclue = imports.gi.Geoclue;
-
- const Util = imports.misc.util;
-
- -var AutoLocation = {
- - DISABLED: 0,
- - ENABLED: 1,
- - NOT_AVAILABLE: 2
- -};
- -
- var CurrentLocationController = class CurrentLocationController {
- constructor(world) {
- this._world = world;
- this._processStarted = false;
- this._settings = Util.getSettings('org.gnome.Weather.Application');
- - let autoLocation = this._settings.get_value('automatic-location').deep_unpack();
- - this._syncAutoLocation(autoLocation);
- - if (this.autoLocation == AutoLocation.ENABLED)
- - this._startGeolocationService();
- this.currentLocation = null;
- }
- -
- - _startGeolocationService() {
- - this._processStarted = true;
- - Geoclue.Simple.new(pkg.name,
- - Geoclue.AccuracyLevel.CITY,
- - null,
- - this._onSimpleReady.bind(this));
- - }
- -
- - _geoLocationFailed(e) {
- - log ("Failed to connect to GeoClue2 service: " + e.message);
- - this.autoLocation = AutoLocation.NOT_AVAILABLE;
- - GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
- - this._world.currentLocationChanged(null);
- - });
- - }
- -
- - _onSimpleReady(object, result) {
- - try {
- - this._simple = Geoclue.Simple.new_finish(result);
- - }
- - catch (e) {
- - this._geoLocationFailed(e);
- - return;
- - }
- -
- - let client = this._simple.get_client();
- - client.distance_threshold = 100;
- -
- - this._findLocation();
- - }
- -
- - _findLocation() {
- - this._locationUpdatedId =
- - this._simple.connect("notify::location",
- - this._onLocationUpdated.bind(this));
- -
- - this._onLocationUpdated(this._simple);
- - }
- -
- - _onLocationUpdated(simple) {
- - let geoclueLocation = simple.get_location();
- -
- - this.currentLocation = GWeather.Location.new_detached(geoclueLocation.description,
- - null,
- - geoclueLocation.latitude,
- - geoclueLocation.longitude);
- - this._world.currentLocationChanged(this.currentLocation);
- - }
- -
- - setAutoLocation(active) {
- - this._settings.set_value('automatic-location', new GLib.Variant('b', active));
- -
- - if (this.autoLocation == AutoLocation.NOT_AVAILABLE)
- - return;
- - this._autoLocationChanged(active);
- - this._syncAutoLocation(active);
- - }
- -
- - _syncAutoLocation(autoLocation) {
- - if (autoLocation)
- - this.autoLocation = AutoLocation.ENABLED;
- - else
- - this.autoLocation = AutoLocation.DISABLED;
- - }
- -
- - _autoLocationChanged(active) {
- - if (active) {
- - if (!this._processStarted) {
- - this._startGeolocationService();
- - } else {
- - this._locationUpdatedId =
- - this._simple.connect("notify::location",
- - this._onLocationUpdated.bind(this));
- - }
- - } else {
- - this._simple.disconnect(this._locationUpdatedId);
- - }
- - }
- }
|