[gnome-maps] userLocation: Separate method for show & goto
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] userLocation: Separate method for show & goto
- Date: Mon, 15 Apr 2013 01:30:47 +0000 (UTC)
commit 0797c2ecf9119098d68a70a8c5d064e1ce24173d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon Apr 15 04:02:32 2013 +0300
userLocation: Separate method for show & goto
show() should only show the location so create a separate method that
does both.
src/mapView.js | 4 ++--
src/userLocation.js | 9 ++++++---
2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index eb81d11..19662e9 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -142,7 +142,7 @@ const MapView = new Lang.Class({
location.set_description(lastLocationDescription);
let userLocation = new UserLocation.UserLocation(location, this);
- userLocation.show(false, this._userLocationLayer);
+ userLocation.showNGoTo(false, this._userLocationLayer);
}
let ipclient = new Geocode.Ipclient();
@@ -154,7 +154,7 @@ const MapView = new Lang.Class({
let location = ipclient.search_finish(res);
let userLocation = new UserLocation.UserLocation(location, this);
- userLocation.show(true, this._userLocationLayer);
+ userLocation.showNGoTo(true, this._userLocationLayer);
let variant = GLib.Variant.new('ad', [location.latitude, location.longitude,
location.accuracy]);
Application.settings.set_value('last-location', variant);
diff --git a/src/userLocation.js b/src/userLocation.js
index 1d8b997..ec8dc06 100644
--- a/src/userLocation.js
+++ b/src/userLocation.js
@@ -35,9 +35,7 @@ const UserLocation = new Lang.Class({
Name: 'UserLocation',
Extends: MapLocation.MapLocation,
- show: function(animate, layer) {
- this.goTo(animate);
-
+ show: function(layer) {
layer.remove_all();
this._locationMarker = new Champlain.CustomMarker();
@@ -109,6 +107,11 @@ const UserLocation = new Lang.Class({
this._zoomLevelId = this._view.connect("notify::zoom-level", Lang.bind(this,
this._updateAccuracyMarker));
},
+ showNGoTo: function(animate, layer) {
+ this.show(layer);
+ this.goTo(animate);
+ },
+
_updateAccuracyMarker: function() {
if (!this._locationMarker.get_selected()) {
this._accuracyMarker.hide();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]