diff options
author | Marcus Lundblad <ml@dfupdate.se> | 2022-05-30 22:47:07 +0200 |
---|---|---|
committer | Marcus Lundblad <ml@dfupdate.se> | 2022-06-08 22:08:34 +0200 |
commit | 0aa17f6ceafacf7c5268760f32d0ab3798b3e570 (patch) | |
tree | 3cf84c4a0810a51862a8c1183a11fb9cb8838916 /src/osmTypeListRow.js | |
parent | 220dfec3255c07ea71d6c1ca5dc5b5f9f263168a (diff) | |
download | gnome-maps-0aa17f6ceafacf7c5268760f32d0ab3798b3e570.tar.gz |
Migrate to ES6 modules
Switch to using ES6 modules for internal
modules and GI modules instead of using
the legacy imports object.
The unit tests are still using imports.jsunit
as this is not available as an ES6 module
(the preferred solution now is to use
jasmine-gjs). imports.bytearray,
imports.format, and imports.mainloop are
covered in follow-up commits.
Diffstat (limited to 'src/osmTypeListRow.js')
-rw-r--r-- | src/osmTypeListRow.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/osmTypeListRow.js b/src/osmTypeListRow.js index 795d203c..84bb0c48 100644 --- a/src/osmTypeListRow.js +++ b/src/osmTypeListRow.js @@ -19,19 +19,16 @@ * Author: Marcus Lundblad <ml@update.uu.se> */ -const GObject = imports.gi.GObject; -const Gtk = imports.gi.Gtk; +import GObject from 'gi://GObject'; +import Gtk from 'gi://Gtk'; -var OSMTypeListRow = GObject.registerClass({ - Template: 'resource:///org/gnome/Maps/ui/osm-type-list-row.ui', - InternalChildren: [ 'name' ] -}, class OSMTypeListRow extends Gtk.ListBoxRow { +export class OSMTypeListRow extends Gtk.ListBoxRow { - _init(props) { + constructor(props) { this._type = props.type; delete props.type; - super._init(props); + super(props); this._name.label = this._type.title; } @@ -47,4 +44,9 @@ var OSMTypeListRow = GObject.registerClass({ get title() { return this._type.title; } -}); +} + +GObject.registerClass({ + Template: 'resource:///org/gnome/Maps/ui/osm-type-list-row.ui', + InternalChildren: [ 'name' ] +}, OSMTypeListRow); |