[gnome-maps] mapMarker: Bind properties from MapView
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] mapMarker: Bind properties from MapView
- Date: Wed, 14 Feb 2018 22:03:24 +0000 (UTC)
commit a1aca45f1ad4293dc1a32906b1e720ffd446cc8c
Author: Marcus Lundblad <ml update uu se>
Date: Wed Feb 14 22:44:42 2018 +0100
mapMarker: Bind properties from MapView
Instead of directly connecting to notify on properties of the
MapView instead bind these properties to the marker instance
and connect to those properties to avoid firing signal callbacks
acting on an already finallized marker instance.
https://bugzilla.gnome.org/show_bug.cgi?id=793472
src/mapMarker.js | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/src/mapMarker.js b/src/mapMarker.js
index f4b7a84..f73fc91 100644
--- a/src/mapMarker.js
+++ b/src/mapMarker.js
@@ -38,7 +38,19 @@ var MapMarker = GObject.registerClass({
},
Properties: {
'surface': GObject.ParamSpec.override('surface',
- Champlain.Exportable)
+ Champlain.Exportable),
+ 'view-latitude': GObject.ParamSpec.double('view-latitude', '', '',
+ GObject.ParamFlags.READABLE |
+ GObject.ParamFlags.WRITABLE,
+ -90, 90, 0),
+ 'view-longitude': GObject.ParamSpec.double('view-longitude', '', '',
+ GObject.ParamFlags.READABLE |
+ GObject.ParamFlags.WRITABLE,
+ -180, 180, 0),
+ 'view-zoom-level': GObject.ParamSpec.int('view-zoom-level', '', '',
+ GObject.ParamFlags.READABLE |
+ GObject.ParamFlags.WRITABLE,
+ 0, 20, 3)
}
}, class MapMarker extends Champlain.Marker {
@@ -70,9 +82,15 @@ var MapMarker = GObject.registerClass({
this.bind_property('longitude',
this.place.location, 'longitude',
GObject.BindingFlags.DEFAULT);
- this._view.connect('notify::latitude', this._onViewUpdated.bind(this));
- this._view.connect('notify::longitude', this._onViewUpdated.bind(this));
- this._view.connect('notify::zoom-level', this._onViewUpdated.bind(this));
+ this._view.bind_property('latitude', this, 'view-latitude',
+ GObject.BindingFlags.DEFAULT);
+ this._view.bind_property('longitude', this, 'view-longitude',
+ GObject.BindingFlags.DEFAULT);
+ this._view.bind_property('zoom-level', this, 'view-zoom-level',
+ GObject.BindingFlags.DEFAULT);
+ this.connect('notify::view-latitude', this._onViewUpdated.bind(this));
+ this.connect('notify::view-longitude', this._onViewUpdated.bind(this));
+ this.connect('notify::view-zoom-level', this._onViewUpdated.bind(this));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]