Commit e8d3d203 authored by Christopher Davis's avatar Christopher Davis

Use arrow functions instead of `.bind(this)`

Arrow functions are more explicit, showing what you want to
pass through what callback.
parent 6977789e
......@@ -65,8 +65,8 @@ var WeatherWidget = GObject.registerClass({
hscrollbar.set_opacity(0.0);
hscrollbar.hide();
let hadjustment = fsw.get_hadjustment();
hadjustment.connect('changed', this._syncLeftRightButtons.bind(this));
hadjustment.connect('value-changed', this._syncLeftRightButtons.bind(this));
hadjustment.connect('changed', () => this._syncLeftRightButtons());
hadjustment.connect('value-changed', () => this._syncLeftRightButtons());
}
this._forecastStack.connect('notify::visible-child', () => {
......@@ -214,7 +214,7 @@ var WeatherView = GObject.registerClass({
this._info = null;
this._updateId = 0;
this.connect('destroy', this._onDestroy.bind(this));
this.connect('destroy', () => this._onDestroy());
this._wallClock = new Gnome.WallClock();
this._clockHandlerId = 0;
......@@ -237,7 +237,9 @@ var WeatherView = GObject.registerClass({
this._info = info;
if (info) {
this._updateId = this._info.connect('updated', this._onUpdate.bind(this));
this._updateId = this._info.connect('updated', (info) => {
this._onUpdate(info)
});
if (info.is_valid())
this._onUpdate(info);
}
......@@ -273,7 +275,9 @@ var WeatherView = GObject.registerClass({
}
if (!this._clockHandlerId && visible) {
this._clockHandlerId = this._wallClock.connect('notify::clock', this._updateTime.bind(this));
this._clockHandlerId = this._wallClock.connect('notify::clock', () => {
this._updateTime();
});
}
this._infoPage.setTimeVisible(visible);
......
......@@ -47,7 +47,9 @@ var CurrentLocationController = class CurrentLocationController {
Geoclue.Simple.new(pkg.name,
Geoclue.AccuracyLevel.CITY,
null,
this._onSimpleReady.bind(this));
(object, result) => {
this._onSimpleReady(object, result)
});
}
_geoLocationFailed(e) {
......@@ -75,8 +77,9 @@ var CurrentLocationController = class CurrentLocationController {
_findLocation() {
this._locationUpdatedId =
this._simple.connect("notify::location",
this._onLocationUpdated.bind(this));
this._simple.connect("notify::location", (simple) => {
this._onLocationUpdated(simple);
});
this._onLocationUpdated(this._simple);
}
......@@ -113,8 +116,9 @@ var CurrentLocationController = class CurrentLocationController {
this._startGeolocationService();
} else {
this._locationUpdatedId =
this._simple.connect("notify::location",
this._onLocationUpdated.bind(this));
this._simple.connect("notify::location", (simple) => {
this._onLocationUpdated(simple);
});
}
} else {
this._simple.disconnect(this._locationUpdatedId);
......
......@@ -70,7 +70,9 @@ var MainWindow = GObject.registerClass(
this._searchView = builder.get_object('initial-grid');
this._searchEntry = builder.get_object('initial-grid-location-entry');
this._searchEntry.connect('notify::location', this._searchLocationChanged.bind(this));
this._searchEntry.connect('notify::location', (entry) => {
this._searchLocationChanged(entry);
});
let placesButton = builder.get_object('places-button');
this._pageWidgets[Page.CITY].push(placesButton);
......
......@@ -58,7 +58,7 @@ var WorldContentView = GObject.registerClass(
});
let locationEntry = builder.get_object('location-entry');
locationEntry.connect('notify::location', this._locationChanged.bind(this));
locationEntry.connect('notify::location', (entry) => this._locationChanged(entry));
this.connect('show', () => {
locationEntry.grab_focus();
......@@ -102,10 +102,15 @@ var WorldContentView = GObject.registerClass(
});
this._stackPopover = builder.get_object('popover-stack');
this._listbox.set_filter_func(this._filterListbox.bind(this));
this._listbox.set_filter_func((row) => this._filterListbox(row));
this.model.connect('location-added', this._onLocationAdded.bind(this));
this.model.connect('location-removed', this._onLocationRemoved.bind(this));
this.model.connect('location-added', (model, info, is_current) => {
this._onLocationAdded(model, info, is_current);
});
this.model.connect('location-removed', (model, info) => {
this._onLocationRemoved(model, info);
});
this._currentLocationAdded = false;
let list = this.model.getAll();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment