[gnome-maps] MapView: Use properties directly



commit 850ede7bf83e912a14172551aeae16b7b84cd301
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date:   Thu Jul 31 22:21:43 2014 +0200

    MapView: Use properties directly
    
    We want to use the gjs property directly instead of the get/set
    wrappers. This patch makes MapView only use properties.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=734078

 src/mapView.js |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index 4cfb5f3..ce913a9 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -71,10 +71,10 @@ const MapView = new Lang.Class({
 
     _initView: function() {
         let view = this.get_view();
-        view.set_zoom_level(3);
+        view.zoom_level = 3;
         view.min_zoom_level = MapMinZoom;
         view.goto_animation_mode = Clutter.AnimationMode.EASE_IN_OUT_CUBIC;
-        view.set_reactive(true);
+        view.reactive = true;
 
         view.connect('notify::latitude', this._onViewMoved.bind(this));
         view.connect('notify::longitude', this._onViewMoved.bind(this));
@@ -88,16 +88,14 @@ const MapView = new Lang.Class({
     },
 
     _initLayers: function() {
-        this._routeLayer = new Champlain.PathLayer();
-        this._routeLayer.set_stroke_width(2.0);
+        this._routeLayer = new Champlain.PathLayer({ stroke_width: 2.0 });
         this.view.add_layer(this._routeLayer);
 
-        this._markerLayer = new Champlain.MarkerLayer();
-        this._markerLayer.set_selection_mode(Champlain.SelectionMode.SINGLE);
+        let mode = Champlain.SelectionMode.SINGLE;
+        this._markerLayer = new Champlain.MarkerLayer({ selection_mode: mode });
         this.view.add_layer(this._markerLayer);
 
-        this._userLocationLayer = new Champlain.MarkerLayer();
-        this._userLocationLayer.set_selection_mode(Champlain.SelectionMode.SINGLE);
+        this._userLocationLayer = new Champlain.MarkerLayer({ selection_mode: mode });
         this.view.add_layer(this._userLocationLayer);
     },
 
@@ -107,11 +105,11 @@ const MapView = new Lang.Class({
     },
 
     setMapType: function(mapType) {
-        if (this.view.map_source.get_id() === mapType)
+        if (this.view.map_source.id === mapType)
             return;
 
         let source = this._factory.create_cached_source(mapType);
-        this.view.set_map_source(source);
+        this.view.map_source = source;
     },
 
     ensureLocationsVisible: function(locations) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]