summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Westman <flyingpimonster@gmail.com>2020-01-01 21:51:22 -0600
committerJames Westman <flyingpimonster@gmail.com>2020-01-01 21:51:22 -0600
commitc28cb59a284c5d51c2218f3c48330479d280746f (patch)
tree53167ef268a3dadca2a8122b34f35dc8fe29c59e
parent61194fc76bfb90e16c359b7f28b879c546480dae (diff)
downloadgnome-maps-c28cb59a284c5d51c2218f3c48330479d280746f.tar.gz
sendToDialog: Ensure consistency when marker moves
The Send To dialog now remembers the exact coordinates, not just the Place object, from when it was created. This way, if the place moves (such as a moving current location marker), the coordinates shown in the dialog remain the same as when the Send To button was pressed. Also, the map bubble now creates a new sendToDialog every time the Send To button is pressed, so that the latest marker position is shown in the dialog.
-rw-r--r--src/mapBubble.js10
-rw-r--r--src/sendToDialog.js13
2 files changed, 12 insertions, 11 deletions
diff --git a/src/mapBubble.js b/src/mapBubble.js
index 211acc36..998f0213 100644
--- a/src/mapBubble.js
+++ b/src/mapBubble.js
@@ -143,13 +143,13 @@ class MapBubble extends Gtk.Popover {
}
_initSendToButton(button) {
- let dialog = new SendToDialog.SendToDialog({ transient_for: this.get_toplevel(),
- modal: true,
- mapView: this._mapView,
- place: this._place });
button.visible = true;
button.connect('clicked', () => {
- dialog.connect('response', () => dialog.hide());
+ let dialog = new SendToDialog.SendToDialog({ transient_for: this.get_toplevel(),
+ modal: true,
+ mapView: this._mapView,
+ place: this._place });
+ dialog.connect('response', () => dialog.destroy());
dialog.show();
});
}
diff --git a/src/sendToDialog.js b/src/sendToDialog.js
index ed3a1548..9c3e9632 100644
--- a/src/sendToDialog.js
+++ b/src/sendToDialog.js
@@ -59,6 +59,7 @@ var SendToDialog = GObject.registerClass({
_init(params) {
this._place = params.place;
+ this._location = this._place.location;
delete params.place;
this._mapView = params.mapView;
@@ -95,7 +96,7 @@ var SendToDialog = GObject.registerClass({
if (GWeather) {
let world = GWeather.Location.get_world();
- let location = this._place.location;
+ let location = this._location;
this._city = world.find_nearest_city(location.latitude,
location.longitude);
/* Translators: The first string is the name of the city, the
@@ -157,8 +158,8 @@ var SendToDialog = GObject.registerClass({
lines.push(details);
}
- lines.push('%f, %f'.format(place.location.latitude,
- place.location.longitude));
+ lines.push('%f, %f'.format(this._location.latitude,
+ this._location.longitude));
return lines.join('\n');
}
@@ -174,8 +175,8 @@ var SendToDialog = GObject.registerClass({
place.osm_id);
} else {
return '%s?mlat=%f&mlon=%f&zoom=%d'.format(base,
- place.location.latitude,
- place.location.longitude,
+ this._location.latitude,
+ this._location.longitude,
view.zoom_level);
}
}
@@ -237,7 +238,7 @@ var SendToDialog = GObject.registerClass({
new GLib.Variant('v', this._city.serialize()),
timestamp);
} else if (row instanceof OpenWithRow) {
- let uri = this._place.location.to_uri(Geocode.LocationURIScheme.GEO);
+ let uri = this._location.to_uri(Geocode.LocationURIScheme.GEO);
row.appinfo.launch_uris([ uri ], this._getAppLaunchContext());
}
this.response(Response.SUCCESS);