[gnome-maps] placeButtons: Fix edit button
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] placeButtons: Fix edit button
- Date: Tue, 9 Feb 2021 20:56:57 +0000 (UTC)
commit 78d2f95d317df6c540357e8d645993af792ab113
Author: James Westman <james flyingpimonster net>
Date: Thu Dec 31 12:46:28 2020 -0600
placeButtons: Fix edit button
The earlier refactoring of PlaceButtons into a new class didn't update the
parent PlaceBar/PlaceView when you finished editing a place on OSM (and would
throw an error). Fixed by adding a signal to PlaceButtons for when the place
is edited.
src/placeBar.js | 5 +++++
src/placeButtons.js | 9 +++++++--
src/placeView.js | 6 ++++++
3 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/placeBar.js b/src/placeBar.js
index b293e441..708cf56c 100644
--- a/src/placeBar.js
+++ b/src/placeBar.js
@@ -53,6 +53,7 @@ var PlaceBar = GObject.registerClass({
this._buttons = new PlaceButtons.PlaceButtons({ mapView: this._mapView });
this._buttons.initSendToButton(this._altSendToButton);
+ this._buttons.connect('place-edited', this._onPlaceEdited.bind(this));
this._box.add(this._buttons);
this._multipress = new Gtk.GestureMultiPress({ widget: this._eventbox });
@@ -94,4 +95,8 @@ var PlaceBar = GObject.registerClass({
dialog.connect('response', () => dialog.destroy());
dialog.show();
}
+
+ _onPlaceEdited() {
+ _updatePlace();
+ }
});
diff --git a/src/placeButtons.js b/src/placeButtons.js
index 5a5f694a..f51e29ab 100644
--- a/src/placeButtons.js
+++ b/src/placeButtons.js
@@ -38,6 +38,12 @@ var PlaceButtons = GObject.registerClass({
'favoriteButton',
'editButton',
'favoriteButtonImage' ],
+ Signals: {
+ /* Emitted when the Edit dialog is closed, because the place details
+ might have changed and the parent PlaceBar/PlaceView needs
+ refreshing */
+ 'place-edited': {}
+ }
}, class PlaceButtons extends Gtk.Box {
_init(params) {
let place = params.place;
@@ -166,8 +172,7 @@ var PlaceButtons = GObject.registerClass({
let object = osmEdit.object;
OSMUtils.updatePlaceFromOSMObject(this._place, object);
// refresh place view
- this._clearView();
- this._populate(this._place);
+ this.emit('place-edited');
break;
default:
break;
diff --git a/src/placeView.js b/src/placeView.js
index a756c2dd..e5808fc3 100644
--- a/src/placeView.js
+++ b/src/placeView.js
@@ -88,6 +88,7 @@ var PlaceView = GObject.registerClass({
let placeButtons = new PlaceButtons.PlaceButtons({ place: this._place,
mapView: mapView });
+ placeButtons.connect('place-edited', this._onPlaceEdited.bind(this));
ui.placeButtons.add(placeButtons);
if (this.place.isCurrentLocation) {
@@ -549,4 +550,9 @@ var PlaceView = GObject.registerClass({
_updateLocation() {
this._populate(this.place);
}
+
+ /* called when the place is edited via the OSM edit dialog */
+ _onPlaceEdited() {
+ this._populate(this._place);
+ }
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]