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.
James Westman
4 years ago
142 | 142 |
}
|
143 | 143 |
|
144 | 144 |
_initSendToButton(button) {
|
145 | |
let dialog = new SendToDialog.SendToDialog({ transient_for: this.get_toplevel(),
|
146 | |
modal: true,
|
147 | |
mapView: this._mapView,
|
148 | |
place: this._place });
|
149 | 145 |
button.visible = true;
|
150 | 146 |
button.connect('clicked', () => {
|
151 | |
dialog.connect('response', () => dialog.hide());
|
|
147 |
let dialog = new SendToDialog.SendToDialog({ transient_for: this.get_toplevel(),
|
|
148 |
modal: true,
|
|
149 |
mapView: this._mapView,
|
|
150 |
place: this._place });
|
|
151 |
dialog.connect('response', () => dialog.destroy());
|
152 | 152 |
dialog.show();
|
153 | 153 |
});
|
154 | 154 |
}
|
58 | 58 |
|
59 | 59 |
_init(params) {
|
60 | 60 |
this._place = params.place;
|
|
61 |
this._location = this._place.location;
|
61 | 62 |
delete params.place;
|
62 | 63 |
|
63 | 64 |
this._mapView = params.mapView;
|
|
94 | 95 |
|
95 | 96 |
if (GWeather) {
|
96 | 97 |
let world = GWeather.Location.get_world();
|
97 | |
let location = this._place.location;
|
|
98 |
let location = this._location;
|
98 | 99 |
this._city = world.find_nearest_city(location.latitude,
|
99 | 100 |
location.longitude);
|
100 | 101 |
/* Translators: The first string is the name of the city, the
|
|
156 | 157 |
lines.push(details);
|
157 | 158 |
}
|
158 | 159 |
|
159 | |
lines.push('%f, %f'.format(place.location.latitude,
|
160 | |
place.location.longitude));
|
|
160 |
lines.push('%f, %f'.format(this._location.latitude,
|
|
161 |
this._location.longitude));
|
161 | 162 |
|
162 | 163 |
return lines.join('\n');
|
163 | 164 |
}
|
|
173 | 174 |
place.osm_id);
|
174 | 175 |
} else {
|
175 | 176 |
return '%s?mlat=%f&mlon=%f&zoom=%d'.format(base,
|
176 | |
place.location.latitude,
|
177 | |
place.location.longitude,
|
|
177 |
this._location.latitude,
|
|
178 |
this._location.longitude,
|
178 | 179 |
view.zoom_level);
|
179 | 180 |
}
|
180 | 181 |
}
|
|
236 | 237 |
new GLib.Variant('v', this._city.serialize()),
|
237 | 238 |
timestamp);
|
238 | 239 |
} else if (row instanceof OpenWithRow) {
|
239 | |
let uri = this._place.location.to_uri(Geocode.LocationURIScheme.GEO);
|
|
240 |
let uri = this._location.to_uri(Geocode.LocationURIScheme.GEO);
|
240 | 241 |
row.appinfo.launch_uris([ uri ], this._getAppLaunchContext());
|
241 | 242 |
}
|
242 | 243 |
this.response(Response.SUCCESS);
|