diff options
author | Marcus Lundblad <ml@update.uu.se> | 2017-11-10 23:45:20 +0100 |
---|---|---|
committer | Marcus Lundblad <ml@update.uu.se> | 2018-02-05 22:10:13 +0100 |
commit | 173ae448f43976e8e0da7ece43500b48615c61fc (patch) | |
tree | 5aa7caefc7571c7ad7f8cb70c7491d4803e4d0a3 /src/favoritesPopover.js | |
parent | f035483c2b148a71971adb9ed1f8fd0a45361dc8 (diff) | |
download | gnome-maps-173ae448f43976e8e0da7ece43500b48615c61fc.tar.gz |
Use ES6 arrow notation
Use the arrow notation to bind "this"
to anonymous functions.
https://bugzilla.gnome.org/show_bug.cgi?id=722758
Diffstat (limited to 'src/favoritesPopover.js')
-rw-r--r-- | src/favoritesPopover.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/favoritesPopover.js b/src/favoritesPopover.js index b6df29a1..a1b6d856 100644 --- a/src/favoritesPopover.js +++ b/src/favoritesPopover.js @@ -70,26 +70,26 @@ var FavoritesPopover = new Lang.Class({ row.set_header(header); }); - this.connect('notify::rows', (function() { + this.connect('notify::rows', () => { let visible = Math.min(this._rows, _N_VISIBLE); let separators = visible - 1; // separators are 1px let height = (PlaceListRow.ROW_HEIGHT + 6) * visible + separators; this._scrolledWindow.min_content_height = height; this._revealer.reveal_child = this._rows > _N_VISIBLE; - }).bind(this)); + }); this._entry.connect('changed', - this._list.invalidate_filter.bind(this._list)); + () => this._list.invalidate_filter(this._list)); - this._list.connect('row-activated', (function(list, row) { + this._list.connect('row-activated', (list, row) => { this.hide(); this._mapView.showPlace(row.place, true); - }).bind(this)); + }); - this._list.set_filter_func((function(row) { + this._list.set_filter_func((row) => { return row.place.match(this._entry.text); - }).bind(this)); + }); this._updateList(); }, @@ -106,12 +106,10 @@ var FavoritesPopover = new Lang.Class({ }, _updateList: function() { - this._list.forall(function(row) { - row.destroy(); - }); + this._list.forall((row) => row.destroy()); let rows = 0; - this._model.foreach((function(model, path, iter) { + this._model.foreach((model, path, iter) => { let place = model.get_value(iter, PlaceStore.Columns.PLACE); let row = new PlaceListRow.PlaceListRow({ place: place, @@ -119,7 +117,7 @@ var FavoritesPopover = new Lang.Class({ can_focus: true }); this._list.add(row); rows++; - }).bind(this)); + }); this.rows = rows; } |