[gnome-maps/wip/routing2: 8/18] Make GeoClue a global service
- From: Mattias Bengtsson <mattiasb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/routing2: 8/18] Make GeoClue a global service
- Date: Fri, 2 May 2014 22:50:06 +0000 (UTC)
commit de00ad1a88a6d222758f3345f38fb35b9585175c
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date: Fri May 2 20:49:17 2014 +0200
Make GeoClue a global service
Move GeoClue out from mapView and put it together with the other services.
src/application.js | 3 +++
src/mainWindow.js | 6 +++---
src/mapView.js | 12 +++++-------
3 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index a78fc78..f2bb349 100644
--- a/src/application.js
+++ b/src/application.js
@@ -34,6 +34,7 @@ const GLib = imports.gi.GLib;
const Main = imports.main;
const Format = imports.format;
+const Geoclue = imports.geoclue;
const MainWindow = imports.mainWindow;
const Notification = imports.notification;
const Utils = imports.utils;
@@ -48,6 +49,7 @@ let settings = null;
let placeStore = null;
let notificationManager = null;
let routeService = null;
+let geoclue = null;
const Application = new Lang.Class({
Name: 'Application',
@@ -96,6 +98,7 @@ const Application = new Lang.Class({
application = this;
settings = new Settings.Settings('org.gnome.maps');
routeService = new RouteService.GraphHopper();
+ geoclue = new Geoclue.Geoclue();
Utils.initActions(this, [{
properties: { name: 'quit' },
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 15d9afe..56930ab 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -274,13 +274,13 @@ const MainWindow = new Lang.Class({
},
_onGotoUserLocationActivate: function() {
- if (this.mapView.geoclue.userSetLocation) {
- Utils.once(this.mapView.geoclue,
+ if (Application.geoclue.userSetLocation) {
+ Utils.once(Application.geoclue,
'location-changed',
(function() {
this.mapView.gotoUserLocation(true);
}).bind(this));
- this.mapView.geoclue.findLocation();
+ Application.geoclue.findLocation();
} else
this.mapView.gotoUserLocation(true);
},
diff --git a/src/mapView.js b/src/mapView.js
index d4569e1..bcbee82 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -94,11 +94,9 @@ const MapView = new Lang.Class({
this._factory = Champlain.MapSourceFactory.dup_default();
this.setMapType(MapType.STREET);
-
- this.geoclue = new Geoclue.Geoclue();
this._updateUserLocation();
- this.geoclue.connect("location-changed",
- this._updateUserLocation.bind(this));
+ Application.geoclue.connect("location-changed",
+ this._updateUserLocation.bind(this));
this._connectRouteSignals(Application.routeService.route);
},
@@ -170,12 +168,12 @@ const MapView = new Lang.Class({
},
_updateUserLocation: function() {
- if (!this.geoclue.location)
+ if (!Application.geoclue.location)
return;
- let place = Geocode.Place.new_with_location(this.geoclue.location.description,
+ let place = Geocode.Place.new_with_location(Application.geoclue.location.description,
Geocode.PlaceType.UNKNOWN,
- this.geoclue.location);
+ Application.geoclue.location);
this._userLocation = new UserLocation.UserLocation(place, this);
this._userLocation.show(this._userLocationLayer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]