[gnome-maps/wip/mlundblad/es6] WIP: Use ES6 classes with GObject extensions



commit 27c1f25bfd896bf8d86258b5e0c7e2ad6d8a9931
Author: Marcus Lundblad <ml update uu se>
Date:   Mon Nov 20 21:27:49 2017 +0100

    WIP: Use ES6 classes with GObject extensions

 src/accountListBox.js              |   26 ++---
 src/application.js                 |   88 ++++++++--------
 src/busyMarker.js                  |    8 +-
 src/checkIn.js                     |   55 +++++------
 src/checkInDialog.js               |   58 +++++------
 src/contactPlace.js                |   16 ++--
 src/contextMenu.js                 |   48 ++++-----
 src/exportViewDialog.js            |   40 ++++----
 src/facebookBackend.js             |   52 +++++-----
 src/favoritesPopover.js            |   20 ++--
 src/foursquareBackend.js           |   51 +++++-----
 src/foursquareGoaAuthorizer.js     |   29 +++---
 src/geoJSONShapeLayer.js           |   24 +++--
 src/geoJSONSource.js               |   78 +++++++-------
 src/geoJSONStyle.js                |   13 +--
 src/geoclue.js                     |   26 ++---
 src/geocodeService.js              |   15 +--
 src/gpxShapeLayer.js               |   18 ++--
 src/graphHopper.js                 |   48 ++++-----
 src/http.js                        |   16 ++--
 src/instructionRow.js              |   13 +--
 src/kmlShapeLayer.js               |   19 ++--
 src/layersPopover.js               |   36 +++----
 src/location.js                    |   17 ++--
 src/locationServiceNotification.js |   11 +-
 src/longPrintLayout.js             |   17 ++--
 src/mainWindow.js                  |  129 ++++++++++++------------
 src/mapBubble.js                   |   37 +++----
 src/mapMarker.js                   |   94 +++++++++---------
 src/mapSource.js                   |   17 ++--
 src/mapView.js                     |  138 ++++++++++++-------------
 src/mapWalker.js                   |   37 ++++---
 src/notification.js                |   34 +++----
 src/notificationManager.js         |   20 ++--
 src/openTripPlanner.js             |  197 +++++++++++++++++-------------------
 src/osmAccountDialog.js            |   54 +++++-----
 src/osmConnection.js               |  124 +++++++++++------------
 src/osmEdit.js                     |   90 ++++++++---------
 src/serviceBackend.js              |   44 ++++----
 src/shapeLayer.js                  |   38 ++++----
 40 files changed, 910 insertions(+), 985 deletions(-)
---
diff --git a/src/accountListBox.js b/src/accountListBox.js
index e45a21e..e829535 100644
--- a/src/accountListBox.js
+++ b/src/accountListBox.js
@@ -21,25 +21,23 @@
 
 const Gio = imports.gi.Gio;
 const Goa = imports.gi.Goa;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
 
 const Application = imports.application;
 
-var AccountRow = new Lang.Class({
-    Name: 'AccountRow',
-    Extends: Gtk.ListBoxRow,
+var AccountRow = GObject.registerClass({
     Template: 'resource:///org/gnome/Maps/ui/account-row.ui',
     InternalChildren: [ 'providerLabel',
                         'identityLabel',
                         'providerImage',
                         'attentionNeededImage' ],
-
-    _init: function(params) {
+}, class AccountRow extends Gtk.ListBoxRow {
+    _init(params) {
         this.account = params.account;
         delete params.account;
 
-        this.parent(params);
+        super._init(params);
 
         let account = this.account.get_account();
 
@@ -50,16 +48,14 @@ var AccountRow = new Lang.Class({
     }
 });
 
-var AccountListBox = new Lang.Class({
-    Name: 'AccountListBox',
-    Extends: Gtk.ListBox,
+var AccountListBox = GObject.registerClass({
     Signals: {
         'account-selected': { param_types: [Goa.Object] }
     },
-
-    _init: function(params) {
+}, class AccountListBox extends Gtk.ListBox {
+    _init(params) {
         params.activate_on_single_click = true;
-        this.parent(params);
+        super._init(params);
 
         Application.checkInManager.connect('accounts-refreshed', () => { this.refresh(); });
 
@@ -67,9 +63,9 @@ var AccountListBox = new Lang.Class({
                      (list, row) => { this.emit('account-selected', row.account); });
 
         this.refresh();
-    },
+    }
 
-    refresh: function() {
+    refresh() {
         let accounts = Application.checkInManager.accounts;
 
         this.forall(function(row) {
diff --git a/src/application.js b/src/application.js
index c155ba3..6e2fb9f 100644
--- a/src/application.js
+++ b/src/application.js
@@ -25,7 +25,6 @@ const GObject = imports.gi.GObject;
 const Gio = imports.gi.Gio;
 const Gtk = imports.gi.Gtk;
 const GtkClutter = imports.gi.GtkClutter;
-const Lang = imports.lang;
 const WebKit2 = imports.gi.WebKit2;
 
 const CheckIn = imports.checkIn;
@@ -62,9 +61,7 @@ var routeQuery = null;
 const _ensuredTypes = [WebKit2.WebView,
                        OSMTypeSearchEntry.OSMTypeSearchEntry];
 
-var Application = new Lang.Class({
-    Name: 'Application',
-    Extends: Gtk.Application,
+var Application = GObject.registerClass({
     Properties: {
         'connected': GObject.ParamSpec.boolean('connected',
                                                '',
@@ -72,24 +69,25 @@ var Application = new Lang.Class({
                                                GObject.ParamFlags.READABLE |
                                                GObject.ParamFlags.WRITABLE)
     },
+}, class Application extends Gtk.Application {
 
     set connected(p) {
         this._connected = p;
         this.notify('connected');
-    },
+    }
 
     get connected() {
         return this._connected;
-    },
+    }
 
-    _init: function() {
+    _init() {
         /* Translators: This is the program name. */
         GLib.set_application_name(_("Maps"));
 
         /* Needed to be able to use in UI files */
         _ensuredTypes.forEach((type) => { GObject.type_ensure(type); });
 
-        this.parent({ application_id: 'org.gnome.Maps',
+        super._init({ application_id: 'org.gnome.Maps',
                       flags: Gio.ApplicationFlags.HANDLES_OPEN });
         this._connected = false;
 
@@ -118,13 +116,13 @@ var Application = new Lang.Class({
 
             return -1;
         });
-    },
+    }
 
-    _checkNetwork: function() {
+    _checkNetwork() {
         this.connected = networkMonitor.connectivity === Gio.NetworkConnectivity.FULL;
-    },
+    }
 
-    _showContact: function(id) {
+    _showContact(id) {
         contactStore.lookup(id, (contact) => {
             this._mainWindow.markBusy();
             if (!contact) {
@@ -136,9 +134,9 @@ var Application = new Lang.Class({
                 this._mainWindow.mapView.showContact(contact);
             });
         });
-    },
+    }
 
-    _onShowContactActivate: function(action, parameter) {
+    _onShowContactActivate(action, parameter) {
         this._createWindow();
         this._checkNetwork();
         this._mainWindow.present();
@@ -153,20 +151,20 @@ var Application = new Lang.Class({
                     this._showContact(id);
             });
         }
-    },
+    }
 
-    _onQuitActivate: function() {
+    _onQuitActivate() {
         this._mainWindow.destroy();
-    },
+    }
 
-    _onOsmAccountSetupActivate: function() {
+    _onOsmAccountSetupActivate() {
         let dialog = osmEdit.createAccountDialog(this._mainWindow, false);
 
         dialog.show();
         dialog.connect('response', () => { dialog.destroy(); });
-    },
+    }
 
-    _addContacts: function() {
+    _addContacts() {
         contactStore.get_contacts().forEach((contact) => {
             contact.geocode(function() {
                 contact.get_places().forEach((p) => {
@@ -180,9 +178,9 @@ var Application = new Lang.Class({
                 });
             });
         });
-    },
+    }
 
-    _initPlaceStore: function() {
+    _initPlaceStore() {
         placeStore = new PlaceStore.PlaceStore({
             recentPlacesLimit: settings.get('recent-places-limit'),
             recentRoutesLimit: settings.get('recent-routes-limit')
@@ -202,18 +200,18 @@ var Application = new Lang.Class({
                     this._addContacts();
             });
         }
-    },
+    }
 
-    _initAppMenu: function() {
+    _initAppMenu() {
         let builder = new Gtk.Builder();
         builder.add_from_resource('/org/gnome/Maps/ui/app-menu.ui');
 
         let menu = builder.get_object('app-menu');
         this.set_app_menu(menu);
-    },
+    }
 
-    vfunc_startup: function() {
-        this.parent();
+    vfunc_startup() {
+        super.vfunc_startup();
 
         GtkClutter.init(null);
 
@@ -237,9 +235,9 @@ var Application = new Lang.Class({
                                                                              'icons']));
         this._initPlaceStore();
         this._initAppMenu();
-    },
+    }
 
-    _initServices: function() {
+    _initServices() {
         settings         = Settings.getSettings('org.gnome.Maps');
         routeQuery       = new RouteQuery.RouteQuery();
         routingDelegator = new RoutingDelegator.RoutingDelegator({ query: routeQuery });
@@ -252,9 +250,9 @@ var Application = new Lang.Class({
         contactStore = new Maps.ContactStore();
         contactStore.load();
         osmEdit = new OSMEdit.OSMEdit();
-    },
+    }
 
-    _createWindow: function() {
+    _createWindow() {
         if (this._mainWindow)
             return;
 
@@ -268,24 +266,24 @@ var Application = new Lang.Class({
                 log('* focus widget: %s'.format(widget));
             });
         }
-    },
+    }
 
-    vfunc_dbus_register: function(connection, path) {
-        this.parent(connection, path);
+    vfunc_dbus_register(connection, path) {
+        super.vfunc_dbus_register(connection, path);
         return true;
-    },
+    }
 
-    vfunc_dbus_unregister: function(connection, path) {
-        this.parent(connection, path);
-    },
+    vfunc_dbus_unregister(connection, path) {
+        super.vfunc_dbus_register(connection, path);
+    }
 
-    vfunc_activate: function() {
+    vfunc_activate() {
         this._createWindow();
         this._checkNetwork();
         this._mainWindow.present();
-    },
+    }
 
-    _openInternal: function(files) {
+    _openInternal(files) {
         if (!this._mainWindow || !this._mainWindow.mapView.view.realized)
             return;
 
@@ -298,9 +296,9 @@ var Application = new Lang.Class({
         } else {
             this._mainWindow.mapView.openShapeLayers(files);
         }
-    },
+    }
 
-    vfunc_open: function(files) {
+    vfunc_open(files) {
         normalStartup = false;
         this.activate();
 
@@ -310,9 +308,9 @@ var Application = new Lang.Class({
         else
             mapView.view.connect('notify::realized',
                                  this._openInternal.bind(this, files));
-    },
+    }
 
-    _onWindowDestroy: function(window) {
+    _onWindowDestroy(window) {
         this._mainWindow = null;
     }
 });
diff --git a/src/busyMarker.js b/src/busyMarker.js
index b53962d..3f99c3d 100644
--- a/src/busyMarker.js
+++ b/src/busyMarker.js
@@ -18,10 +18,8 @@
  */
 
 const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
+const GObject = imports.gi.GObject;
 
-var BusyMarker = new Lang.Class({
-    Name: 'BusyMarker',
-    Extends: Gtk.Frame,
+var BusyMarker = GObject.registerClass({
     Template: 'resource:///org/gnome/Maps/ui/busy-marker.ui'
-});
+}, class BusyMarker extends Gtk.Frame {});
diff --git a/src/checkIn.js b/src/checkIn.js
index d75d492..e314da7 100644
--- a/src/checkIn.js
+++ b/src/checkIn.js
@@ -22,15 +22,12 @@
 const GObject = imports.gi.GObject;
 const Goa = imports.gi.Goa;
 const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
 
 const CheckInDialog = imports.checkInDialog;
 const FacebookBackend = imports.facebookBackend;
 const FoursquareBackend = imports.foursquareBackend;
 
-var CheckInManager = new Lang.Class({
-    Name: 'CheckInManager',
-    Extends: GObject.Object,
+var CheckInManager = GObject.registerClass({
     Signals: {
         'accounts-refreshed': { }
     },
@@ -39,10 +36,10 @@ var CheckInManager = new Lang.Class({
                                                 '',
                                                 '',
                                                 GObject.ParamFlags.READABLE)
-    },
-
-    _init: function() {
-        this.parent();
+    }
+}, class CheckInManager extends GObject.Object {
+    _init() {
+        super._init();
 
         try {
             this._goaClient = Goa.Client.new_sync(null);
@@ -66,17 +63,17 @@ var CheckInManager = new Lang.Class({
         }
 
         this._refreshGoaAccounts();
-    },
+    }
 
-    _initBackends: function() {
+    _initBackends() {
         let facebookBackend = new FacebookBackend.FacebookBackend();
         this._backends[facebookBackend.name] = facebookBackend;
 
         let foursquareBackend = new FoursquareBackend.FoursquareBackend();
         this._backends[foursquareBackend.name] = foursquareBackend;
-    },
+    }
 
-    _refreshGoaAccounts: function() {
+    _refreshGoaAccounts() {
         if (!this._goaClient)
             return;
         let accounts = this._goaClient.get_accounts();
@@ -99,39 +96,39 @@ var CheckInManager = new Lang.Class({
 
         this.emit('accounts-refreshed');
         this.notify('hasCheckIn');
-    },
+    }
 
     get client() {
         return this._goaClient;
-    },
+    }
 
     get accounts() {
         return this._accounts;
-    },
+    }
 
     get hasCheckIn() {
         return this._accounts.length > 0;
-    },
+    }
 
-    _getAuthorizer: function(account) {
+    _getAuthorizer(account) {
         return this._authorizers[account.get_account().id];
-    },
+    }
 
-    _getBackend: function(account) {
+    _getBackend(account) {
         return this._backends[account.get_account().provider_type];
-    },
+    }
 
-    performCheckIn: function(account, checkIn, callback, cancellable) {
+    performCheckIn(account, checkIn, callback, cancellable) {
         this._getBackend(account)
             .performCheckIn(this._getAuthorizer(account), checkIn, callback, cancellable);
-    },
+    }
 
-    findPlaces: function(account, latitude, longitude, distance, callback, cancellable) {
+    findPlaces(account, latitude, longitude, distance, callback, cancellable) {
         this._getBackend(account)
             .findPlaces(this._getAuthorizer(account), latitude, longitude, distance, callback, cancellable);
-    },
+    }
 
-    showCheckInDialog: function(parentWindow, place, matchPlace) {
+    showCheckInDialog(parentWindow, place, matchPlace) {
         let dialog = new CheckInDialog.CheckInDialog({ transient_for: parentWindow,
                                                        matchPlace: matchPlace,
                                                        place: place });
@@ -170,14 +167,12 @@ var CheckInManager = new Lang.Class({
     }
 });
 
-var CheckIn = new Lang.Class({
-    Name: 'CheckIn',
-
-    _init: function() {
+var CheckIn = class {
+    _init() {
         this.message = null;
         this.place = null;
         this.privacy = null;
         this.broadcastFacebook = false;
         this.broadcastTwitter = false;
     }
-});
+};
diff --git a/src/checkInDialog.js b/src/checkInDialog.js
index 66dd6e9..371465b 100644
--- a/src/checkInDialog.js
+++ b/src/checkInDialog.js
@@ -20,8 +20,8 @@
  */
 
 const Gio = imports.gi.Gio;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 
 const AccountListBox = imports.accountListBox;
@@ -39,9 +39,7 @@ var Response = {
     FAILURE_CHECKIN_DISABLED: 5
 };
 
-var CheckInDialog = new Lang.Class({
-    Name: 'CheckInDialog',
-    Extends: Gtk.Dialog,
+var CheckInDialog = GObject.registerClass({
     Template: 'resource:///org/gnome/Maps/ui/check-in-dialog.ui',
     InternalChildren: [ 'cancelButton',
                         'okButton',
@@ -59,8 +57,8 @@ var CheckInDialog = new Lang.Class({
                         'foursquareOptionsPrivacyComboBox',
                         'foursquareOptionsBroadcastFacebookCheckButton',
                         'foursquareOptionsBroadcastTwitterCheckButton' ],
-
-    _init: function(params) {
+}, class CheckInDialog extends Gtk.Dialog {
+    _init(params) {
         this._place = params.place;
         delete params.place;
 
@@ -70,7 +68,7 @@ var CheckInDialog = new Lang.Class({
         // This is a construct-only property and cannot be set by GtkBuilder
         params.use_header_bar = true;
 
-        this.parent(params);
+        super._init(params);
 
         this._account = null;
         this._checkIn = new CheckIn.CheckIn();
@@ -86,16 +84,16 @@ var CheckInDialog = new Lang.Class({
 
         this._initHeaderBar();
         this._initWidgets();
-    },
+    }
 
-    _initHeaderBar: function() {
+    _initHeaderBar() {
         this._cancelButton.connect('clicked',
                                    () => { this._cancellable.cancel(); });
 
         this._okButton.connect('clicked', () => { this._startCheckInStep(); });
-    },
+    }
 
-    _initWidgets: function() {
+    _initWidgets() {
         // Limitations in Gjs means we can't do this in UI files yet
         this._accountListBox = new AccountListBox.AccountListBox({ visible: true });
         this._accountFrame.add(this._accountListBox);
@@ -128,14 +126,14 @@ var CheckInDialog = new Lang.Class({
             this._checkIn.place = place;
             this._startMessageStep();
         });
-    },
+    }
 
-    vfunc_show: function() {
+    vfunc_show() {
         this._startup();
-        this.parent();
-    },
+        super.vfunc_show();
+    }
 
-    _startup: function() {
+    _startup() {
         let accounts = Application.checkInManager.accounts;
 
         if (accounts.length > 1)
@@ -148,9 +146,9 @@ var CheckInDialog = new Lang.Class({
                 this.response(Response.FAILURE_CHECKIN_DISABLED);
             });
         }
-    },
+    }
 
-    _onAccountRefreshed: function() {
+    _onAccountRefreshed() {
         let accounts = Application.checkInManager.accounts;
 
         if (!Application.checkInManager.hasCheckIn)
@@ -163,14 +161,14 @@ var CheckInDialog = new Lang.Class({
 
             this.response(Response.FAILURE_ACCOUNT_DISABLED);
         }
-    },
+    }
 
-    _startAccountStep: function() {
+    _startAccountStep() {
         this.set_title(_("Select an account"));
         this._stack.set_visible_child_name('account');
-    },
+    }
 
-    _startPlaceStep: function() {
+    _startPlaceStep() {
         this.set_title(_("Loading"));
         this._stack.set_visible_child_name('loading');
 
@@ -180,9 +178,9 @@ var CheckInDialog = new Lang.Class({
                                               100,
                                               this._onFindPlacesFinished.bind(this),
                                               this._cancellable);
-    },
+    }
 
-    _onFindPlacesFinished: function(account, places, error) {
+    _onFindPlacesFinished(account, places, error) {
         if (!error) {
             if (places.length === 0) {
                 this.response(Response.FAILURE_NO_PLACES);
@@ -212,9 +210,9 @@ var CheckInDialog = new Lang.Class({
             this.error = error;
             this.response(Response.FAILURE_GET_PLACES);
         }
-    },
+    }
 
-    _startMessageStep: function() {
+    _startMessageStep() {
         /* Translators: %s is the name of the place to check in.
          */
         this.set_title(_("Check in to %s").format(this._checkIn.place.name));
@@ -240,9 +238,9 @@ var CheckInDialog = new Lang.Class({
                 optionsGrids[provider].show();
             else
                 optionsGrids[provider].hide();
-    },
+    }
 
-    _startCheckInStep: function() {
+    _startCheckInStep() {
         this.set_title(_("Loading"));
         this._stack.set_visible_child_name('loading');
 
@@ -268,9 +266,9 @@ var CheckInDialog = new Lang.Class({
                                                   this._checkIn,
                                                   this._onPerformCheckInFinished.bind(this),
                                                   this._cancellable);
-    },
+    }
 
-    _onPerformCheckInFinished: function (account, data, error) {
+    _onPerformCheckInFinished(account, data, error) {
         if (!error)
             this.response(Response.SUCCESS);
         else {
diff --git a/src/contactPlace.js b/src/contactPlace.js
index b2d8876..961ea29 100644
--- a/src/contactPlace.js
+++ b/src/contactPlace.js
@@ -19,25 +19,23 @@
  * Author: Jonas Danielsson <jonas threetimestwo org>
  */
 
-const Lang = imports.lang;
+const GObject = imports.gi.GObject;
 
 const Place = imports.place;
 
-var ContactPlace = new Lang.Class({
-    Name: 'ContactPlace',
-    Extends: Place.Place,
-
-    _init: function(params) {
+var ContactPlace = GObject.registerClass({},
+class ContactPlace extends Place.Place {
+    _init(params) {
         this._contact = params.contact;
         delete params.contact;
 
         params.store = false;
-        this.parent(params);
-    },
+        super._init(params);
+    }
 
     get icon() {
         return this._contact.icon;
-    },
+    }
 
     get uniqueID() {
         return [this.name,
diff --git a/src/contextMenu.js b/src/contextMenu.js
index c80b42b..d604991 100644
--- a/src/contextMenu.js
+++ b/src/contextMenu.js
@@ -22,12 +22,12 @@
 const Champlain = imports.gi.Champlain;
 const Gdk = imports.gi.Gdk;
 const Geocode = imports.gi.GeocodeGlib;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 const Mainloop = imports.mainloop;
 
 const Application = imports.application;
 const ExportViewDialog = imports.exportViewDialog;
-const Lang = imports.lang;
 const Location = imports.location;
 const OSMAccountDialog = imports.osmAccountDialog;
 const OSMEdit = imports.osmEdit;
@@ -36,24 +36,22 @@ const Place = imports.place;
 const Utils = imports.utils;
 const ZoomInNotification = imports.zoomInNotification;
 
-var ContextMenu = new Lang.Class({
-    Name: 'ContextMenu',
-    Extends: Gtk.Menu,
+var ContextMenu = GObject.registerClass({
     Template: 'resource:///org/gnome/Maps/ui/context-menu.ui',
     InternalChildren: [ 'whatsHereItem',
                         'geoURIItem',
                         'exportItem',
                         'addOSMLocationItem',
                         'routeItem' ],
-
-    _init: function(params) {
+}, class ContextMenu extends Gtk.Menu {
+    _init(params) {
         this._mapView = params.mapView;
         delete params.mapView;
 
         this._mainWindow = params.mainWindow;
         delete params.mainWindow;
 
-        this.parent(params);
+        super._init(params);
 
         this._mapView.connect('button-release-event',
                               this._onButtonReleaseEvent.bind(this));
@@ -72,9 +70,9 @@ var ContextMenu = new Lang.Class({
                                        this._routingUpdate.bind(this));
         this._routeItem.visible = false;
         this._routingUpdate();
-    },
+    }
 
-    _onButtonReleaseEvent: function(widget, event) {
+    _onButtonReleaseEvent(widget, event) {
         let [, button] = event.get_button();
         let [, x, y] = event.get_coords();
         this._longitude = this._mapView.view.x_to_longitude(x);
@@ -84,9 +82,9 @@ var ContextMenu = new Lang.Class({
             // Need idle to avoid Clutter dead-lock on re-entrance
             Mainloop.idle_add(() => { this.popup_at_pointer(event); });
         }
-    },
+    }
 
-    _routingUpdate: function() {
+    _routingUpdate() {
         let query = Application.routeQuery;
 
         if (query.points.length === 0)
@@ -100,9 +98,9 @@ var ContextMenu = new Lang.Class({
         } else {
             this._routeItem.label = _("Route to here");
         }
-    },
+    }
 
-    _onRouteActivated: function() {
+    _onRouteActivated() {
         let query = Application.routeQuery;
         let location = new Location.Location({ latitude: this._latitude,
                                                longitude: this._longitude,
@@ -116,9 +114,9 @@ var ContextMenu = new Lang.Class({
         } else {
             query.points[query.points.length - 1].place = place;
         }
-    },
+    }
 
-    _onWhatsHereActivated: function() {
+    _onWhatsHereActivated() {
         let location = new Location.Location({ latitude: this._latitude,
                                                longitude: this._longitude,
                                                accuracy: 0 });
@@ -131,9 +129,9 @@ var ContextMenu = new Lang.Class({
                 Application.notificationManager.showMessage(msg);
             }
         });
-    },
+    }
 
-    _onGeoURIActivated: function() {
+    _onGeoURIActivated() {
         let location = new Location.Location({ latitude: this._latitude,
                                                longitude: this._longitude,
                                                accuracy: 0 });
@@ -142,9 +140,9 @@ var ContextMenu = new Lang.Class({
         let uri = location.to_uri(Geocode.LocationURIScheme.GEO);
 
         clipboard.set_text(uri, uri.length);
-    },
+    }
 
-    _onAddOSMLocationActivated: function() {
+    _onAddOSMLocationActivated() {
         let osmEdit = Application.osmEdit;
         /* if the user is not alread signed in, show the account dialog */
         if (!osmEdit.isSignedIn) {
@@ -161,9 +159,9 @@ var ContextMenu = new Lang.Class({
         }
 
         this._addOSMLocation();
-    },
+    }
 
-    _addOSMLocation: function() {
+    _addOSMLocation() {
         let osmEdit = Application.osmEdit;
 
         if (this._mapView.view.get_zoom_level() < OSMEdit.MIN_ADD_LOCATION_ZOOM_LEVEL) {
@@ -187,9 +185,9 @@ var ContextMenu = new Lang.Class({
                     _("Location was added to the map, note that it may take a while before it shows on the 
map and in search results."));
             }
         });
-    },
+    }
 
-    _activateExport: function() {
+    _activateExport() {
         let view = this._mapView.view;
         let surface = view.to_surface(true);
         let bbox = view.get_bounding_box();
@@ -206,9 +204,9 @@ var ContextMenu = new Lang.Class({
 
         dialog.connect('response', () => { dialog.destroy(); });
         dialog.show_all();
-    },
+    }
 
-    _onExportActivated: function() {
+    _onExportActivated() {
         if (this._mapView.view.state === Champlain.State.DONE) {
             this._activateExport();
         } else {
diff --git a/src/exportViewDialog.js b/src/exportViewDialog.js
index c946563..55295dc 100644
--- a/src/exportViewDialog.js
+++ b/src/exportViewDialog.js
@@ -21,8 +21,8 @@ const Cairo = imports.cairo;
 const Gdk = imports.gi.Gdk;
 const GLib = imports.gi.GLib;
 const Gio = imports.gi.Gio;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
 
 const Utils = imports.utils;
 
@@ -33,9 +33,7 @@ var Response = {
 
 const _PREVIEW_WIDTH = 150;
 
-var ExportViewDialog = new Lang.Class({
-    Name: 'ExportViewDialog',
-    Extends: Gtk.Dialog,
+var ExportViewDialog = GObject.registerClass({
     Template: 'resource:///org/gnome/Maps/ui/export-view-dialog.ui',
     InternalChildren: [ 'exportButton',
                         'cancelButton',
@@ -43,8 +41,8 @@ var ExportViewDialog = new Lang.Class({
                         'fileChooserButton',
                         'previewArea',
                         'layersCheckButton' ],
-
-    _init: function(params) {
+}, class ExportViewDialog extends Gtk.Dialog {
+    _init(params) {
         this._surface = params.surface;
         delete params.surface;
 
@@ -58,7 +56,7 @@ var ExportViewDialog = new Lang.Class({
         delete params.mapView;
 
         params.use_header_bar = true;
-        this.parent(params);
+        super._init(params);
 
         this._cancelButton.connect('clicked', () => { this.response(Response.CANCEL); });
         this._exportButton.connect('clicked', () => { this._exportView(); });
@@ -74,18 +72,18 @@ var ExportViewDialog = new Lang.Class({
         this._filenameEntry.text = this._fileName = this._getName();
         this._fileChooserButton.set_current_folder(this._folder);
         this._setupPreviewArea();
-    },
+    }
 
-    _getName: function() {
+    _getName() {
         /* Translators: This is a format string for a PNG filename for an
          * exported image with coordinates. The .png extension should be kept
          * intact in the translated string.
          */
         return _("Maps at %f, %f.png").format(this._latitude.toFixed(2),
                                               this._longitude.toFixed(2));
-    },
+    }
 
-    _setupPreviewArea: function() {
+    _setupPreviewArea() {
         let [surfaceWidth, surfaceHeight] = this._mapView.view.get_size();
 
         let width = _PREVIEW_WIDTH;
@@ -95,9 +93,9 @@ var ExportViewDialog = new Lang.Class({
         this._previewArea.set_size_request(width, height);
         this._previewArea.connect('draw',
                                   (w, cr) => { this._drawPreview(w, cr); });
-    },
+    }
 
-    _drawPreview: function(widget, cr) {
+    _drawPreview(widget, cr) {
         cr.setOperator(Cairo.Operator.CLEAR);
         cr.paint();
         cr.setOperator(Cairo.Operator.OVER);
@@ -105,9 +103,9 @@ var ExportViewDialog = new Lang.Class({
         cr.scale(this._scaleFactor, this._scaleFactor);
         cr.setSourceSurface(this._surface, 0, 0);
         cr.paint();
-    },
+    }
 
-    _onFileNameChanged: function() {
+    _onFileNameChanged() {
         let name = GLib.filename_from_utf8(this._filenameEntry.text, -1)[0];
         name = name.toString();
         if (!name) {
@@ -122,9 +120,9 @@ var ExportViewDialog = new Lang.Class({
         } catch(e) {
             this._exportButton.sensitive = false;
         }
-    },
+    }
 
-    _onFolderChanged: function() {
+    _onFolderChanged() {
         let folder = this._fileChooserButton.get_filename();
 
         if (!GLib.file_test(folder, GLib.FileTest.IS_DIR)) {
@@ -138,9 +136,9 @@ var ExportViewDialog = new Lang.Class({
 
         this._exportButton.sensitive = true;
         this._folder = folder;
-    },
+    }
 
-    _exportView: function() {
+    _exportView() {
         let [width, height] = this._mapView.view.get_size();
         let pixbuf = Gdk.pixbuf_get_from_surface(this._surface, 0, 0, width, height);
         let path = GLib.build_filenamev([this._folder, this._fileName]);
@@ -174,9 +172,9 @@ var ExportViewDialog = new Lang.Class({
             dialog.connect('response', () => { dialog.destroy(); });
             dialog.show_all();
         }
-    },
+    }
 
-    _includeLayersChanged: function() {
+    _includeLayersChanged() {
         let includeLayers = this._layersCheckButton.get_active();
 
         this._surface = this._mapView.view.to_surface(includeLayers);
diff --git a/src/facebookBackend.js b/src/facebookBackend.js
index c01306f..9bf0f7d 100644
--- a/src/facebookBackend.js
+++ b/src/facebookBackend.js
@@ -20,43 +20,41 @@
  */
 
 const GFBGraph = imports.gi.GFBGraph;
-const Lang = imports.lang;
+const GObject = imports.gi.GObject;
 
 const ServiceBackend = imports.serviceBackend;
 const SocialPlace = imports.socialPlace;
 
 const _PLACE_LINK_FORMAT = 'https://www.facebook.com/%s';
 
-var FacebookBackend = new Lang.Class({
-    Name: 'SocialServiceFacebookBackend',
-    Extends: ServiceBackend.ServiceBackend,
-
+var FacebookBackend = GObject.registerClass({},
+class FacebookBackend extends ServiceBackend.ServiceBackend {
     get name() {
         return 'facebook';
-    },
+    }
 
-    createRestCall: function(authorizer) {
+    createRestCall(authorizer) {
         return GFBGraph.new_rest_call(authorizer);
-    },
+    }
 
-    refreshAuthorization: function(authorizer, cancellable) {
+    refreshAuthorization(authorizer, cancellable) {
         return authorizer.refresh_authorization(cancellable);
-    },
+    }
 
-    getAuthorizerAccount: function(authorizer) {
+    getAuthorizerAccount(authorizer) {
         return authorizer.goa_object;
-    },
+    }
 
-    createAuthorizer: function(account) {
+    createAuthorizer(account) {
         return new GFBGraph.GoaAuthorizer({ goa_object: account });
-    },
+    }
 
-    isTokenInvalid: function(restCall, data) {
+    isTokenInvalid(restCall, data) {
         return data.error &&
                (data.error.code === 2500 || data.error.code === 104 || data.error.code === 190);
-    },
+    }
 
-    isInvalidCall: function(restCall, data) {
+    isInvalidCall(restCall, data) {
         if (!data) {
             return true;
         } else if (data.error) {
@@ -64,21 +62,21 @@ var FacebookBackend = new Lang.Class({
         } else {
             return false;
         }
-    },
+    }
 
-    getCallResultCode: function(restCall, data) {
+    getCallResultCode(restCall, data) {
         return data ?
             (data.error ? data.error.code : null) :
             restCall.get_status_code();
-    },
+    }
 
-    getCallResultMessage: function(restCall, data) {
+    getCallResultMessage(restCall, data) {
         return data ?
             (data.error ? data.error.message : null) :
             restCall.get_status_message();
-    },
+    }
 
-    _realPerformCheckIn: function(authorizer, checkIn, callback, cancellable) {
+    _realPerformCheckIn(authorizer, checkIn, callback, cancellable) {
         this.callAsync(authorizer,
                        'POST',
                        'me/feed',
@@ -89,9 +87,9 @@ var FacebookBackend = new Lang.Class({
                        },
                        callback,
                        cancellable);
-    },
+    }
 
-    _realFindPlaces: function(authorizer, latitude, longitude, distance, callback, cancellable) {
+    _realFindPlaces(authorizer, latitude, longitude, distance, callback, cancellable) {
         this.callAsync(authorizer,
                        'GET',
                        'search',
@@ -102,9 +100,9 @@ var FacebookBackend = new Lang.Class({
                        },
                        callback,
                        cancellable);
-    },
+    }
 
-    createPlaces: function(rawData) {
+    createPlaces(rawData) {
         return rawData.data.map(function(place) {
             let link = _PLACE_LINK_FORMAT.format(place.id);
 
diff --git a/src/favoritesPopover.js b/src/favoritesPopover.js
index e6a5a0d..34e4ad2 100644
--- a/src/favoritesPopover.js
+++ b/src/favoritesPopover.js
@@ -20,7 +20,6 @@
 const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
 
 const Application = imports.application;
 const PlaceListRow = imports.placeListRow;
@@ -28,9 +27,7 @@ const PlaceStore = imports.placeStore;
 
 const _N_VISIBLE = 6;
 
-var FavoritesPopover = new Lang.Class({
-    Name: 'FavoritesPopover',
-    Extends: Gtk.Popover,
+var FavoritesPopover = GObject.registerClass({
     Template: 'resource:///org/gnome/Maps/ui/favorites-popover.ui',
     InternalChildren: [ 'mainGrid',
                         'revealer',
@@ -44,16 +41,17 @@ var FavoritesPopover = new Lang.Class({
                                         GObject.ParamFlags.READABLE |
                                         GObject.ParamFlags.WRITABLE,
                                         0, GLib.MAXINT32, 0)
-    },
+    }
+}, class FavoritesPopover extends Gtk.Popover {
 
-    _init: function(params) {
+    _init(params) {
         params = params || { };
 
         this._mapView = params.mapView;
         delete params.mapView;
 
         params.transitions_enabled = false;
-        this.parent(params);
+        super._init(params);
 
         this._rows = 0;
 
@@ -92,20 +90,20 @@ var FavoritesPopover = new Lang.Class({
         });
 
         this._updateList();
-    },
+    }
 
     set rows(rows) {
         if (rows !== this._rows) {
             this._rows = rows;
             this.notify('rows');
         }
-    },
+    }
 
     get rows() {
         return this._rows;
-    },
+    }
 
-    _updateList: function() {
+    _updateList() {
         this._list.forall((row) => { row.destroy(); });
 
         let rows = 0;
diff --git a/src/foursquareBackend.js b/src/foursquareBackend.js
index 014c9da..b3c0015 100644
--- a/src/foursquareBackend.js
+++ b/src/foursquareBackend.js
@@ -19,7 +19,7 @@
  * Author: Damián Nohales <damiannohales gmail com>
  */
 
-const Lang = imports.lang;
+const GObject = imports.gi.GObject;
 
 const FoursquareGoaAuthorizer = imports.foursquareGoaAuthorizer;
 const ServiceBackend = imports.serviceBackend;
@@ -27,47 +27,46 @@ const SocialPlace = imports.socialPlace;
 
 const _PLACE_LINK_FORMAT = 'https://foursquare.com/v/foursquare-hq/%s';
 
-var FoursquareBackend = new Lang.Class({
-    Name: 'SocialServiceFoursquareBackend',
-    Extends: ServiceBackend.ServiceBackend,
+var FoursquareBackend = GObject.registerClass({},
+class SocialServiceFoursquareBackend extends ServiceBackend.ServiceBackend {
 
     get name() {
         return 'foursquare';
-    },
+    }
 
-    createRestCall: function(authorizer) {
+    createRestCall(authorizer) {
         return FoursquareGoaAuthorizer.newRestCall(authorizer);
-    },
+    }
 
-    refreshAuthorization: function(authorizer, cancellable) {
+    refreshAuthorization(authorizer, cancellable) {
         return authorizer.refreshAuthorization(cancellable);
-    },
+    }
 
-    getAuthorizerAccount: function(authorizer) {
+    getAuthorizerAccount(authorizer) {
         return authorizer.goaObject;
-    },
+    }
 
-    createAuthorizer: function(account) {
+    createAuthorizer(account) {
         return new FoursquareGoaAuthorizer.FoursquareGoaAuthorizer({ goaObject: account });
-    },
+    }
 
-    isTokenInvalid: function(restCall, data) {
+    isTokenInvalid(restCall, data) {
         return data.meta.code === 401 || data.meta.code === 403;
-    },
+    }
 
-    isInvalidCall: function(restCall, data) {
+    isInvalidCall(restCall, data) {
         return !data || data.meta.code !== 200;
-    },
+    }
 
-    getCallResultCode: function(restCall, data) {
+    getCallResultCode(restCall, data) {
         return data ? data.meta.code : restCall.get_status_code();
-    },
+    }
 
-    getCallResultMessage: function(restCall, data) {
+    getCallResultMessage(restCall, data) {
         return data ? data.meta.errorDetail : restCall.get_status_message();
-    },
+    }
 
-    _realPerformCheckIn: function(authorizer, checkIn, callback, cancellable) {
+    _realPerformCheckIn(authorizer, checkIn, callback, cancellable) {
         let broadcast = checkIn.privacy;
 
         if (checkIn.broadcastFacebook)
@@ -86,9 +85,9 @@ var FoursquareBackend = new Lang.Class({
                        },
                        callback,
                        cancellable);
-    },
+    }
 
-    _realFindPlaces: function(authorizer, latitude, longitude, distance, callback, cancellable) {
+    _realFindPlaces(authorizer, latitude, longitude, distance, callback, cancellable) {
         this.callAsync(authorizer,
                        'GET',
                        'venues/search',
@@ -99,9 +98,9 @@ var FoursquareBackend = new Lang.Class({
                        },
                        callback,
                        cancellable);
-    },
+    }
 
-    createPlaces: function(rawData) {
+    createPlaces(rawData) {
         return rawData.response.venues.map(function(place) {
             let link = _PLACE_LINK_FORMAT.format(place.id);
 
diff --git a/src/foursquareGoaAuthorizer.js b/src/foursquareGoaAuthorizer.js
index ba7538e..71005b7 100644
--- a/src/foursquareGoaAuthorizer.js
+++ b/src/foursquareGoaAuthorizer.js
@@ -20,32 +20,29 @@
  */
 
 const Rest = imports.gi.Rest;
-const Lang = imports.lang;
 
 const _FOURSQUARE_API_VERSION = '20140226';
 
-var FoursquareGoaAuthorizer = new Lang.Class({
-    Name: 'FoursquareGoaAuthorizer',
-
-    _init: function(params) {
+var FoursquareGoaAuthorizer = class FoursquareGoaAuthorizer {
+    _init(params) {
         if (!params.goaObject) {
             logError('FoursquareGoaAuthorizer requires goaObject parameter');
             return;
         }
 
         this.goaObject = params.goaObject;
-    },
+    }
 
     get goaObject() {
         return this._goaObject;
-    },
+    }
 
     set goaObject(object) {
         this._goaObject = object;
         this._accessToken = null;
-    },
+    }
 
-    _refreshAccessToken: function(cancellable) {
+    _refreshAccessToken(cancellable) {
         if (this._accessToken)
             return true;
 
@@ -57,21 +54,21 @@ var FoursquareGoaAuthorizer = new Lang.Class({
         }
 
         return false;
-    },
+    }
 
-    processCall: function(restCall) {
+    processCall(restCall) {
         this._refreshAccessToken(null);
         restCall.add_param('oauth_token', this._accessToken);
         restCall.add_param('v', _FOURSQUARE_API_VERSION);
-    },
+    }
 
-    processMessage: function(soupMessage) {
+    processMessage(soupMessage) {
         this._refreshAccessToken(null);
         let uri = soupMessage.get_uri();
         uri.set_query(uri, 'oauth_token' + this._accessToken + '&v=' + _FOURSQUARE_API_VERSION);
-    },
+    }
 
-    refreshAuthorization: function(cancellable) {
+    refreshAuthorization(cancellable) {
         let ensureCredentialsResult = this.goaObject.get_account().call_ensure_credentials_sync(cancellable);
         if (ensureCredentialsResult[0]) {
             this._accessToken = null;
@@ -80,7 +77,7 @@ var FoursquareGoaAuthorizer = new Lang.Class({
 
         return false;
     }
-});
+};
 
 function newRestCall(authorizer)
 {
diff --git a/src/geoJSONShapeLayer.js b/src/geoJSONShapeLayer.js
index 422f6d3..1849fc9 100644
--- a/src/geoJSONShapeLayer.js
+++ b/src/geoJSONShapeLayer.js
@@ -17,34 +17,33 @@
  * Author: Hashem Nasarat <hashem riseup net>
  */
 
-const Lang = imports.lang;
+const GObject = imports.gi.GObject;
 
 const GeoJSONSource = imports.geoJSONSource;
 const ShapeLayer = imports.shapeLayer;
 
-var GeoJSONShapeLayer = new Lang.Class({
-    Name: 'GeoJSONShapeLayer',
-    Extends: ShapeLayer.ShapeLayer,
+var GeoJSONShapeLayer = GObject.registerClass({},
+class GeoJSONShapeLayer extends ShapeLayer.ShapeLayer {
 
-    _init: function(params) {
-        this.parent(params);
+    _init(params) {
+        super._init(params);
 
         this._mapSource = new GeoJSONSource.GeoJSONSource({
             mapView: this._mapView,
             markerLayer: this._markerLayer
         });
-    },
+    }
 
-    getName: function() {
+    getName() {
         /* Special Case since this file extension contains 2 periods */
         let suffix = '.geo.json';
         if (this.filename.endsWith(suffix))
             return this.filename.replace(new RegExp(suffix + '$'), '');
         else
-            return this.parent();
-    },
+            return super.getName();
+    }
 
-    _parseContent: function() {
+    _parseContent() {
         this._mapSource.parse(JSON.parse(this._fileContents));
     }
 });
@@ -53,3 +52,6 @@ GeoJSONShapeLayer.mimeTypes = ['application/vnd.geo+json',
                                'application/geo+json',
                                'application/json'];
 GeoJSONShapeLayer.displayName = 'GeoJSON';
+GeoJSONShapeLayer.createInstance = function(params) {
+    return new GeoJSONShapeLayer(params);
+};
diff --git a/src/geoJSONSource.js b/src/geoJSONSource.js
index 0eef485..4624796 100644
--- a/src/geoJSONSource.js
+++ b/src/geoJSONSource.js
@@ -21,7 +21,7 @@
 const Cairo = imports.cairo;
 const Champlain = imports.gi.Champlain;
 const Clutter = imports.gi.Clutter;
-const Lang = imports.lang;
+const GObject = imports.gi.GObject;
 const Mainloop = imports.mainloop;
 
 const Geojsonvt = imports.geojsonvt.geojsonvt;
@@ -39,42 +39,42 @@ const TileFeature = { POINT: 1,
                       LINESTRING: 2,
                       POLYGON: 3 };
 
-var GeoJSONSource = new Lang.Class({
-    Name: 'GeoJSONSource',
-    Extends: Champlain.TileSource,
+var GeoJSONSource = GObject.registerClass({},
+class GeoJSONSource extends Champlain.TileSource {
 
-    _init: function(params) {
-        this.parent();
+    _init(params) {
+        super._init();
 
         this._mapView = params.mapView;
         this._markerLayer = params.markerLayer;
         this._bbox = new Champlain.BoundingBox();
-    },
+    }
 
     get bbox() {
         return this._bbox;
-    },
-    vfunc_get_tile_size: function() {
+    }
+
+    vfunc_get_tile_size() {
         return TILE_SIZE;
-    },
+    }
 
-    vfunc_get_max_zoom_level: function() {
+    vfunc_get_max_zoom_level() {
         return 20;
-    },
+    }
 
-    vfunc_get_min_zoom_level: function() {
+    vfunc_get_min_zoom_level() {
         return 0;
-    },
+    }
 
-    vfunc_get_id: function() {
+    vfunc_get_id() {
         return 'GeoJSONSource';
-    },
+    }
 
-    vfunc_get_name: function() {
+    vfunc_get_name() {
         return 'GeoJSONSource';
-    },
+    }
 
-    vfunc_fill_tile: function(tile) {
+    vfunc_fill_tile(tile) {
         if (tile.get_state() === Champlain.State.DONE)
             return;
 
@@ -87,40 +87,40 @@ var GeoJSONSource = new Lang.Class({
         });
 
         Mainloop.idle_add(() => { this._renderTile(tile); });
-    },
+    }
 
-    _validate: function([lon, lat]) {
+    _validate([lon, lat]) {
         if ((-180 <= lon && lon <= 180) &&
             (-90  <= lat && lat <= 90)) {
             return;
         }
 
         throw new Error(_("invalid coordinate"));
-    },
+    }
 
-    _compose: function(coordinates) {
+    _compose(coordinates) {
         coordinates.forEach((coordinate) => {
             this._validate(coordinate);
             this._bbox.extend(coordinate[1], coordinate[0]);
         });
-    },
+    }
 
-    _clampBBox: function() {
+    _clampBBox() {
         this._bbox.top = Math.min(this._bbox.top, MapView.MAX_LATITUDE);
         this._bbox.left = Math.max(this._bbox.left, MapView.MIN_LONGITUDE);
         this._bbox.bottom = Math.max(this._bbox.bottom, MapView.MIN_LATITUDE);
         this._bbox.right = Math.min(this._bbox.right, MapView.MAX_LONGITUDE);
-    },
+    }
 
-    _parseLineString: function(coordinates) {
+    _parseLineString(coordinates) {
         this._compose(coordinates);
-    },
+    }
 
-    _parsePolygon: function(coordinates) {
+    _parsePolygon(coordinates) {
         coordinates.forEach((coordinate) => { this._compose(coordinate); });
-    },
+    }
 
-    _parsePoint: function(coordinates, properties) {
+    _parsePoint(coordinates, properties) {
         let name = null;
         if (properties)
             name = properties.name;
@@ -140,9 +140,9 @@ var GeoJSONSource = new Lang.Class({
         let placeMarker = new PlaceMarker.PlaceMarker({ place: place,
                                                         mapView: this._mapView });
         this._markerLayer.add_marker(placeMarker);
-    },
+    }
 
-    _parseGeometry: function(geometry, properties) {
+    _parseGeometry(geometry, properties) {
         if(!geometry)
             throw new Error(_("parse error"));
 
@@ -180,9 +180,9 @@ var GeoJSONSource = new Lang.Class({
         default:
             throw new Error(_("unknown geometry"));
         }
-    },
+    }
 
-    _parseInternal: function(root) {
+    _parseInternal(root) {
         if (!root || !root.type)
             throw new Error(_("parse error"));
 
@@ -207,16 +207,16 @@ var GeoJSONSource = new Lang.Class({
         default:
             this._parseGeometry(root);
         }
-    },
+    }
 
-    parse: function(json) {
+    parse(json) {
         this._parseInternal(json);
         this._tileIndex = Geojsonvt.geojsonvt(json, { extent: TILE_SIZE,
                                                       maxZoom: 20 });
         this._clampBBox();
-    },
+    }
 
-    _renderTile: function(tile) {
+    _renderTile(tile) {
         let tileJSON = this._tileIndex.getTile(tile.zoom_level, tile.x, tile.y);
         let content = new Clutter.Canvas({ width: TILE_SIZE,
                                            height: TILE_SIZE });
diff --git a/src/geoJSONStyle.js b/src/geoJSONStyle.js
index fce56bb..b4ea97b 100644
--- a/src/geoJSONStyle.js
+++ b/src/geoJSONStyle.js
@@ -18,12 +18,9 @@
  * Author: Alaf Azam <alafazam gmail com>
  */
 
-const Lang = imports.lang;
+var GeoJSONStyle = class GeoJSONStyle {
 
-var GeoJSONStyle = new Lang.Class({
-    Name: 'GeoJSONStyle',
-
-    _init: function(params) {
+    constructor(params) {
 
         if (params.lineWidth || params.lineWidth === 0)
             this.lineWidth = params.lineWidth;
@@ -46,9 +43,9 @@ var GeoJSONStyle = new Lang.Class({
         this.fillColor =  this._hexToColor(params.fillColor) || { red: 0.37,
                                                                   green: 0.62,
                                                                   blue: 0.87 };
-    },
+    }
 
-    _hexToColor: function(colorString) {
+    _hexToColor(colorString) {
         let color = null;
         
         if (!colorString)
@@ -80,7 +77,7 @@ var GeoJSONStyle = new Lang.Class({
 
         return color;
     }
-});
+};
 
 GeoJSONStyle.parseSimpleStyle = function(tags) {
     return  new GeoJSONStyle({ alpha: tags['stroke-opacity'],
diff --git a/src/geoclue.js b/src/geoclue.js
index 66f847b..19d2224 100644
--- a/src/geoclue.js
+++ b/src/geoclue.js
@@ -22,7 +22,6 @@
 const GObject = imports.gi.GObject;
 const GClue = imports.gi.Geoclue;
 const Gio = imports.gi.Gio;
-const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 
 const Place = imports.place;
@@ -37,9 +36,7 @@ var State = {
     FAILED: 3
 };
 
-var Geoclue = new Lang.Class({
-    Name: 'Geoclue',
-    Extends: GObject.Object,
+var Geoclue = GObject.registerClass({
     Signals: {
         'location-changed': { }
     },
@@ -53,25 +50,26 @@ var Geoclue = new Lang.Class({
                                        State.FAILED,
                                        State.INITIAL)
     },
+}, class Geoclue extends GObject.Object {
 
     set state(s) {
         this._state = s;
         this.notify('state');
-    },
+    }
 
     get state() {
         return this._state;
-    },
+    }
 
-    _init: function() {
-        this.parent();
+    _init() {
+        super._init();
         this.place = null;
         this._state = State.INITIAL;
 
         this.start(null);
-    },
+    }
 
-    start: function(callback) {
+    start(callback) {
         let id = 'org.gnome.Maps';
         let level = GClue.AccuracyLevel.EXACT;
 
@@ -101,9 +99,9 @@ var Geoclue = new Lang.Class({
             if (callback)
                 callback(true);
         });
-    },
+    }
 
-    _onLocationNotify: function(simple) {
+    _onLocationNotify(simple) {
         let geoclueLocation = simple.get_location();
         let location = new Location.Location({
             latitude: geoclueLocation.latitude,
@@ -113,9 +111,9 @@ var Geoclue = new Lang.Class({
             description: geoclueLocation.description
         });
         this._updateLocation(location);
-    },
+    }
 
-    _updateLocation: function(location) {
+    _updateLocation(location) {
         if (!this.place)
             this.place = new Place.Place({ name: _("Current location") });
 
diff --git a/src/geocodeService.js b/src/geocodeService.js
index 8c90cfb..441925a 100644
--- a/src/geocodeService.js
+++ b/src/geocodeService.js
@@ -22,18 +22,13 @@
  */
 
 const Geocode = imports.gi.GeocodeGlib;
-const Lang = imports.lang;
 
 const Application = imports.application;
 const Place = imports.place;
 const Utils = imports.utils;
 
-var GeocodeService = new Lang.Class({
-    Name: 'GeocodeService',
-
-    _init: function() { },
-
-    search: function(string, bbox, cancellable, callback) {
+var GeocodeService = class GeocodeService {
+    search(string, bbox, cancellable, callback) {
         let answerCount = Application.settings.get('max-search-results');
         let forward     = Geocode.Forward.new_for_string(string);
 
@@ -60,9 +55,9 @@ var GeocodeService = new Lang.Class({
                 callback(null);
             }
         });
-    },
+    }
 
-    reverse: function(location, cancellable, callback) {
+    reverse(location, cancellable, callback) {
         let reverse = Geocode.Reverse.new_for_location(location);
 
         Application.application.mark_busy();
@@ -80,4 +75,4 @@ var GeocodeService = new Lang.Class({
             }
         });
     }
-});
+};
diff --git a/src/gpxShapeLayer.js b/src/gpxShapeLayer.js
index f3b6e87..c6491fc 100644
--- a/src/gpxShapeLayer.js
+++ b/src/gpxShapeLayer.js
@@ -17,27 +17,26 @@
  * Author: Hashem Nasarat <hashem riseup net>
  */
 
-const Lang = imports.lang;
+const GObject = imports.gi.GObject;
 
 const GeoJSONSource = imports.geoJSONSource;
 const ShapeLayer = imports.shapeLayer;
 const Togeojson = imports.togeojson.togeojson;
 const Domparser = imports.xmldom.domparser;
 
-var GpxShapeLayer = new Lang.Class({
-    Name: 'GpxShapeLayer',
-    Extends: ShapeLayer.ShapeLayer,
+var GpxShapeLayer = GObject.registerClass({},
+class GpxShapeLayer extends ShapeLayer.ShapeLayer {
 
-    _init: function(params) {
-        this.parent(params);
+    constructor(params) {
+        super.construct(params);
 
         this._mapSource = new GeoJSONSource.GeoJSONSource({
             mapView: this._mapView,
             markerLayer: this._markerLayer
         });
-    },
+    }
 
-    _parseContent: function() {
+    _parseContent() {
         let s = this._fileContents.toString();
         let parser = new Domparser.DOMParser();
         let json = Togeojson.toGeoJSON.gpx(parser.parseFromString(s));
@@ -47,3 +46,6 @@ var GpxShapeLayer = new Lang.Class({
 
 GpxShapeLayer.mimeTypes = ['application/gpx+xml' ];
 GpxShapeLayer.displayName = 'GPX';
+GpxShapeLayer.createInstance = function(params) {
+    return new GpxShapeLayer(params);
+};
diff --git a/src/graphHopper.js b/src/graphHopper.js
index bd1281d..fec2150 100644
--- a/src/graphHopper.js
+++ b/src/graphHopper.js
@@ -21,7 +21,6 @@
 
 const Champlain = imports.gi.Champlain;
 const GLib = imports.gi.GLib;
-const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 const Soup = imports.gi.Soup;
 
@@ -32,14 +31,13 @@ const Route = imports.route;
 const RouteQuery = imports.routeQuery;
 const Utils = imports.utils;
 
-var GraphHopper = new Lang.Class({
-    Name: 'GraphHopper',
+var GraphHopper = class GraphHopper {
 
     get route() {
         return this._route;
-    },
+    }
 
-    _init: function(params) {
+    constructor(params) {
         this._session = new Soup.Session({ user_agent : 'gnome-maps/' + pkg.version });
         this._key     = "VCIHrHj0pDKb8INLpT4s5hVadNmJ1Q3vi0J4nJYP";
         this._baseURL = "https://graphhopper.com/api/1/route?";;
@@ -47,11 +45,9 @@ var GraphHopper = new Lang.Class({
         this._route   = new Route.Route();
         this.storedRoute = null;
         this._query = params.query;
-        delete params.query;
-        this.parent(params);
-    },
+    }
 
-    _updateFromStored: function() {
+    _updateFromStored() {
         Mainloop.idle_add(() => {
             if (!this.storedRoute)
                 return;
@@ -63,9 +59,9 @@ var GraphHopper = new Lang.Class({
                                 bbox: this.storedRoute.bbox });
             this.storedRoute = null;
         });
-    },
+    }
 
-    _queryGraphHopper: function(points, transportationType, callback) {
+    _queryGraphHopper(points, transportationType, callback) {
         let url = this._buildURL(points, transportationType);
         let msg = Soup.Message.new('GET', url);
         this._session.queue_message(msg, (session, message) => {
@@ -79,9 +75,9 @@ var GraphHopper = new Lang.Class({
                 callback(null, e);
             }
         });
-    },
+    }
 
-    fetchRoute: function(points, transportationType) {
+    fetchRoute(points, transportationType) {
         if (this.storedRoute) {
             this._updateFromStored();
             return;
@@ -109,9 +105,9 @@ var GraphHopper = new Lang.Class({
                 }
             }
         });
-    },
+    }
 
-    fetchRouteAsync: function(points, transportationType, callback) {
+    fetchRouteAsync(points, transportationType, callback) {
         this._queryGraphHopper(points, transportationType,
                                (result, exception) => {
             if (result) {
@@ -121,9 +117,9 @@ var GraphHopper = new Lang.Class({
                 callback(null, exception);
             }
         });
-    },
+    }
 
-    _buildURL: function(points, transportation) {
+    _buildURL(points, transportation) {
         let locations = points.map(function(point) {
             return [point.place.location.latitude, point.place.location.longitude].join(',');
         });
@@ -138,9 +134,9 @@ var GraphHopper = new Lang.Class({
         let url = this._baseURL + query.toString();
         Utils.debug("Sending route request to: " + url);
         return url;
-    },
+    }
 
-    _parseMessage: function({ status_code, response_body, uri }) {
+    _parseMessage({ status_code, response_body, uri }) {
         if (status_code === 500) {
             log("Internal server error.\n"
                 + "This is most likely a bug in GraphHopper");
@@ -166,9 +162,9 @@ var GraphHopper = new Lang.Class({
         }
 
         return result;
-    },
+    }
 
-    _createRoute: function(route) {
+    _createRoute(route) {
         let path       = EPAF.decode(route.points);
         let turnPoints = this._createTurnPoints(path, route.instructions);
         let bbox       = new Champlain.BoundingBox();
@@ -182,9 +178,9 @@ var GraphHopper = new Lang.Class({
                  distance:   route.distance,
                  time:       route.time,
                  bbox:       bbox };
-    },
+    }
 
-    _createTurnPoints: function(path, instructions) {
+    _createTurnPoints(path, instructions) {
         let via = 0;
         let startPoint = new Route.TurnPoint({
             coordinate:  path[0],
@@ -212,9 +208,9 @@ var GraphHopper = new Lang.Class({
             });
         });
         return [startPoint].concat(rest);
-    },
+    }
 
-    _createTurnPointType: function(sign) {
+    _createTurnPointType(sign) {
         let type = sign + 3;
         let min  = Route.TurnPointType.SHARP_LEFT;
         let max  = Route.TurnPointType.ROUNDABOUT;
@@ -223,4 +219,4 @@ var GraphHopper = new Lang.Class({
         else
             return undefined;
     }
-});
+};
diff --git a/src/http.js b/src/http.js
index 482e3aa..1089ff0 100644
--- a/src/http.js
+++ b/src/http.js
@@ -19,7 +19,6 @@
  * Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
  */
 
-const Lang = imports.lang;
 const Soup = imports.gi.Soup;
 
 function encode(data) {
@@ -29,18 +28,17 @@ function encode(data) {
     return Soup.URI.encode(data.toString(), null);
 }
 
-var Query = new Lang.Class({
-    Name: 'Query',
+var Query = class Query {
 
-    _init: function(obj) {
+    constructor(obj) {
         this._query = {};
         for(let key in obj) {
             this.add(key, obj[key]);
         }
-    },
+    }
 
     // a value === null represents an empty value
-    add: function(key, value) {
+    add(key, value) {
         // Initialize query field if it isn't already
         let queryValue = this._query[key];
         if(!Array.isArray(queryValue))
@@ -50,9 +48,9 @@ var Query = new Lang.Class({
             this._query[key] = this._query[key].concat(value);
         else
             this._query[key].push(value);
-    },
+    }
 
-    toString: function() {
+    toString() {
         let vars = [];
         for(let key in this._query) {
             let values = this._query[key];
@@ -67,4 +65,4 @@ var Query = new Lang.Class({
         }
         return vars.join('&');
     }
-});
+};
diff --git a/src/instructionRow.js b/src/instructionRow.js
index 644e13f..f8f4cdc 100644
--- a/src/instructionRow.js
+++ b/src/instructionRow.js
@@ -20,19 +20,18 @@
  *         Mattias Bengtsson <mattias jc bengtsson gmail com>
  */
 
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
 const Utils = imports.utils;
 
-var InstructionRow = new Lang.Class({
-    Name: "InstructionRow",
-    Extends: Gtk.ListBoxRow,
+var InstructionRow = GObject.registerClass({
     Template: 'resource:///org/gnome/Maps/ui/instruction-row.ui',
     InternalChildren: [ 'directionImage',
                         'instructionLabel',
-                        'distanceLabel' ],
+                        'distanceLabel' ]
+}, class InstructionRow extends Gtk.ListBoxRow {
 
-    _init: function(params) {
+    _init(params) {
         this.turnPoint = params.turnPoint;
         delete params.turnPoint;
 
@@ -42,7 +41,7 @@ var InstructionRow = new Lang.Class({
         let lines = params.lines;
         delete params.lines;
 
-        this.parent(params);
+        super._init(params);
 
         if (lines)
             this._instructionLabel.lines = lines;
diff --git a/src/kmlShapeLayer.js b/src/kmlShapeLayer.js
index 3de9985..a721358 100644
--- a/src/kmlShapeLayer.js
+++ b/src/kmlShapeLayer.js
@@ -17,27 +17,25 @@
  * Author: Hashem Nasarat <hashem riseup net>
  */
 
-const Lang = imports.lang;
+const GObject = imports.gi.GObject;
 
 const GeoJSONSource = imports.geoJSONSource;
 const ShapeLayer = imports.shapeLayer;
 const Togeojson = imports.togeojson.togeojson;
 const Domparser = imports.xmldom.domparser;
 
-var KmlShapeLayer = new Lang.Class({
-    Name: 'KmlShapeLayer',
-    Extends: ShapeLayer.ShapeLayer,
-
-    _init: function(params) {
-        this.parent(params);
+var KmlShapeLayer = GObject.registerClass({},
+class KmlShapeLayer extends ShapeLayer.ShapeLayer {
+    _init(params) {
+        super._init(params);
 
         this._mapSource = new GeoJSONSource.GeoJSONSource({
             mapView: this._mapView,
             markerLayer: this._markerLayer
         });
-    },
+    }
 
-    _parseContent: function() {
+    _parseContent() {
         let s = this._fileContents.toString();
         let parser = new Domparser.DOMParser();
         let json = Togeojson.toGeoJSON.kml(parser.parseFromString(s));
@@ -47,3 +45,6 @@ var KmlShapeLayer = new Lang.Class({
 
 KmlShapeLayer.mimeTypes = ['application/vnd.google-earth.kml+xml'];
 KmlShapeLayer.displayName = 'KML';
+KmlShapeLayer.createInstance = function(params) {
+    return new KmlShapeLayer(params);
+};
diff --git a/src/layersPopover.js b/src/layersPopover.js
index 8d32a5b..3c9abdb 100644
--- a/src/layersPopover.js
+++ b/src/layersPopover.js
@@ -17,25 +17,24 @@
  * Author: Dario Di Nucci <linkin88mail gmail com>
  */
 
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
 
 const MapView = imports.mapView;
 const ShapeLayer = imports.shapeLayer;
 const Utils = imports.utils;
 
-var ShapeLayerRow = new Lang.Class({
-    Name: 'ShapeLayerRow',
-    Extends: Gtk.ListBoxRow,
+var ShapeLayerRow = GObject.registerClass({
     Template: 'resource:///org/gnome/Maps/ui/shape-layer-row.ui',
     Children: ['closeButton'],
-    InternalChildren: ['layerLabel', 'visibleButton'],
+    InternalChildren: ['layerLabel', 'visibleButton']
+}, class ShapeLayerRow extends Gtk.ListBoxRow {
 
-    _init: function(params) {
+    _init(params) {
         this.shapeLayer = params.shapeLayer;
         delete params.shapeLayer;
 
-        this.parent(params);
+        super._init(params);
 
         this._layerLabel.label = this.shapeLayer.getName();
         this._layerLabel.tooltip_text = this.shapeLayer.file.get_parse_name();
@@ -52,20 +51,19 @@ var ShapeLayerRow = new Lang.Class({
     }
 });
 
-var LayersPopover = new Lang.Class({
-    Name: 'LayersPopover',
-    Extends: Gtk.Popover,
+var LayersPopover = GObject.registerClass({
     Template: 'resource:///org/gnome/Maps/ui/layers-popover.ui',
     InternalChildren: [ 'streetLayerButton',
                         'aerialLayerButton',
                         'layersListBox',
-                        'loadLayerButton' ],
+                        'loadLayerButton' ]
+}, class LayersPopover extends Gtk.Popover {
 
-    _init: function(params) {
+    _init(params) {
         this._mapView = params.mapView;
         delete params.mapView;
 
-        this.parent({ width_request: 200,
+        super._init({ width_request: 200,
                       no_show_all: true,
                       transitions_enabled: false,
                       visible: false });
@@ -92,22 +90,22 @@ var LayersPopover = new Lang.Class({
         this._aerialLayerButton.connect('clicked', () => {
             this._mapView.setMapType(MapView.MapType.AERIAL);
         });
-    },
+    }
 
-    setMapType: function(mapType) {
+    setMapType(mapType) {
         if (mapType === MapView.MapType.STREET)
             this._streetLayerButton.active = true;
         else if (mapType === MapView.MapType.AERIAL)
             this._aerialLayerButton.active = true;
-    },
+    }
 
-    _onRemoveClicked: function(row) {
+    _onRemoveClicked(row) {
         this._mapView.removeShapeLayer(row.shapeLayer);
         if (this._layersListBox.get_children().length <= 0)
             this._layersListBox.hide();
-    },
+    }
 
-    _listBoxCreateWidget: function(shapeLayer) {
+    _listBoxCreateWidget(shapeLayer) {
         let row = new ShapeLayerRow({ shapeLayer: shapeLayer });
         row.closeButton.connect('clicked',
                                 () => { this._onRemoveClicked(row); });
diff --git a/src/location.js b/src/location.js
index d4ec63a..f416826 100644
--- a/src/location.js
+++ b/src/location.js
@@ -22,25 +22,24 @@
  */
 
 const Geocode = imports.gi.GeocodeGlib;
-const Lang = imports.lang;
+const GObject = imports.gi.GObject;
 
 /* Adds heading to Geocode.Location */
-var Location = new Lang.Class({
-    Name: 'Location',
-    Extends: Geocode.Location,
+var Location = GObject.registerClass({},
+class Location extends Geocode.Location {
 
-    _init: function(params) {
+    _init(params) {
         this._heading = params.heading;
         delete params.heading;
 
-        this.parent(params);
-    },
+        super._init(params);
+    }
 
     get heading() {
         return this._heading;
-    },
+    }
 
     set heading(v) {
         this._heading = v;
-    },
+    }
 });
diff --git a/src/locationServiceNotification.js b/src/locationServiceNotification.js
index 9cf6219..bbe17e6 100644
--- a/src/locationServiceNotification.js
+++ b/src/locationServiceNotification.js
@@ -21,7 +21,7 @@
 
 const Gdk = imports.gi.Gdk;
 const Gio = imports.gi.Gio;
-const Lang = imports.lang;
+const GObject = imports.gi.GObject;
 
 const Application = imports.application;
 const Geoclue = imports.geoclue;
@@ -30,12 +30,11 @@ const Utils = imports.utils;
 
 const _PRIVACY_PANEL = 'gnome-privacy-panel.desktop';
 
-var LocationServiceNotification = new Lang.Class({
-    Name: 'LocationServiceNotification',
-    Extends: Notification.Notification,
+var LocationServiceNotification = GObject.registerClass({},
+class LocationServiceNotification extends Notification.Notification {
 
-    _init: function() {
-        this.parent();
+    _init() {
+        super._init();
 
         let ui = Utils.getUIObject('location-service-notification',
                                    [ 'button', 'grid' ]);
diff --git a/src/longPrintLayout.js b/src/longPrintLayout.js
index 956a76e..8439761 100644
--- a/src/longPrintLayout.js
+++ b/src/longPrintLayout.js
@@ -17,7 +17,7 @@
  * Author: Amisha Singla <amishas157 gmail com>
  */
 
-const Lang = imports.lang;
+const GObject = imports.gi.GObject;
 
 const PrintLayout = imports.printLayout;
 const Route = imports.route;
@@ -37,11 +37,10 @@ const _MiniMapView = {
     ZOOM_LEVEL: 18
 };
 
-var LongPrintLayout = new Lang.Class({
-    Name: 'LongPrintLayout',
-    Extends: PrintLayout.PrintLayout,
+var LongPrintLayout = GObject.registerClass({},
+class LongPrintLayout extends PrintLayout.PrintLayout {
 
-    _init: function(params) {
+    _init(params) {
         this._route = params.route;
         delete params.route;
 
@@ -55,11 +54,11 @@ var LongPrintLayout = new Lang.Class({
         });
         params.totalSurfaces = totalSurfaces;
 
-        this.parent(params);
-    },
+        super._init(params);
+    }
 
-    render: function() {
-        this.parent();
+    render() {
+        super.render();
 
         let instructionWidth = _Instruction.SCALE_X * this._pageWidth;
         let instructionHeight = _Instruction.SCALE_Y * this._pageHeight;
diff --git a/src/mainWindow.js b/src/mainWindow.js
index b2bee4a..bf103cb 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -25,7 +25,6 @@ const GObject = imports.gi.GObject;
 const Gdk = imports.gi.Gdk;
 const Gio = imports.gi.Gio;
 const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 
 const Application = imports.application;
@@ -48,13 +47,12 @@ const _CONFIGURE_ID_TIMEOUT = 100; // msecs
 const _WINDOW_MIN_WIDTH = 600;
 const _WINDOW_MIN_HEIGHT = 500;
 
-var ShapeLayerFileChooser = new Lang.Class({
-    Name: 'ShapeLayerFileChooser',
-    Extends: Gtk.FileChooserNative,
-    Template: 'resource:///org/gnome/Maps/ui/shape-layer-file-chooser.ui',
+var ShapeLayerFileChooser = GObject.registerClass({
+    Template: 'resource:///org/gnome/Maps/ui/shape-layer-file-chooser.ui'
+}, class ShapeLayerFileChooser extends Gtk.FileChooserNative {
 
-    _init: function(params) {
-        this.parent(params);
+    _init(params) {
+        super._init(params);
         let allFilter = new Gtk.FileFilter();
         allFilter.set_name(_("All Layer Files"));
         this.add_filter(allFilter);
@@ -73,9 +71,7 @@ var ShapeLayerFileChooser = new Lang.Class({
     }
 });
 
-var MainWindow = new Lang.Class({
-    Name: 'MainWindow',
-    Extends: Gtk.ApplicationWindow,
+var MainWindow = GObject.registerClass({
     Template: 'resource:///org/gnome/Maps/ui/main-window.ui',
     InternalChildren: [ 'headerBar',
                         'grid',
@@ -87,17 +83,18 @@ var MainWindow = new Lang.Class({
                         'favoritesButton',
                         'printRouteButton',
                         'zoomInButton',
-                        'zoomOutButton' ],
+                        'zoomOutButton' ]
+}, class MainWindow extends Gtk.ApplicationWindow {
 
     get mapView() {
         return this._mapView;
-    },
+    }
 
-    _init: function(params) {
+    _init(params) {
         this._overlay = params.overlay;
         delete params.overlay;
 
-        this.parent(params);
+        super._init(params);
 
         this._configureId = 0;
 
@@ -135,9 +132,9 @@ var MainWindow = new Lang.Class({
         this._grid.attach(this._sidebar, 1, 0, 1, 1);
 
         this._grid.show_all();
-    },
+    }
 
-    _createPlaceEntry: function() {
+    _createPlaceEntry() {
         let placeEntry = new PlaceEntry.PlaceEntry({ mapView: this._mapView,
                                                      visible: true,
                                                      margin_start: 35,
@@ -156,9 +153,9 @@ var MainWindow = new Lang.Class({
         popover.connect('selected', () => { this._mapView.grab_focus(); });
         this._mapView.view.connect('button-press-event', () => { popover.hide(); });
         return placeEntry;
-    },
+    }
 
-    _createSidebar: function() {
+    _createSidebar() {
         let sidebar = new Sidebar.Sidebar(this._mapView);
 
         Application.routeQuery.connect('notify', () => { this._setRevealSidebar(true); });
@@ -169,9 +166,9 @@ var MainWindow = new Lang.Class({
                                        sidebar, 'visible',
                                        GObject.BindingFlags.DEFAULT);
         return sidebar;
-    },
+    }
 
-    _initDND: function() {
+    _initDND() {
         this.drag_dest_set(Gtk.DestDefaults.DROP, null, 0);
         this.drag_dest_add_uri_targets();
 
@@ -187,9 +184,9 @@ var MainWindow = new Lang.Class({
             else
                 Gtk.drag_finish(ctx, false, false, time);
         });
-    },
+    }
 
-    _initActions: function() {
+    _initActions() {
         Utils.addActions(this, {
             'close': {
                 onActivate: this.close.bind(this)
@@ -243,9 +240,9 @@ var MainWindow = new Lang.Class({
                 onActivate: this._onOpenShapeLayer.bind(this)
             }
         });
-    },
+    }
 
-    _initSignals: function() {
+    _initSignals() {
         this.connect('delete-event', this._quit.bind(this));
         this.connect('configure-event',
                      this._onConfigureEvent.bind(this));
@@ -305,9 +302,9 @@ var MainWindow = new Lang.Class({
                                    this._updateZoomButtonsSensitivity.bind(this));
         this._mapView.view.connect('notify::min-zoom-level',
                                    this._updateZoomButtonsSensitivity.bind(this));
-    },
+    }
 
-    _updateZoomButtonsSensitivity: function() {
+    _updateZoomButtonsSensitivity() {
         let zoomLevel = this._mapView.view.zoom_level;
         let maxZoomLevel = this._mapView.view.max_zoom_level;
         let minZoomLevel = this._mapView.view.min_zoom_level;
@@ -321,17 +318,17 @@ var MainWindow = new Lang.Class({
             this._zoomOutButton.set_sensitive(false);
         else
             this._zoomOutButton.set_sensitive(true);
-    },
+    }
 
-    _updateLocationSensitivity: function() {
+    _updateLocationSensitivity() {
         let sensitive = (Application.geoclue.state !== Geoclue.State.INITIAL &&
                          (this.application.connected ||
                           this.application.local_tile_path));
 
         this._gotoUserLocationButton.sensitive = sensitive;
-    },
+    }
 
-    _initHeaderbar: function() {
+    _initHeaderbar() {
         this._placeEntry = this._createPlaceEntry();
         this._headerBar.custom_title = this._placeEntry;
 
@@ -357,9 +354,9 @@ var MainWindow = new Lang.Class({
             this._placeEntry.sensitive = app.connected;
             this._printRouteButton.sensitive = app.connected;
         });
-    },
+    }
 
-    _saveWindowGeometry: function() {
+    _saveWindowGeometry() {
         let window = this.get_window();
         let state = window.get_state();
 
@@ -372,9 +369,9 @@ var MainWindow = new Lang.Class({
 
         let position = this.get_position();
         Application.settings.set('window-position', position);
-    },
+    }
 
-    _restoreWindowGeometry: function() {
+    _restoreWindowGeometry() {
         let size = Application.settings.get('window-size');
         if (size.length === 2) {
             let [width, height] = size;
@@ -390,9 +387,9 @@ var MainWindow = new Lang.Class({
 
         if (Application.settings.get('window-maximized'))
             this.maximize();
-    },
+    }
 
-    _onConfigureEvent: function(widget, event) {
+    _onConfigureEvent(widget, event) {
         if (this._configureId !== 0) {
             Mainloop.source_remove(this._configureId);
             this._configureId = 0;
@@ -403,9 +400,9 @@ var MainWindow = new Lang.Class({
             this._configureId = 0;
             return false;
         });
-    },
+    }
 
-    _onWindowStateEvent: function(widget, event) {
+    _onWindowStateEvent(widget, event) {
         let window = widget.get_window();
         let state = window.get_state();
 
@@ -414,9 +411,9 @@ var MainWindow = new Lang.Class({
 
         let maximized = (state & Gdk.WindowState.MAXIMIZED);
         Application.settings.set('window-maximized', maximized);
-    },
+    }
 
-    _quit: function() {
+    _quit() {
         // remove configure event handler if still there
         if (this._configureId !== 0) {
             Mainloop.source_remove(this._configureId);
@@ -427,18 +424,18 @@ var MainWindow = new Lang.Class({
         this._saveWindowGeometry();
 
         return false;
-    },
+    }
 
-    _getLocationServiceNotification: function() {
+    _getLocationServiceNotification() {
         if (!this._locationServiceNotification) {
             this._locationServiceNotification =
                 new LocationServiceNotification.LocationServiceNotification();
         }
 
         return this._locationServiceNotification;
-    },
+    }
 
-    _onGotoUserLocationActivate: function() {
+    _onGotoUserLocationActivate() {
         let message;
 
         if (Application.geoclue.state === Geoclue.State.ON) {
@@ -463,42 +460,42 @@ var MainWindow = new Lang.Class({
                 break;
             }
         });
-    },
+    }
 
-    _printRouteActivate: function() {
+    _printRouteActivate() {
         if (this._mapView.routeShowing) {
             let operation = new PrintOperation.PrintOperation({ mainWindow: this });
         }
-    },
+    }
 
-    _onMapTypeMenuActivate: function(action) {
+    _onMapTypeMenuActivate(action) {
         let state = action.get_state().get_boolean();
         action.set_state(GLib.Variant.new('b', !state));
-    },
+    }
 
-    _onStreetViewActivate: function() {
+    _onStreetViewActivate() {
         this._mapView.setMapType(MapView.MapType.STREET);
         this.layersPopover.setMapType(MapView.MapType.STREET);
-    },
+    }
 
-    _onAerialViewActivate: function() {
+    _onAerialViewActivate() {
         this._mapView.setMapType(MapView.MapType.AERIAL);
         this.layersPopover.setMapType(MapView.MapType.AERIAL);
-    },
+    }
 
-    _onToggleSidebarChangeState: function(action, variant) {
+    _onToggleSidebarChangeState(action, variant) {
         action.set_state(variant);
 
         let reveal = variant.get_boolean();
         this._sidebar.set_reveal_child(reveal);
-    },
+    }
 
-    _setRevealSidebar: function(value) {
+    _setRevealSidebar(value) {
         let action = this.lookup_action('toggle-sidebar');
         action.change_state(GLib.Variant.new_boolean(value));
-    },
+    }
 
-    _onAboutActivate: function() {
+    _onAboutActivate() {
         let aboutDialog = new Gtk.AboutDialog({
             artists: [ 'Jakub Steiner <jimmac gmail com>',
                        'Andreas Nilsson <nisses mail home se>' ],
@@ -535,9 +532,9 @@ var MainWindow = new Lang.Class({
 
         aboutDialog.show();
         aboutDialog.connect('response', () => { aboutDialog.destroy(); });
-    },
+    }
 
-    _getAttribution: function() {
+    _getAttribution() {
         let tileProviderInfo = Service.getService().tileProviderInfo;
         let attribution = _("Map data by %s and contributors").format('<a 
href="https://www.openstreetmap.org";>OpenStreetMap</a>');
 
@@ -559,9 +556,9 @@ var MainWindow = new Lang.Class({
         }
 
         return attribution;
-    },
+    }
 
-    _onOpenShapeLayer: function() {
+    _onOpenShapeLayer() {
         let fileChooser = new ShapeLayerFileChooser({
             transient_for: this,
         });
@@ -574,9 +571,9 @@ var MainWindow = new Lang.Class({
             fileChooser.destroy();
         });
         fileChooser.show();
-    },
+    }
 
-    markBusy: function() {
+    markBusy() {
         if (this._busySignalId !== 0)
             return;
 
@@ -584,9 +581,9 @@ var MainWindow = new Lang.Class({
 
         let stage = this._mapView.view.get_stage();
         this._busySignalId = stage.connect('captured-event', () => { return true; });
-    },
+    }
 
-    unmarkBusy: function() {
+    unmarkBusy() {
         this._busy.hide();
 
         let stage = this._mapView.view.get_stage();
diff --git a/src/mapBubble.js b/src/mapBubble.js
index 130d721..2ca2aa9 100644
--- a/src/mapBubble.js
+++ b/src/mapBubble.js
@@ -23,7 +23,6 @@ const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 
 const Application = imports.application;
@@ -40,12 +39,10 @@ var Button = {
     CHECK_IN: 16
 };
 
-var MapBubble = new Lang.Class({
-    Name: "MapBubble",
-    Extends: Gtk.Popover,
-    Abstract: true,
+var MapBubble = GObject.registerClass({ Abstract: true },
+class MapBubble extends Gtk.Popover {
 
-    _init: function(params) {
+    _init(params) {
         this._place = params.place;
         delete params.place;
 
@@ -67,7 +64,7 @@ var MapBubble = new Lang.Class({
 
         params.modal = false;
 
-        this.parent(params);
+        super._init(params);
         let ui = Utils.getUIObject('map-bubble', [ 'bubble-main-grid',
                                                    'bubble-image',
                                                    'bubble-thumbnail',
@@ -98,29 +95,29 @@ var MapBubble = new Lang.Class({
         }
 
         this.add(ui.bubbleMainGrid);
-    },
+    }
 
     get image() {
         return this._image;
-    },
+    }
 
     get thumbnail() {
         return this._thumbnail;
-    },
+    }
 
     get iconStack() {
         return this._iconStack;
-    },
+    }
 
     get place() {
         return this._place;
-    },
+    }
 
     get content() {
         return this._content;
-    },
+    }
 
-    _initFavoriteButton: function(button, image) {
+    _initFavoriteButton(button, image) {
         let placeStore = Application.placeStore;
         button.visible = true;
 
@@ -143,9 +140,9 @@ var MapBubble = new Lang.Class({
                                     PlaceStore.PlaceType.FAVORITE);
             }
         });
-    },
+    }
 
-    _initSendToButton: function(button) {
+    _initSendToButton(button) {
         let dialog = new SendToDialog.SendToDialog({ transient_for: this.get_toplevel(),
                                                      modal: true,
                                                      mapView: this._mapView,
@@ -160,9 +157,9 @@ var MapBubble = new Lang.Class({
             });
             dialog.show_all();
         });
-    },
+    }
 
-    _initRouteButton: function(button, routeFrom) {
+    _initRouteButton(button, routeFrom) {
         let query = Application.routeQuery;
         let from = query.points[0];
         let to = query.points[query.points.length - 1];
@@ -183,9 +180,9 @@ var MapBubble = new Lang.Class({
             this.destroy();
             query.thaw_notify();
         });
-    },
+    }
 
-    _initCheckInButton: function(button, matchPlace) {
+    _initCheckInButton(button, matchPlace) {
         Application.checkInManager.bind_property('hasCheckIn',
                                                  button, 'visible',
                                                  GObject.BindingFlags.DEFAULT |
diff --git a/src/mapMarker.js b/src/mapMarker.js
index 28a40bf..67685db 100644
--- a/src/mapMarker.js
+++ b/src/mapMarker.js
@@ -25,15 +25,12 @@ const Clutter = imports.gi.Clutter;
 const Gdk = imports.gi.Gdk;
 const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 
 const MapWalker = imports.mapWalker;
 const Utils = imports.utils;
 
-var MapMarker = new Lang.Class({
-    Name: 'MapMarker',
-    Extends: Champlain.Marker,
+var MapMarker = GObject.registerClass({
     Implements: [Champlain.Exportable],
     Abstract: true,
     Signals: {
@@ -42,9 +39,10 @@ var MapMarker = new Lang.Class({
     Properties: {
         'surface': GObject.ParamSpec.override('surface',
                                               Champlain.Exportable)
-    },
+    }
+}, class MapMarker extends Champlain.Marker {
 
-    _init: function(params) {
+    _init(params) {
         this._place = params.place;
         delete params.place;
 
@@ -55,7 +53,7 @@ var MapMarker = new Lang.Class({
         params.longitude = this.place.location.longitude;
         params.selectable = true;
 
-        this.parent(params);
+        super._init(params);
 
         this.connect('notify::size', this._translateMarkerPosition.bind(this));
         if (this._mapView) {
@@ -76,25 +74,25 @@ var MapMarker = new Lang.Class({
             this._view.connect('notify::longitude', this._onViewUpdated.bind(this));
             this._view.connect('notify::zoom-level', this._onViewUpdated.bind(this));
         }
-    },
+    }
 
     get surface() {
         return this._surface;
-    },
+    }
 
     set surface(v) {
         this._surface = v;
-    },
+    }
 
-    vfunc_get_surface: function() {
+    vfunc_get_surface() {
         return this._surface;
-    },
+    }
 
-    vfunc_set_surface: function(surface) {
+    vfunc_set_surface(surface) {
         this._surface = surface;
-    },
+    }
 
-    _actorFromIconName: function(name, size, color) {
+    _actorFromIconName(name, size, color) {
         try {
             let theme = Gtk.IconTheme.get_default();
             let pixbuf;
@@ -130,9 +128,9 @@ var MapMarker = new Lang.Class({
             Utils.debug('Failed to load image: %s'.format(e.message));
             return null;
         }
-    },
+    }
 
-    _onButtonPress: function(marker, event) {
+    _onButtonPress(marker, event) {
         // Zoom in on marker on double-click
         if (event.get_click_count() > 1) {
             if (this._view.zoom_level < this._view.max_zoom_level) {
@@ -140,11 +138,11 @@ var MapMarker = new Lang.Class({
                 this._view.center_on(this.latitude, this.longitude);
             }
         }
-    },
+    }
 
-    _translateMarkerPosition: function() {
+    _translateMarkerPosition() {
         this.set_translation(-this.anchor.x, -this.anchor.y, 0);
-    },
+    }
 
     /**
      * Returns: The anchor point for the marker icon, relative to the
@@ -152,29 +150,29 @@ var MapMarker = new Lang.Class({
      */
     get anchor() {
         return { x: 0, y: 0 };
-    },
+    }
 
     get bubbleSpacing() {
         return 0;
-    },
+    }
 
     get place() {
         return this._place;
-    },
+    }
 
     get bubble() {
         if (this._bubble === undefined)
             this._bubble = this._createBubble();
 
         return this._bubble;
-    },
+    }
 
-    _createBubble: function() {
+    _createBubble() {
         // Markers has no associated bubble by default
         return null;
-    },
+    }
 
-    _positionBubble: function(bubble) {
+    _positionBubble(bubble) {
         let [tx, ty, tz] = this.get_translation();
         let x = this._view.longitude_to_x(this.longitude);
         let y = this._view.latitude_to_y(this.latitude);
@@ -200,9 +198,9 @@ var MapMarker = new Lang.Class({
         // Avoid bubble to cover header bar if the marker is close to the top map edge
         else if (pos.y - bubbleSize.height <= 0)
             bubble.position = Gtk.PositionType.BOTTOM;
-    },
+    }
 
-    _hideBubbleOn: function(signal, duration) {
+    _hideBubbleOn(signal, duration) {
         let sourceId = null;
         let signalId = this._view.connect(signal, () => {
             if (sourceId)
@@ -236,9 +234,9 @@ var MapMarker = new Lang.Class({
                 this._view.disconnect(signalId);
             }
         });
-    },
+    }
 
-    _initBubbleSignals: function() {
+    _initBubbleSignals() {
         this._hideBubbleOn('notify::zoom-level', 500);
         this._hideBubbleOn('notify::size');
 
@@ -278,9 +276,9 @@ var MapMarker = new Lang.Class({
             this._bubble.destroy();
             delete this._bubble;
         });
-    },
+    }
 
-    _isInsideView: function() {
+    _isInsideView() {
         let [tx, ty, tz] = this.get_translation();
         let x = this._view.longitude_to_x(this.longitude);
         let y = this._view.latitude_to_y(this.latitude);
@@ -288,53 +286,53 @@ var MapMarker = new Lang.Class({
 
         return x + tx + this.width > 0 && x + tx < mapSize.width &&
                y + ty + this.height > 0 && y + ty < mapSize.height;
-    },
+    }
 
-    _onViewUpdated: function() {
+    _onViewUpdated() {
         if (this.bubble) {
             if (this._isInsideView())
                 this._positionBubble(this.bubble);
             else
                 this.bubble.hide();
         }
-    },
+    }
 
-    showBubble: function() {
+    showBubble() {
         if (this.bubble && !this.bubble.visible && this._isInsideView()) {
             this._initBubbleSignals();
             this.bubble.show();
             this._positionBubble(this.bubble);
         }
-    },
+    }
 
-    hideBubble: function() {
+    hideBubble() {
         if (this._bubble)
             this._bubble.hide();
-    },
+    }
 
     get walker() {
         if (this._walker === undefined)
             this._walker = new MapWalker.MapWalker(this.place, this._mapView);
 
         return this._walker;
-    },
+    }
 
-    zoomToFit: function() {
+    zoomToFit() {
         this.walker.zoomToFit();
-    },
+    }
 
-    goTo: function(animate) {
+    goTo(animate) {
         Utils.once(this.walker, 'gone-to', () => { this.emit('gone-to'); });
         this.walker.goTo(animate);
-    },
+    }
 
-    goToAndSelect: function(animate) {
+    goToAndSelect(animate) {
         Utils.once(this, 'gone-to', () => { this.selected = true; });
 
         this.goTo(animate);
-    },
+    }
 
-    _onMarkerSelected: function() {
+    _onMarkerSelected() {
         if (this.selected)
             this.showBubble();
         else
diff --git a/src/mapSource.js b/src/mapSource.js
index 430c99f..5d79e7e 100644
--- a/src/mapSource.js
+++ b/src/mapSource.js
@@ -22,9 +22,9 @@ const Clutter = imports.gi.Clutter;
 const GdkPixbuf = imports.gi.GdkPixbuf;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 const GtkClutter = imports.gi.GtkClutter;
-const Lang = imports.lang;
 const System = imports.system;
 
 const Service = imports.service;
@@ -38,12 +38,11 @@ const _MEMORY_CACHE_SIZE_LIMIT = 100; /* number of tiles */
 const _LOGO_PADDING_X = 10;
 const _LOGO_PADDING_Y = 25;
 
-var AttributionLogo = new Lang.Class({
-    Name: 'AttributionLogo',
-        Extends: GtkClutter.Actor,
+var AttributionLogo = GObject.registerClass({},
+class AttributionLogo extends GtkClutter.Actor {
 
-    _init: function(view) {
-        this.parent();
+    _init(view) {
+        super._init();
 
         if (_attributionImage)
             this.contents = _attributionImage;
@@ -54,15 +53,15 @@ var AttributionLogo = new Lang.Class({
         view.connect('notify::height', () => { this._updatePosition(view); });
 
         this._updatePosition(view);
-    },
+    }
 
-    _updatePosition: function(view) {
+    _updatePosition(view) {
         let width = _attributionImage.pixbuf.width;
         let height = _attributionImage.pixbuf.height;
 
         this.set_position(view.width  - width  - _LOGO_PADDING_X,
                           view.height - height - _LOGO_PADDING_Y);
-    },
+    }
 });
 
 function _updateAttributionImage(source) {
diff --git a/src/mapView.js b/src/mapView.js
index 02d9527..5985667 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -25,7 +25,6 @@ const GObject = imports.gi.GObject;
 const Geocode = imports.gi.GeocodeGlib;
 const Gio = imports.gi.Gio;
 const GtkChamplain = imports.gi.GtkChamplain;
-const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 
 const Application = imports.application;
@@ -86,9 +85,7 @@ const DASHED_ROUTE_LINE_FILLED_LENGTH = 5;
 // length of gaps of dashed lines used for walking legs of transit itineraries
 const DASHED_ROUTE_LINE_GAP_LENGTH = 5;
 
-var MapView = new Lang.Class({
-    Name: 'MapView',
-    Extends: GtkChamplain.Embed,
+var MapView = GObject.registerClass({
     Properties: {
         // this property is true when the routing sidebar is active
         'routingOpen': GObject.ParamSpec.boolean('routingOpen',
@@ -113,10 +110,11 @@ var MapView = new Lang.Class({
         'view-moved': {},
         'marker-selected': { param_types: [Champlain.Marker] }
     },
+}, class MapView extends GtkChamplain.Embed {
 
     get routingOpen() {
         return this._routingOpen || this._instructionMarkerLayer.visible;
-    },
+    }
 
     set routingOpen(value) {
         let isValid = Application.routeQuery.isValid();
@@ -129,19 +127,19 @@ var MapView = new Lang.Class({
         if (!value)
             this.routeShowing = false;
         this.notify('routingOpen');
-    },
+    }
 
     get routeShowing() {
         return this._routeShowing;
-    },
+    }
 
     set routeShowing(value) {
         this._routeShowing = value;
         this.notify('routeShowing');
-    },
+    }
 
-    _init: function(params) {
-        this.parent();
+    _init(params) {
+        super._init();
 
         let mapType = params.mapType || MapType.STREET;
         delete params.mapType;
@@ -159,9 +157,9 @@ var MapView = new Lang.Class({
                                     this._updateUserLocation.bind(this));
         this._storeId = 0;
         this._connectRouteSignals();
-    },
+    }
 
-    _initScale: function(view) {
+    _initScale(view) {
         this._scale = new Champlain.Scale({ visible: true });
         this._scale.connect_view(view);
 
@@ -175,9 +173,9 @@ var MapView = new Lang.Class({
         this._scale.set_x_align(Clutter.ActorAlign.START);
         this._scale.set_y_align(Clutter.ActorAlign.END);
         view.add_child(this._scale);
-    },
+    }
 
-    _initView: function() {
+    _initView() {
         let view = this.get_view();
         view.zoom_level = 3;
         view.min_zoom_level = MapMinZoom;
@@ -198,10 +196,10 @@ var MapView = new Lang.Class({
 
         this._initScale(view);
         return view;
-    },
+    }
 
     /* create and store a route layer, pass true to get a dashed line */
-    _createRouteLayer: function(dashed, lineColor, width) {
+    _createRouteLayer(dashed, lineColor, width) {
         let red = Color.parseColor(lineColor, 0);
         let green = Color.parseColor(lineColor, 1);
         let blue = Color.parseColor(lineColor, 2);
@@ -220,9 +218,9 @@ var MapView = new Lang.Class({
         this.view.add_layer(routeLayer);
 
         return routeLayer;
-    },
+    }
 
-    _clearRouteLayers: function() {
+    _clearRouteLayers() {
         this._routeLayers.forEach((routeLayer) => {
             routeLayer.remove_all();
             routeLayer.visible = false;
@@ -230,9 +228,9 @@ var MapView = new Lang.Class({
         });
 
         this._routeLayers = [];
-    },
+    }
 
-    _initLayers: function() {
+    _initLayers() {
         let mode = Champlain.SelectionMode.SINGLE;
 
         this._userLocationLayer = new Champlain.MarkerLayer({ selection_mode: mode });
@@ -252,14 +250,14 @@ var MapView = new Lang.Class({
         ShapeLayer.SUPPORTED_TYPES.push(GpxShapeLayer.GpxShapeLayer);
 
         this._routeLayers = [];
-    },
+    }
 
-    _ensureInstructionLayerAboveRouteLayers: function() {
+    _ensureInstructionLayerAboveRouteLayers() {
         this.view.remove_layer(this._instructionMarkerLayer);
         this.view.add_layer(this._instructionMarkerLayer);
-    },
+    }
 
-    _connectRouteSignals: function() {
+    _connectRouteSignals() {
         let route = Application.routingDelegator.graphHopper.route;
         let transitPlan = Application.routingDelegator.openTripPlanner.plan;
         let query = Application.routeQuery;
@@ -290,9 +288,9 @@ var MapView = new Lang.Class({
         });
 
         query.connect('notify', () => { this.routingOpen = query.isValid(); });
-    },
+    }
 
-    setMapType: function(mapType) {
+    setMapType(mapType) {
         if (this._mapType && this._mapType === mapType)
             return;
 
@@ -334,13 +332,13 @@ var MapView = new Lang.Class({
         overlay_sources.forEach((source) => {
             this.view.add_overlay_source(source, 255);
         });
-    },
+    }
 
-    toggleScale: function() {
+    toggleScale() {
         this._scale.visible = !this._scale.visible;
-    },
+    }
 
-    openShapeLayers: function(files) {
+    openShapeLayers(files) {
         let bbox = new Champlain.BoundingBox();
         let ret = true;
         files.forEach((file) => {
@@ -365,22 +363,22 @@ var MapView = new Lang.Class({
 
         this.gotoBBox(bbox);
         return ret;
-    },
+    }
 
-    removeShapeLayer: function(shapeLayer) {
+    removeShapeLayer(shapeLayer) {
         shapeLayer.unload();
         let i = this._findShapeLayerIndex(shapeLayer.file);
         this.shapeLayerStore.remove(i);
-    },
+    }
 
-    _findShapeLayerIndex: function(file) {
+    _findShapeLayerIndex(file) {
         for (let i = 0; i < this.shapeLayerStore.get_n_items(); i++)
             if (this.shapeLayerStore.get_item(i).file.equal(file))
                 return i;
         return -1;
-    },
+    }
 
-    goToGeoURI: function(uri) {
+    goToGeoURI(uri) {
         try {
             let location = new Location.Location({ heading: -1 });
             location.set_from_uri(uri);
@@ -397,9 +395,9 @@ var MapView = new Lang.Class({
             Application.notificationManager.showMessage(msg);
             Utils.debug("failed to open GeoURI: %s".format(e.message));
         }
-    },
+    }
 
-    gotoUserLocation: function(animate) {
+    gotoUserLocation(animate) {
         if (!this._userLocation)
             return;
 
@@ -408,15 +406,15 @@ var MapView = new Lang.Class({
             this.emit('gone-to-user-location');
         });
         this._userLocation.goTo(animate);
-    },
+    }
 
-    userLocationVisible: function() {
+    userLocationVisible() {
         let box = this.view.get_bounding_box();
 
         return box.covers(this._userLocation.latitude, this._userLocation.longitude);
-    },
+    }
 
-    _updateUserLocation: function() {
+    _updateUserLocation() {
         if (!Application.geoclue.place)
             return;
 
@@ -440,15 +438,15 @@ var MapView = new Lang.Class({
         this._userLocation.selected = previousSelected;
 
         this.emit('user-location-changed');
-    },
+    }
 
-    _storeLocation: function() {
+    _storeLocation() {
         let box = this.view.get_bounding_box();
         let lastViewedLocation = [box.top, box.bottom, box.left, box.right];
         Application.settings.set('last-viewed-location', lastViewedLocation);
-    },
+    }
 
-    _goToStoredLocation: function() {
+    _goToStoredLocation() {
         if (!this.view.realized)
             return;
 
@@ -458,9 +456,9 @@ var MapView = new Lang.Class({
                                                        left: box[2],
                                                        right: box[3] });
         this.gotoBBox(bounding_box, true);
-    },
+    }
 
-    gotoBBox: function(bbox, linear) {
+    gotoBBox(bbox, linear) {
         if (!bbox.is_valid()) {
             Utils.debug('Bounding box is invalid');
             return;
@@ -476,9 +474,9 @@ var MapView = new Lang.Class({
                                                     right  : bbox.right })
         });
         new MapWalker.MapWalker(place, this).goTo(true, linear);
-    },
+    }
 
-    showTurnPoint: function(turnPoint) {
+    showTurnPoint(turnPoint) {
         if (this._turnPointMarker)
             this._turnPointMarker.destroy();
 
@@ -489,9 +487,9 @@ var MapView = new Lang.Class({
                                                                       mapView: this });
         this._instructionMarkerLayer.add_marker(this._turnPointMarker);
         this._turnPointMarker.goTo();
-    },
+    }
 
-    showTransitStop: function(transitStop, transitLeg) {
+    showTransitStop(transitStop, transitLeg) {
         if (this._turnPointMarker)
             this._turnPointMarker.destroy();
 
@@ -500,9 +498,9 @@ var MapView = new Lang.Class({
                                                                       mapView: this });
         this._instructionMarkerLayer.add_marker(this._turnPointMarker);
         this._turnPointMarker.goTo();
-    },
+    }
 
-    showContact: function(contact) {
+    showContact(contact) {
         let places = contact.get_places();
         if (places.length === 0)
             return;
@@ -520,9 +518,9 @@ var MapView = new Lang.Class({
             this.gotoBBox(contact.bounding_box);
         else
             new MapWalker.MapWalker(places[0], this).goTo(true);
-    },
+    }
 
-    _showStoredRoute: function(stored) {
+    _showStoredRoute(stored) {
         let query = Application.routeQuery;
         let route = Application.routingDelegator.graphHopper.route;
 
@@ -545,9 +543,9 @@ var MapView = new Lang.Class({
             query.thaw_notify();
         });
         route.reset();
-    },
+    }
 
-    showPlace: function(place, animation) {
+    showPlace(place, animation) {
         this._placeLayer.remove_all();
 
         if (place instanceof StoredRoute.StoredRoute) {
@@ -561,9 +559,9 @@ var MapView = new Lang.Class({
 
         this._placeLayer.add_marker(placeMarker);
         placeMarker.goToAndSelect(animation);
-    },
+    }
 
-    showRoute: function(route) {
+    showRoute(route) {
         let routeLayer;
 
         this._clearRouteLayers();
@@ -578,9 +576,9 @@ var MapView = new Lang.Class({
 
         this._showDestinationTurnpoints();
         this.gotoBBox(route.bbox);
-    },
+    }
 
-    _showDestinationTurnpoints: function() {
+    _showDestinationTurnpoints() {
         let route = Application.routingDelegator.graphHopper.route;
         let query = Application.routeQuery;
         let pointIndex = 0;
@@ -596,9 +594,9 @@ var MapView = new Lang.Class({
                 pointIndex++;
             }
         }, this);
-    },
+    }
 
-    _showTransitItinerary: function(itinerary) {
+    _showTransitItinerary(itinerary) {
         this.gotoBBox(itinerary.bbox);
         this._clearRouteLayers();
         this._placeLayer.remove_all();
@@ -676,13 +674,13 @@ var MapView = new Lang.Class({
         this._instructionMarkerLayer.add_marker(arrival);
 
         this.routingOpen = true;
-    },
+    }
 
-    _showTransitPlan: function(plan) {
+    _showTransitPlan(plan) {
         this.gotoBBox(plan.bbox);
-    },
+    }
 
-    _onViewMoved: function() {
+    _onViewMoved() {
         this.emit('view-moved');
         if (this._storeId !== 0)
             return;
@@ -691,9 +689,9 @@ var MapView = new Lang.Class({
             this._storeId = 0;
             this._storeLocation();
         });
-    },
+    }
 
-    onSetMarkerSelected: function(selectedMarker) {
+    onSetMarkerSelected(selectedMarker) {
         this.emit('marker-selected', selectedMarker);
     }
 });
diff --git a/src/mapWalker.js b/src/mapWalker.js
index 06a03ec..d433abb 100644
--- a/src/mapWalker.js
+++ b/src/mapWalker.js
@@ -24,7 +24,7 @@
 const Champlain = imports.gi.Champlain;
 const Clutter = imports.gi.Clutter;
 const Geocode = imports.gi.GeocodeGlib;
-const Lang = imports.lang;
+const GObject = imports.gi.GObject;
 
 const Location = imports.location;
 const Utils = imports.utils;
@@ -33,17 +33,21 @@ const _MAX_DISTANCE = 19850; // half of Earth's circumference (km)
 const _MIN_ANIMATION_DURATION = 2000; // msec
 const _MAX_ANIMATION_DURATION = 5000; // msec
 
-var MapWalker = new Lang.Class({
-    Name: 'MapWalker',
+var MapWalker = GObject.registerClass({
+    Signals: {
+        'gone-to': { }
+    }
+}, class MapWalker extends GObject.Object {
 
-    _init: function(place, mapView) {
+    _init(place, mapView) {
         this.place = place;
         this._mapView = mapView;
         this._view = mapView.view;
         this._boundingBox = this._createBoundingBox(this.place);
-    },
+        super._init();
+    }
 
-    _createBoundingBox: function(place) {
+    _createBoundingBox(place) {
         if (place.bounding_box !== null) {
             return new Champlain.BoundingBox({ top: place.bounding_box.top,
                                                bottom: place.bounding_box.bottom,
@@ -51,10 +55,10 @@ var MapWalker = new Lang.Class({
                                                right: place.bounding_box.right });
         } else
             return null;
-    },
+    }
 
     // Zoom to the maximal zoom-level that fits the place type
-    zoomToFit: function() {
+    zoomToFit() {
         let zoom;
         if (this._boundingBox !== null && this._boundingBox.is_valid()) {
             this._view.zoom_level = this._view.max_zoom_level;
@@ -81,9 +85,9 @@ var MapWalker = new Lang.Class({
             this._view.center_on(this.place.location.latitude,
                                  this.place.location.longitude);
         }
-    },
+    }
 
-    goTo: function(animate, linear) {
+    goTo(animate, linear) {
         Utils.debug('Going to ' + [this.place.name,
                     this.place.location.latitude,
                     this.place.location.longitude].join(' '));
@@ -129,9 +133,9 @@ var MapWalker = new Lang.Class({
                 });
             });
         }
-    },
+    }
 
-    _ensureVisible: function(fromLocation) {
+    _ensureVisible(fromLocation) {
         let visibleBox = null;
 
         if (this._boundingBox !== null && this._boundingBox.is_valid()) {
@@ -153,9 +157,9 @@ var MapWalker = new Lang.Class({
         }
 
         this._view.ensure_visible(visibleBox, true);
-    },
+    }
 
-    _boxCovers: function(coverBox) {
+    _boxCovers(coverBox) {
         if (this._boundingBox === null)
             return false;
 
@@ -172,9 +176,9 @@ var MapWalker = new Lang.Class({
             return false;
 
         return true;
-    },
+    }
 
-    _updateGoToDuration: function(fromLocation) {
+    _updateGoToDuration(fromLocation) {
         let toLocation = this.place.location;
 
         let distance = fromLocation.get_distance_from(toLocation);
@@ -189,4 +193,3 @@ var MapWalker = new Lang.Class({
         this._view.goto_animation_duration = duration / 2;
     }
 });
-Utils.addSignalMethods(MapWalker.prototype);
diff --git a/src/notification.js b/src/notification.js
index e78a331..e77fd16 100644
--- a/src/notification.js
+++ b/src/notification.js
@@ -19,23 +19,22 @@
  * Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
  */
 
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 
 const Utils = imports.utils;
 
-var Notification = new Lang.Class({
-    Name: 'Notification',
-    Extends: Gtk.Revealer,
+var Notification = GObject.registerClass({
     Signals: {
         'revealed': { },
         'dismissed': { }
     },
-    Abstract: true,
+    Abstract: true
+}, class Notification extends Gtk.Revealer {
 
-    _init: function() {
-        this.parent({ visible: true,
+    _init() {
+        super._init({ visible: true,
                       halign: Gtk.Align.CENTER,
                       valign: Gtk.Align.START });
 
@@ -45,17 +44,17 @@ var Notification = new Lang.Class({
 
         this._ui.dismissButton.connect('clicked', this.dismiss.bind(this));
         this.add(this._ui.frame);
-    },
+    }
 
-    reveal: function() {
+    reveal() {
         this._setRevealAndEmit(true, 'revealed');
-    },
+    }
 
-    dismiss: function() {
+    dismiss() {
         this._setRevealAndEmit(false, 'dismissed');
-    },
+    }
 
-    _setRevealAndEmit: function(state, signal) {
+    _setRevealAndEmit(state, signal) {
         // We only want to send a dismissed / shown -signal
         // if there is an actual change in revealed state.
         if (state !== this.child_revealed) {
@@ -68,12 +67,11 @@ var Notification = new Lang.Class({
     }
 });
 
-var Plain = new Lang.Class({
-    Name: 'Plain',
-    Extends: Notification,
+var Plain = GObject.registerClass({},
+class Plain extends Notification {
 
-    _init: function(msg) {
-        this.parent();
+    _init(msg) {
+        super._init();
         let label = new Gtk.Label({ visible : true,
                                     hexpand : true,
                                     halign  : Gtk.Align.START,
diff --git a/src/notificationManager.js b/src/notificationManager.js
index ba2fae1..3622d4b 100644
--- a/src/notificationManager.js
+++ b/src/notificationManager.js
@@ -20,21 +20,19 @@
  *         Jonas Danielsson <jonas threetimestwo org>
  */
 
-const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 
 const Notification = imports.notification;
 
 const _TIMEOUT = 5000; /* ms */
 
-var NotificationManager = new Lang.Class({
-    Name: 'NotificationManager',
+var NotificationManager = class NotificationManager {
 
-    _init: function(overlay) {
+    constructor(overlay) {
         this._overlay = overlay;
-    },
+    }
 
-    _add: function(notification) {
+    _add(notification) {
         this._current = notification;
         if (!(notification instanceof Notification.Plain)) {
             let dismissId = notification.connect('dismissed', () => {
@@ -46,18 +44,18 @@ var NotificationManager = new Lang.Class({
         this._overlay.add_overlay(notification);
         Mainloop.timeout_add(_TIMEOUT, notification.dismiss.bind(notification));
         notification.reveal();
-    },
+    }
 
-    showMessage: function (msg) {
+    showMessage(msg) {
         let notification = new Notification.Plain(msg);
         notification.connect('dismissed', () => {
             this._current = null;
             notification.destroy();
         });
         this.showNotification(notification);
-    },
+    }
 
-    showNotification: function(notification) {
+    showNotification(notification) {
         if(notification.get_parent() === this._overlay)
             return;
         if (!this._current) {
@@ -68,4 +66,4 @@ var NotificationManager = new Lang.Class({
                                  this._add.bind(this, notification));
         }
     }
-});
+};
diff --git a/src/openTripPlanner.js b/src/openTripPlanner.js
index 58254b8..f1b8ad2 100644
--- a/src/openTripPlanner.js
+++ b/src/openTripPlanner.js
@@ -19,8 +19,6 @@
  * Author: Marcus Lundblad <ml update uu se>
  */
 
-const Lang = imports.lang;
-
 const Champlain = imports.gi.Champlain;
 const GLib = imports.gi.GLib;
 const Soup = imports.gi.Soup;
@@ -122,46 +120,41 @@ const NUM_STOPS_TO_TRY = 5;
 // gap to use when fetching additional routes
 const GAP_BEFORE_MORE_RESULTS = 120;
 
-var OpenTripPlanner = new Lang.Class({
-    Name: 'OpenTripPlanner',
+var OpenTripPlanner = class OpenTripPlanner {
 
-    _init: function(params) {
+    constructor(params) {
         this._session = new Soup.Session();
         /* initially set routers as updated far back in the past to force
          * a download when first request
          */
         this._routersUpdatedTimestamp = 0;
         this._query = params.query;
-        delete params.query;
         this._graphHopper = params.graphHopper;
-        delete params.graphHopper;
         this._plan = new TransitPlan.Plan();
         this._baseUrl = this._getBaseUrl();
         this._walkingRoutes = [];
         this._extendPrevious = false;
-
-        this.parent(params);
-    },
+    }
 
     get plan() {
         return this._plan;
-    },
+    }
 
     get enabled() {
         return this._baseUrl !== null;
-    },
+    }
 
-    fetchFirstResults: function() {
+    fetchFirstResults() {
         this._extendPrevious = false;
         this._fetchRoute();
-    },
+    }
 
-    fetchMoreResults: function() {
+    fetchMoreResults() {
         this._extendPrevious = true;
         this._fetchRoute();
-    },
+    }
 
-    _getBaseUrl: function() {
+    _getBaseUrl() {
         let debugUrl = GLib.getenv('OTP_BASE_URL');
 
         if (debugUrl) {
@@ -176,16 +169,16 @@ var OpenTripPlanner = new Lang.Class({
                 return null;
             }
         }
-    },
+    }
 
-    _getRouterUrl: function(router) {
+    _getRouterUrl(router) {
         if (!router || router.length === 0)
             router = 'default';
 
         return this._baseUrl + '/routers/' + router;
-    },
+    }
 
-    _fetchRouters: function(callback) {
+    _fetchRouters(callback) {
         let currentTime = (new Date()).getTime();
 
         if (currentTime - this._routersUpdatedTimestamp < ROUTERS_TIMEOUT) {
@@ -211,9 +204,9 @@ var OpenTripPlanner = new Lang.Class({
                 }
             });
         }
-    },
+    }
 
-    _getRoutersForPlace: function(place) {
+    _getRoutersForPlace(place) {
         let routers = [];
 
         this._routers.routerInfo.forEach((routerInfo) => {
@@ -231,19 +224,19 @@ var OpenTripPlanner = new Lang.Class({
         });
 
         return routers;
-    },
+    }
 
     /* Note: this is theoretically slow (O(n*m)), but we will have filtered
      * possible routers for the starting and ending query point, so they should
      * be short (in many cases just one element)
      */
-    _routerIntersection: function(routers1, routers2) {
+    _routerIntersection(routers1, routers2) {
         return routers1.filter(function(n) {
             return routers2.indexOf(n) != -1;
         });
-    },
+    }
 
-    _getMode: function(routeType) {
+    _getMode(routeType) {
         switch (routeType) {
         case TransitPlan.RouteType.TRAM:
             return 'TRAM';
@@ -258,17 +251,17 @@ var OpenTripPlanner = new Lang.Class({
         default:
             throw new Error('unhandled route type');
         }
-    },
+    }
 
-    _getModes: function(options) {
+    _getModes(options) {
         let modes = options.transitTypes.map((transitType) => {
             return this._getMode(transitType);
         });
 
         return modes.join(',');
-    },
+    }
 
-    _selectBestStopRecursive: function(stops, index, stopIndex, callback) {
+    _selectBestStopRecursive(stops, index, stopIndex, callback) {
         if (index < stops.length) {
             let points = this._query.filledPoints;
             let stop = stops[index];
@@ -311,20 +304,20 @@ var OpenTripPlanner = new Lang.Class({
             stops.forEach((stop) => { Utils.debug(JSON.stringify(stop, '', 2)); });
             callback(stops[0]);
         }
-    },
+    }
 
     /* stopIndex here is the index of stop (i.e. starting point, intermediate
      * stop, final stop
      */
-    _selectBestStop: function(stops, stopIndex, callback) {
+    _selectBestStop(stops, stopIndex, callback) {
         this._selectBestStopRecursive(stops, 0, stopIndex, callback);
-    },
+    }
 
-    _sortTransitStops: function(s1, s2) {
+    _sortTransitStops(s1, s2) {
         return s1.dist > s2.dist;
-    },
+    }
 
-    _fetchRoutesForStop: function(router, stop, callback) {
+    _fetchRoutesForStop(router, stop, callback) {
         let query = new HTTP.Query();
         let uri = new Soup.URI(this._getRouterUrl(router) +
                                '/index/stops/' + stop.id + '/routes');
@@ -342,9 +335,9 @@ var OpenTripPlanner = new Lang.Class({
                 callback(routes);
             }
         });
-    },
+    }
 
-    _routeMatchesSelectedModes: function(route) {
+    _routeMatchesSelectedModes(route) {
         let desiredTransitTypes = this._query.transitOptions.transitTypes;
 
         for (let i = 0; i < desiredTransitTypes.length; i++) {
@@ -364,9 +357,9 @@ var OpenTripPlanner = new Lang.Class({
         }
 
         return false;
-    },
+    }
 
-    _filterStopsRecursive: function(router, stops, index, filteredStops, callback) {
+    _filterStopsRecursive(router, stops, index, filteredStops, callback) {
         if (index < stops.length) {
             let stop = stops[index];
 
@@ -385,13 +378,13 @@ var OpenTripPlanner = new Lang.Class({
         } else {
             callback(filteredStops);
         }
-    },
+    }
 
-    _filterStops: function(router, stops, callback) {
+    _filterStops(router, stops, callback) {
         this._filterStopsRecursive(router, stops, 0, [], callback);
-    },
+    }
 
-    _fetchTransitStopsRecursive: function(router, index, result, callback) {
+    _fetchTransitStopsRecursive(router, index, result, callback) {
         let points = this._query.filledPoints;
 
         if (index < points.length) {
@@ -451,30 +444,30 @@ var OpenTripPlanner = new Lang.Class({
         } else {
             callback(result);
         }
-    },
+    }
 
-    _fetchTransitStops: function(router, callback) {
+    _fetchTransitStops(router, callback) {
         this._fetchTransitStopsRecursive(router, 0, [], callback);
-    },
+    }
 
     // get a time suitably formatted for the OpenTripPlanner query param
-    _formatTime: function(time, offset) {
+    _formatTime(time, offset) {
         let utcTimeWithOffset = (time + offset) / 1000;
         let date = GLib.DateTime.new_from_unix_utc(utcTimeWithOffset);
 
         return date.format('%R');
-    },
+    }
 
     // get a date suitably formatted for the OpenTripPlanner query param
-    _formatDate: function(time, offset) {
+    _formatDate(time, offset) {
         let utcTimeWithOffset = (time + offset) / 1000;
         let date = GLib.DateTime.new_from_unix_utc(utcTimeWithOffset);
 
         return date.format('%F');
-    },
+    }
 
     // create parameter map for the request, given query and options
-    _createParams: function(stops) {
+    _createParams(stops) {
         let params = { fromPlace: stops[0].id,
                        toPlace: stops.last().id };
         let intermediatePlaces = [];
@@ -539,9 +532,9 @@ var OpenTripPlanner = new Lang.Class({
             params.mode = this._getModes(options);
 
         return params;
-    },
+    }
 
-    _fetchRoutesForRouter: function(router, callback) {
+    _fetchRoutesForRouter(router, callback) {
         this._fetchTransitStops(router, (stops) => {
             let points = this._query.filledPoints;
 
@@ -578,9 +571,9 @@ var OpenTripPlanner = new Lang.Class({
                 }
             });
         });
-    },
+    }
 
-    _fetchRoutesRecursive: function(routers, index, result, callback) {
+    _fetchRoutesRecursive(routers, index, result, callback) {
         if (index < routers.length) {
             let router = routers[index];
 
@@ -595,26 +588,26 @@ var OpenTripPlanner = new Lang.Class({
         } else {
             callback(result);
         }
-    },
+    }
 
-    _fetchRoutes: function(routers, callback) {
+    _fetchRoutes(routers, callback) {
         this._fetchRoutesRecursive(routers, 0, [], callback);
-    },
+    }
 
-    _reset: function() {
+    _reset() {
         this._extendPrevious = false;
         if (this._query.latest)
             this._query.latest.place = null;
         else
             this.plan.reset();
-    },
+    }
 
     /* Indicate that no routes where found, either shows the "No route found"
      * notification, or in case of loading additional (later/earlier) results,
      * indicate no such where found, so that the sidebar can disable the
      * "load more" functionallity as appropriate.
      */
-    _noRouteFound: function() {
+    _noRouteFound() {
         if (this._extendPrevious) {
             let message = this._query.arriveBy ?
                           _("No earlier alternatives found.") :
@@ -626,9 +619,9 @@ var OpenTripPlanner = new Lang.Class({
             Application.notificationManager.showMessage(_("No route found."));
             this._reset();
         }
-    },
+    }
 
-    _fetchRoute: function() {
+    _fetchRoute() {
         this._fetchRouters((success) => {
             if (success) {
                 let points = this._query.filledPoints;
@@ -664,13 +657,13 @@ var OpenTripPlanner = new Lang.Class({
                 this._reset();
             }
         });
-    },
+    }
 
-    _isOnlyWalkingItinerary: function(itinerary) {
+    _isOnlyWalkingItinerary(itinerary) {
         return itinerary.legs.length === 1 && !itinerary.legs[0].transit;
-    },
+    }
 
-    _recalculateItineraries: function(itineraries) {
+    _recalculateItineraries(itineraries) {
         // filter out itineraries with only walking
         let newItineraries = [];
 
@@ -683,9 +676,9 @@ var OpenTripPlanner = new Lang.Class({
          * top if the total distance is below some threashhold?
          */
         this._recalculateItinerariesRecursive(newItineraries, 0);
-    },
+    }
 
-    _isItineraryRealistic: function(itinerary) {
+    _isItineraryRealistic(itinerary) {
         for (let i = 0; i < itinerary.legs.length; i++) {
             let leg = itinerary.legs[i];
 
@@ -711,9 +704,9 @@ var OpenTripPlanner = new Lang.Class({
         }
 
         return true;
-    },
+    }
 
-    _recalculateItinerariesRecursive: function(itineraries, index) {
+    _recalculateItinerariesRecursive(itineraries, index) {
         if (index < itineraries.length) {
             this._recalculateItinerary(itineraries[index], (itinerary) => {
                 itineraries[index] = itinerary;
@@ -759,21 +752,21 @@ var OpenTripPlanner = new Lang.Class({
                 this._noRouteFound();
             }
         }
-    },
+    }
 
     // create a straight-line "as the crow flies" polyline between two places
-    _createStraightPolyline: function(fromLoc, toLoc) {
+    _createStraightPolyline(fromLoc, toLoc) {
         return [new Champlain.Coordinate({ latitude: fromLoc.latitude,
                                            longitude: fromLoc.longitude }),
                 new Champlain.Coordinate({ latitude: toLoc.latitude,
                                            longitude: toLoc.longitude })];
-    },
+    }
 
     /* Creates a new walking leg given start and end places, and a route
      * obtained from GraphHopper. If the route is undefined (which happens if
      * GraphHopper failed to obtain a walking route, approximate it with a
      * straight line. */
-    _createWalkingLeg: function(from, to, fromName, toName, route) {
+    _createWalkingLeg(from, to, fromName, toName, route) {
         let fromLocation = from.place.location;
         let toLocation = to.place.location;
         let fromCoordinate = [fromLocation.latitude, fromLocation.longitude];
@@ -796,12 +789,12 @@ var OpenTripPlanner = new Lang.Class({
                                      duration: duration,
                                      distance: distance,
                                      walkingInstructions: walkingInstructions });
-    },
+    }
 
     /* fetches walking route and stores the route for the given coordinate
      * pair to avoid requesting the same route over and over from GraphHopper
      */
-    _fetchWalkingRoute: function(points, callback) {
+    _fetchWalkingRoute(points, callback) {
         let index = points[0].place.location.latitude + ',' +
                     points[0].place.location.longitude + ';' +
                     points[1].place.location.latitude + ',' +
@@ -818,9 +811,9 @@ var OpenTripPlanner = new Lang.Class({
         } else {
             callback(route);
         }
-    },
+    }
 
-    _recalculateItinerary: function(itinerary, callback) {
+    _recalculateItinerary(itinerary, callback) {
         let from = this._query.filledPoints[0];
         let to = this._query.filledPoints.last();
 
@@ -892,9 +885,9 @@ var OpenTripPlanner = new Lang.Class({
              */
             this._recalculateItineraryRecursive(itinerary, 0, callback);
         }
-    },
+    }
 
-    _createQueryPointForCoord: function(coord) {
+    _createQueryPointForCoord(coord) {
         let location = new Location.Location({ latitude: coord[0],
                                                longitude: coord[1],
                                                accuracy: 0 });
@@ -903,9 +896,9 @@ var OpenTripPlanner = new Lang.Class({
 
         point.place = place;
         return point;
-    },
+    }
 
-    _recalculateItineraryRecursive: function(itinerary, index, callback) {
+    _recalculateItineraryRecursive(itinerary, index, callback) {
         if (index < itinerary.legs.length) {
             let leg = itinerary.legs[index];
             if (index === 0) {
@@ -1103,9 +1096,9 @@ var OpenTripPlanner = new Lang.Class({
         } else {
             callback(itinerary);
         }
-    },
+    }
 
-    _getRoutersForPoints: function(points) {
+    _getRoutersForPoints(points) {
         let startRouters = this._getRoutersForPlace(points[0].place);
         let endRouters =
             this._getRoutersForPlace(points.last().place);
@@ -1114,27 +1107,27 @@ var OpenTripPlanner = new Lang.Class({
             this._routerIntersection(startRouters, endRouters);
 
         return intersectingRouters;
-    },
+    }
 
-    _createItineraries: function(itineraries) {
+    _createItineraries(itineraries) {
         return itineraries.map((itinerary) => { return this._createItinerary(itinerary); });
-    },
+    }
 
-    _createItinerary: function(itinerary) {
+    _createItinerary(itinerary) {
         let legs = this._createLegs(itinerary.legs);
         return new TransitPlan.Itinerary({ duration:  itinerary.duration,
                                            transfers: itinerary.transfers,
                                            departure: itinerary.startTime,
                                            arrival:   itinerary.endTime,
                                            legs:      legs});
-    },
+    }
 
-    _createLegs: function(legs) {
+    _createLegs(legs) {
         return legs.map((leg) => { return this._createLeg(leg); });
-    },
+    }
 
     /* check if a string is a valid hex RGB string */
-    _isValidHexColor: function(string) {
+    _isValidHexColor(string) {
         if (string && string.length === 6) {
             let regex = /^[A-Fa-f0-9]/;
 
@@ -1142,9 +1135,9 @@ var OpenTripPlanner = new Lang.Class({
         }
 
         return false;
-    },
+    }
 
-    _createLeg: function(leg) {
+    _createLeg(leg) {
         let polyline = EPAF.decode(leg.legGeometry.points);
         let intermediateStops =
             this._createIntermediateStops(leg);
@@ -1184,18 +1177,18 @@ var OpenTripPlanner = new Lang.Class({
                                      color:                color,
                                      textColor:            textColor,
                                      tripShortName:        leg.tripShortName });
-    },
+    }
 
-    _createIntermediateStops: function(leg) {
+    _createIntermediateStops(leg) {
         let stops = leg.intermediateStops;
         return stops.map((stop) => { return this._createIntermediateStop(stop, leg); });
-    },
+    }
 
-    _createIntermediateStop: function(stop, leg) {
+    _createIntermediateStop(stop, leg) {
         return new TransitPlan.Stop({ name:       stop.name,
                                       arrival:    stop.arrival,
                                       departure:  stop.departure,
                                       agencyTimezoneOffset: leg.agencyTimeZoneOffset,
                                       coordinate: [stop.lat, stop.lon] });
     }
-});
+};
diff --git a/src/osmAccountDialog.js b/src/osmAccountDialog.js
index c9ce704..56a6b98 100644
--- a/src/osmAccountDialog.js
+++ b/src/osmAccountDialog.js
@@ -22,7 +22,6 @@
 
 const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
 const WebKit2 = imports.gi.WebKit2;
 
 const Application = imports.application;
@@ -31,9 +30,7 @@ var Response = {
     SIGNED_IN: 0
 };
 
-var OSMAccountDialog = new Lang.Class({
-    Name: 'OSMAccountDialog',
-    Extends: Gtk.Dialog,
+var OSMAccountDialog = GObject.registerClass({
     Template: 'resource:///org/gnome/Maps/ui/osm-account-dialog.ui',
     InternalChildren: ['stack',
                        'emailEntry',
@@ -48,15 +45,16 @@ var OSMAccountDialog = new Lang.Class({
                        'verificationFailedLabel',
                        'signedInUserLabel',
                        'signOutButton'],
+}, class OSMAccountDialog extends Gtk.Dialog {
 
-    _init: function(params) {
+    _init(params) {
         /* This is a construct-only property and cannot be set by GtkBuilder */
         params.use_header_bar = true;
 
         this._closeOnSignIn = params.closeOnSignIn;
         delete params.closeOnSignIn;
 
-        this.parent(params);
+        super._init(params);
 
         this._emailEntry.connect('changed',
                                  this._onCredentialsChanged.bind(this));
@@ -80,31 +78,31 @@ var OSMAccountDialog = new Lang.Class({
             this._signedInUserLabel.label = Application.osmEdit.username;
             this._stack.visible_child_name = 'logged-in';
         }
-    },
+    }
 
-    _onCredentialsChanged: function() {
+    _onCredentialsChanged() {
         let email = this._emailEntry.text;
         let password = this._passwordEntry.text;
 
         // make sign in button sensitive if credential have been entered
         this._signInButton.sensitive =
             email && email.length > 0 && password && password.length > 0;
-    },
+    }
 
-    _onSignInButtonClicked: function() {
+    _onSignInButtonClicked() {
         this._performSignIn();
-    },
+    }
 
-    _onPasswordActivated: function() {
+    _onPasswordActivated() {
         /* if username and password was entered, proceed with sign-in */
         let email = this._emailEntry.text;
         let password = this._passwordEntry.text;
 
         if (email && email.length > 0 && password && password.length > 0)
             this._performSignIn();
-    },
+    }
 
-    _performSignIn: function() {
+    _performSignIn() {
         /* turn on signing in spinner and desensisize credential entries */
         this._signInSpinner.visible = true;
         this._signInButton.sensitive = false;
@@ -115,9 +113,9 @@ var OSMAccountDialog = new Lang.Class({
         Application.osmEdit.performOAuthSignIn(this._emailEntry.text,
                                                this._passwordEntry.text,
                                                this._onOAuthSignInPerformed.bind(this));
-    },
+    }
 
-    _onOAuthSignInPerformed: function(success, verificationPage) {
+    _onOAuthSignInPerformed(success, verificationPage) {
         if (success) {
             /* switch to the verification view and show the verification
                page */
@@ -135,13 +133,13 @@ var OSMAccountDialog = new Lang.Class({
         /* re-sensisize credential entries */
         this._emailEntry.sensitive = true;
         this._passwordEntry.sensitive = true;
-    },
+    }
 
-    _onVerifyButtonClicked: function() {
+    _onVerifyButtonClicked() {
         this._performVerification();
-    },
+    }
 
-    _performVerification: function() {
+    _performVerification() {
         /* allow copying the leading space between the "The verification is"
            label and the code */
         let verificationCode = this._verificationEntry.text.trim();
@@ -155,23 +153,23 @@ var OSMAccountDialog = new Lang.Class({
 
         Application.osmEdit.requestOAuthAccessToken(verificationCode,
                                                     this._onOAuthAccessTokenRequested.bind(this));
-    },
+    }
 
-    _onVerificationEntryChanged: function() {
+    _onVerificationEntryChanged() {
         this._verifyButton.sensitive =
             this._verificationEntry.text &&
             this._verificationEntry.text.length > 0;
-    },
+    }
 
-    _onVerificationEntryActivated: function() {
+    _onVerificationEntryActivated() {
         /* proceed with verfication if a code has been entered */
         let verificationCode = this._verificationEntry.text;
 
         if (verificationCode && verificationCode.length > 0)
             this._performVerification();
-    },
+    }
 
-    _onOAuthAccessTokenRequested: function(success) {
+    _onOAuthAccessTokenRequested(success) {
         if (success) {
             /* update the username label */
             this._signedInUserLabel.label = Application.osmEdit.username;
@@ -197,9 +195,9 @@ var OSMAccountDialog = new Lang.Class({
         }
         /* reset verification code entry */
         this._verificationEntry.text = '';
-    },
+    }
 
-    _onSignOutButtonClicked: function() {
+    _onSignOutButtonClicked() {
         Application.osmEdit.signOut();
         this._stack.visible_child_name = 'sign-in';
     }
diff --git a/src/osmConnection.js b/src/osmConnection.js
index d858ceb..6b3b7ac 100644
--- a/src/osmConnection.js
+++ b/src/osmConnection.js
@@ -22,7 +22,6 @@
 
 const _ = imports.gettext.gettext;
 
-const Lang = imports.lang;
 const Maps = imports.gi.GnomeMaps;
 const Rest = imports.gi.Rest;
 const Secret = imports.gi.Secret;
@@ -45,10 +44,9 @@ const SECRET_SCHEMA = new Secret.Schema("org.gnome.Maps",
     }
 );
 
-var OSMConnection = new Lang.Class({
-    Name: 'OSMConnection',
+var OSMConnection = class OSMConnection {
 
-    _init: function(params) {
+    constructor() {
         this._session = new Soup.Session();
 
         /* OAuth proxy used for making OSM uploads */
@@ -56,9 +54,9 @@ var OSMConnection = new Lang.Class({
                                               BASE_URL + '/' + API_VERSION,
                                               false);
         Maps.osm_init();
-    },
+    }
 
-    getOSMObject: function(type, id, callback, cancellable) {
+    getOSMObject(type, id, callback, cancellable) {
         let url = this._getQueryUrl(type, id);
         let uri = new Soup.URI(url);
         let request = new Soup.Message({ method: 'GET', uri: uri });
@@ -82,13 +80,13 @@ var OSMConnection = new Lang.Class({
                 callback(false, message.status_code, null, type, e);
             }
         });
-    },
+    }
 
-    _getQueryUrl: function(type, id) {
+    _getQueryUrl(type, id) {
         return BASE_URL + '/' + API_VERSION + '/' + type + '/' + id;
-    },
+    }
 
-    openChangeset: function(comment, callback) {
+    openChangeset(comment, callback) {
         /* we assume that this would only be called if there's already been an
            OAuth access token enrolled, so, if the currently instanciated
            proxy instance doesn't have a token set, we could safely count on
@@ -102,9 +100,9 @@ var OSMConnection = new Lang.Class({
         } else {
             this._doOpenChangeset(comment, callback);
         }
-    },
+    }
 
-    _onPasswordLookedUp: function(result, comment, callback) {
+    _onPasswordLookedUp(result, comment, callback) {
         let password = Secret.password_lookup_finish(result);
 
         if (password) {
@@ -117,9 +115,9 @@ var OSMConnection = new Lang.Class({
         } else {
             callback(false, null, null);
         }
-    },
+    }
 
-    _doOpenChangeset: function(comment, callback) {
+    _doOpenChangeset(comment, callback) {
         let changeset =
             Maps.OSMChangeset.new(comment, 'gnome-maps ' + pkg.version);
         let xml = changeset.serialize();
@@ -130,9 +128,9 @@ var OSMConnection = new Lang.Class({
 
         call.invoke_async(null, (call, res, userdata) =>
                                 { this._onChangesetOpened(call, callback); });
-    },
+    }
 
-    _onChangesetOpened: function(call, callback) {
+    _onChangesetOpened(call, callback) {
         if (call.get_status_code() !== Soup.Status.OK) {
             callback(false, call.get_status_code(), null);
             return;
@@ -140,9 +138,9 @@ var OSMConnection = new Lang.Class({
 
         let changesetId = parseInt(call.get_payload());
         callback(true, call.get_status_code(), changesetId);
-    },
+    }
 
-    uploadObject: function(object, type, changeset, callback) {
+    uploadObject(object, type, changeset, callback) {
         object.changeset = changeset;
 
         let xml = object.serialize();
@@ -153,18 +151,18 @@ var OSMConnection = new Lang.Class({
 
         call.invoke_async(null, (call, res, userdata) =>
                                 { this._onObjectUploaded(call, callback); });
-    },
+    }
 
-    _onObjectUploaded: function(call, callback) {
+    _onObjectUploaded(call, callback) {
         if (call.get_status_code() !== Soup.Status.OK) {
             callback(false, call.get_status_code(), null);
             return;
         }
 
         callback(true, call.get_status_code(), call.get_payload());
-    },
+    }
 
-    deleteObject: function(object, type, changeset, callback) {
+    deleteObject(object, type, changeset, callback) {
         object.changeset = changeset;
 
         let xml = object.serialize();
@@ -175,60 +173,60 @@ var OSMConnection = new Lang.Class({
 
         call.invoke_async(null, (call, res, userdata) =>
                                 { this._onObjectDeleted(call, callback); });
-    },
+    }
 
-    _onObjectDeleted: function(call, callback) {
+    _onObjectDeleted(call, callback) {
         if (call.get_status_code() !== Soup.Status.OK) {
             callback(false, call.get_status_code(), null);
             return;
         }
 
         callback(true, call.get_status_code(), call.get_payload());
-    },
+    }
 
-    closeChangeset: function(changesetId, callback) {
+    closeChangeset(changesetId, callback) {
         let call = this._callProxy.new_call();
         call.set_method('PUT');
         call.set_function(this._getCloseChangesetFunction(changesetId));
 
         call.invoke_async(null, (call, res, userdata) =>
                                 { this._onChangesetClosed(call, callback); });
-    },
+    }
 
-    _onChangesetClosed: function(call, callback) {
+    _onChangesetClosed(call, callback) {
         if (call.get_status_code() !== Soup.Status.OK) {
             callback(false, call.get_status_code(), null);
             return;
         }
 
         callback(true, call.get_status_code(), call.get_payload());
-    },
+    }
 
-    _getCloseChangesetFunction: function(changesetId) {
+    _getCloseChangesetFunction(changesetId) {
         return '/changeset/' + changesetId + '/close';
-    },
+    }
 
-    _getCreateOrUpdateFunction: function(object, type) {
+    _getCreateOrUpdateFunction(object, type) {
         if (object.id)
             return type + '/' + object.id;
         else
             return type + '/create';
-    },
+    }
 
-    _getDeleteFunction: function(object, type) {
+    _getDeleteFunction(object, type) {
         return type + '/' + id;
-    },
+    }
 
-    requestOAuthToken: function(callback) {
+    requestOAuthToken(callback) {
         /* OAuth proxy used for enrolling access tokens */
         this._oauthProxy = Rest.OAuthProxy.new(CONSUMER_KEY, CONSUMER_SECRET,
                                                OAUTH_ENDPOINT_URL, false);
         this._oauthProxy.request_token_async('request_token', 'oob', (p, error, w, u) => {
             this._onRequestOAuthToken(error, callback);
         }, this._oauthProxy, callback);
-    },
+    }
 
-    _onRequestOAuthToken: function(error, callback) {
+    _onRequestOAuthToken(error, callback) {
         if (error) {
             Utils.debug(error);
             callback(false);
@@ -238,9 +236,9 @@ var OSMConnection = new Lang.Class({
         this._oauthToken = this._oauthProxy.get_token();
         this._oauthTokenSecret = this._oauthProxy.get_token_secret();
         callback(true);
-    },
+    }
 
-    authorizeOAuthToken: function(username, password, callback) {
+    authorizeOAuthToken(username, password, callback) {
         /* get login session ID */
         let loginUrl = LOGIN_URL + '?cookie_test=true';
         let uri = new Soup.URI(loginUrl);
@@ -249,9 +247,9 @@ var OSMConnection = new Lang.Class({
         this._session.queue_message(msg, (obj, message) => {
             this._onLoginFormReceived(message, username, password, callback);
         });
-    },
+    }
 
-    _onLoginFormReceived: function(message, username, password, callback) {
+    _onLoginFormReceived(message, username, password, callback) {
         if (message.status_code !== Soup.Status.OK) {
             callback(false);
             return;
@@ -268,9 +266,9 @@ var OSMConnection = new Lang.Class({
         }
 
         this._login(username, password, osmSessionID, osmSessionToken, callback);
-    },
+    }
 
-    _login: function(username, password, sessionId, token, callback) {
+    _login(username, password, sessionId, token, callback) {
         /* post login form */
         let msg = Soup.form_request_new_from_hash('POST', LOGIN_URL,
                                                   {username: username,
@@ -292,9 +290,9 @@ var OSMConnection = new Lang.Class({
                 callback(false, null);
         });
 
-    },
+    }
 
-    _fetchAuthorizeForm: function(username, sessionId, callback) {
+    _fetchAuthorizeForm(username, sessionId, callback) {
         let auth = '/authorize?oauth_token=';
         let authorizeUrl = OAUTH_ENDPOINT_URL + auth + this._oauthToken;
         let uri = new Soup.URI(authorizeUrl);
@@ -311,9 +309,9 @@ var OSMConnection = new Lang.Class({
                 callback(false, null);
             }
         });
-    },
+    }
 
-    _postAuthorizeForm: function(username, sessionId, token, callback) {
+    _postAuthorizeForm(username, sessionId, token, callback) {
         let authorizeUrl = OAUTH_ENDPOINT_URL + '/authorize';
         let msg = Soup.form_request_new_from_hash('POST', authorizeUrl, {
             oauth_token: this._oauthToken,
@@ -336,15 +334,15 @@ var OSMConnection = new Lang.Class({
             } else
                 callback(false, null);
         });
-    },
+    }
 
-    requestOAuthAccessToken: function(code, callback) {
+    requestOAuthAccessToken(code, callback) {
         this._oauthProxy.access_token_async('access_token', code, (p, error, w, data) => {
             this._onAccessOAuthToken(error, callback);
         }, this._oauthProxy, callback);
-    },
+    }
 
-    _onAccessOAuthToken: function(error, callback) {
+    _onAccessOAuthToken(error, callback) {
         if (error) {
             callback(false);
             return;
@@ -362,16 +360,16 @@ var OSMConnection = new Lang.Class({
                               (source, result, userData) => {
                                 this._onPasswordStored(result, callback);
                               });
-    },
+    }
 
-    _onPasswordStored: function(result, callback) {
+    _onPasswordStored(result, callback) {
         let res = false;
         if (result)
             res = Secret.password_store_finish(result);
         callback(res);
-    },
+    }
 
-    signOut: function() {
+    signOut() {
         /* clear token on call proxy, so it will use a new token if the user
            signs in again (with a new access token) during this running
            session */
@@ -380,14 +378,14 @@ var OSMConnection = new Lang.Class({
 
         Secret.password_clear(SECRET_SCHEMA, {}, null,
             this._onPasswordCleared.bind(this));
-    },
+    }
 
-    _onPasswordCleared: function(source, result) {
+    _onPasswordCleared(source, result) {
         Secret.password_clear_finish(result);
-    },
+    }
 
     /* extract the session ID from the login form response headers */
-    _extractOSMSessionID: function(responseHeaders) {
+    _extractOSMSessionID(responseHeaders) {
         let cookie = responseHeaders.get('Set-Cookie');
 
         if (cookie === null)
@@ -406,11 +404,11 @@ var OSMConnection = new Lang.Class({
         }
 
         return null;
-    },
+    }
 
     /* extract the authenticity token from the hidden input field of the login
        form */
-    _extractToken: function(messageBody) {
+    _extractToken(messageBody) {
         let regex = /.*authenticity_token.*value=\"([^\"]+)\".*/;
         let lines = messageBody.split('\n');
 
@@ -423,7 +421,7 @@ var OSMConnection = new Lang.Class({
 
         return null;
     }
-});
+};
 
 /*
  * Gets a status message (usually for an error case)
diff --git a/src/osmEdit.js b/src/osmEdit.js
index d74209b..cfb9206 100644
--- a/src/osmEdit.js
+++ b/src/osmEdit.js
@@ -20,9 +20,6 @@
  * Author: Marcus Lundblad <ml update uu se>
  */
 
-const GObject = imports.gi.GObject;
-const Lang = imports.lang;
-
 const Application = imports.application;
 const OSMAccountDialog = imports.osmAccountDialog;
 const OSMEditDialog = imports.osmEditDialog;
@@ -32,22 +29,20 @@ const Utils = imports.utils;
 /* minimum zoom level at which to offer adding a location */
 var MIN_ADD_LOCATION_ZOOM_LEVEL = 16;
 
-var OSMEdit = new Lang.Class({
-    Name: 'OSMEdit',
-    Extends: GObject.Object,
+var OSMEdit = class OSMEdit {
 
-    _init: function() {
+    constructor() {
         this._osmConnection = new OSMConnection.OSMConnection();
         this._osmObject = null; // currently edited object
         this._username = Application.settings.get('osm-username');
         this._isSignedIn = this._username !== null && this._username.length > 0;
-    },
+    }
 
     get object() {
         return this._osmObject;
-    },
+    }
 
-    createEditDialog: function(parentWindow, place) {
+    createEditDialog(parentWindow, place) {
         let dialog = new OSMEditDialog.OSMEditDialog({
             transient_for: parentWindow,
             modal: true,
@@ -55,9 +50,9 @@ var OSMEdit = new Lang.Class({
         });
 
         return dialog;
-    },
+    }
 
-    createEditNewDialog: function(parentWindow, latitude, longitude) {
+    createEditNewDialog(parentWindow, latitude, longitude) {
         let dialog = new OSMEditDialog.OSMEditDialog({
             transient_for: parentWindow,
             modal: true,
@@ -67,9 +62,9 @@ var OSMEdit = new Lang.Class({
         });
 
         return dialog;
-    },
+    }
 
-    createAccountDialog: function(parentWindow, closeOnSignIn) {
+    createAccountDialog(parentWindow, closeOnSignIn) {
         let dialog = new OSMAccountDialog.OSMAccountDialog({
             transient_for: parentWindow,
             modal: true,
@@ -77,9 +72,9 @@ var OSMEdit = new Lang.Class({
         });
 
         return dialog;
-    },
+    }
 
-    fetchObject: function(place, callback, cancellable) {
+    fetchObject(place, callback, cancellable) {
         let osmType = Utils.osmTypeToString(place.osmType);
 
         /* reset currenly edited object */
@@ -88,88 +83,87 @@ var OSMEdit = new Lang.Class({
                      (function(success, status, osmObject, osmType) {
                          callback(success, status, osmObject, osmType);
                      }), cancellable);
-    },
+    }
 
-    uploadObject: function(object, type, comment, callback) {
+    uploadObject(object, type, comment, callback) {
         this._openChangeset(object, type, comment,
                             this._uploadObject.bind(this), callback);
-    },
+    }
 
-    _onChangesetOpened: function(success, status, changesetId, object, type,
-                                 action, callback) {
+    _onChangesetOpened(success, status, changesetId, object, type, action, callback) {
         if (success) {
             let osmType = Utils.osmTypeToString(type);
             action(object, osmType, changesetId, callback);
         } else {
             callback(false, status);
         }
-    },
+    }
 
-    _openChangeset: function(object, type, comment, action, callback) {
+    _openChangeset(object, type, comment, action, callback) {
         this._osmConnection.openChangeset(comment, (success, status, changesetId) => {
             this._onChangesetOpened(success, status, changesetId, object, type, action, callback);
         });
-    },
+    }
 
-    _onObjectUploaded: function(success, status, response, changesetId, callback) {
+    _onObjectUploaded(success, status, response, changesetId, callback) {
         if (success)
             this._closeChangeset(changesetId, callback);
         else
             callback(false, status);
-    },
+    }
 
-    _uploadObject: function(object, type, changesetId, callback) {
+    _uploadObject(object, type, changesetId, callback) {
         this._osmObject = object;
         this._osmConnection.uploadObject(object, type, changesetId, (success, status, response) => {
             this._onObjectUploaded(success, status, response, changesetId, callback);
         });
-    },
+    }
 
-    deleteObject: function(object, type, comment, callback) {
+    deleteObject(object, type, comment, callback) {
         this._openChangeset(object, type, comment,
                             this._deleteObject.bind(this), callback);
-    },
+    }
 
-    _onObjectDeleted: function(success, status, response, changesetId, callback) {
+    _onObjectDeleted(success, status, response, changesetId, callback) {
         if (success)
             this._closeChangeset(changesetId, callback);
         else
             callback(false, status);
-    },
+    }
 
-    _deleteObject: function(object, type, changesetId, callback) {
+    _deleteObject(object, type, changesetId, callback) {
         this._osmObject = object;
         this._osmConnection.deleteObject(object, type, changesetId, (success, status, response) => {
             this._onObjectDeleted(success, status, response, changesetId, callback);
         });
-    },
+    }
 
-    _closeChangeset: function(changesetId, callback) {
+    _closeChangeset(changesetId, callback) {
         this._osmConnection.closeChangeset(changesetId, callback);
-    },
+    }
 
-    performOAuthSignIn: function(username, password, callback) {
+    performOAuthSignIn(username, password, callback) {
         this._osmConnection.requestOAuthToken((success) => {
             if (success)
                 this._onOAuthTokenRequested(username, password, callback);
             else
                 callback(false, null);
         });
-    },
+    }
 
-    _onOAuthTokenRequested: function(username, password, callback) {
+    _onOAuthTokenRequested(username, password, callback) {
         /* keep track of authorizing username */
         this._username = username;
         this._osmConnection.authorizeOAuthToken(username, password, callback);
-    },
+    }
 
-    requestOAuthAccessToken: function(code, callback) {
+    requestOAuthAccessToken(code, callback) {
         this._osmConnection.requestOAuthAccessToken(code, (success, token) => {
             this._onOAuthAccessTokenRequested(success, callback);
         });
-    },
+    }
 
-    _onOAuthAccessTokenRequested: function(success, callback) {
+    _onOAuthAccessTokenRequested(success, callback) {
         if (success) {
             this._isSignedIn = true;
             Application.settings.set('osm-username', this._username);
@@ -179,21 +173,21 @@ var OSMEdit = new Lang.Class({
         }
 
         callback(success);
-    },
+    }
 
-    signOut: function() {
+    signOut() {
         this._username = null;
         this._isSignedIn = false;
 
         Application.settings.set('osm-username', '');
         this._osmConnection.signOut();
-    },
+    }
 
     get isSignedIn() {
         return this._isSignedIn;
-    },
+    }
 
     get username() {
         return this._username;
     }
-});
+};
diff --git a/src/serviceBackend.js b/src/serviceBackend.js
index bbe7165..edcfdeb 100644
--- a/src/serviceBackend.js
+++ b/src/serviceBackend.js
@@ -19,42 +19,42 @@
  * Author: Damián Nohales <damiannohales gmail com>
  */
 
-const Lang = imports.lang;
+const GObject = imports.gi.GObject;
 
 const Utils = imports.utils;
 
-var ServiceBackend = new Lang.Class({
-    Name: 'SocialServiceServiceBackend',
-    Abstract: true,
+var ServiceBackend = GObject.registerClass({
+    Abstract: true
+}, class ServiceBackend extends GObject.Object {
 
     //Abstract
-    get name() { },
+    get name() { }
 
     //Abstract
-    createRestCall: function(authorizer) { },
+    createRestCall(authorizer) { }
 
     //Abstract
-    refreshAuthorization: function(authorizer, cancellable) { },
+    refreshAuthorization(authorizer, cancellable) { }
 
     //Abstract
-    getAuthorizerAccount: function(authorizer) { },
+    getAuthorizerAccount(authorizer) { }
 
     //Abstract
-    createAuthorizer: function(account) { },
+    createAuthorizer(account) { }
 
     //Abstract
-    isTokenInvalid: function(restCall, parsedPayload) { },
+    isTokenInvalid(restCall, parsedPayload) { }
 
     //Abstract
-    isInvalidCall: function(restCall, parsedPayload) { },
+    isInvalidCall(restCall, parsedPayload) { }
 
     //Abstract
-    getCallResultCode: function(restCall, parsedPayload) { },
+    getCallResultCode(restCall, parsedPayload) { }
 
     //Abstract
-    getCallResultMessage: function(restCall, parsedPayload) { },
+    getCallResultMessage(restCall, parsedPayload) { }
 
-    callAsync: function(authorizer, method, func, params, callback, cancellable, mustRefreshToken) {
+    callAsync(authorizer, method, func, params, callback, cancellable, mustRefreshToken) {
         mustRefreshToken = mustRefreshToken || true;
         cancellable = cancellable || null;
 
@@ -94,17 +94,17 @@ var ServiceBackend = new Lang.Class({
             else
                 callback(account, data, null);
         });
-    },
+    }
 
-    performCheckIn: function(authorizer, checkIn, callback, cancellable) {
+    performCheckIn(authorizer, checkIn, callback, cancellable) {
         callback = callback || function() {};
         this._realPerformCheckIn(authorizer, checkIn, callback, cancellable);
-    },
+    }
 
     //Abstract
-    _realPerformCheckIn: function(authorizer, checkIn, callback, cancellable) { },
+    _realPerformCheckIn(authorizer, checkIn, callback, cancellable) { }
 
-    findPlaces: function(authorizer, latitude, longitude, distance, callback, cancellable) {
+    findPlaces(authorizer, latitude, longitude, distance, callback, cancellable) {
         callback = callback || function() {};
         this._realFindPlaces(authorizer,
                              latitude,
@@ -117,11 +117,11 @@ var ServiceBackend = new Lang.Class({
                                      callback(account, [], error);
                              },
                              cancellable);
-    },
+    }
 
     //Abstract
-    _realFindPlaces: function(authorizer, latitude, longitude, distance, callback, cancellable) { },
+    _realFindPlaces(authorizer, latitude, longitude, distance, callback, cancellable) { }
 
     //Abstract
-    createPlaces: function(rawData) { }
+    createPlaces(rawData) { }
 });
diff --git a/src/shapeLayer.js b/src/shapeLayer.js
index 9dd5107..dccc789 100644
--- a/src/shapeLayer.js
+++ b/src/shapeLayer.js
@@ -22,26 +22,26 @@ const Gio = imports.gi.Gio;
 const GObject = imports.gi.GObject;
 const Lang = imports.lang;
 
+const GeoJSONShapeLayer = imports.geoJSONShapeLayer;
+
 var SUPPORTED_TYPES = [];
 
 function newFromFile(file, mapView) {
     let contentType = Gio.content_type_guess(file.get_uri(), null)[0];
     for (let layerClass of SUPPORTED_TYPES) {
         if (layerClass.mimeTypes.indexOf(contentType) > -1) {
-            return new layerClass({ file: file, mapView: mapView });
+            return layerClass.createInstance({ file: file, mapView: mapView });
         }
     }
     return null;
 }
 
-var ShapeLayer = new Lang.Class({
-    Name: 'ShapeLayer',
-    Extends: GObject.Object,
-    Abstract: true,
-
-    _init: function(params) {
-        this.parent();
+var ShapeLayer = GObject.registerClass({
+    Abstract: true
+}, class ShapeLayer extends GObject.Object {
 
+    _init(params) {
+        super._init();
         this._visible = true;
         this._mapView = params.mapView;
         this.file = params.file;
@@ -56,15 +56,15 @@ var ShapeLayer = new Lang.Class({
             selection_mode: Champlain.SelectionMode.SINGLE
         });
         this._mapSource = null;
-    },
+    }
 
     get bbox() {
         return this._mapSource.bbox;
-    },
+    }
 
     get visible() {
         return this._visible;
-    },
+    }
 
     set visible(v) {
         if (v && !this._visible) {
@@ -75,17 +75,17 @@ var ShapeLayer = new Lang.Class({
             this._markerLayer.hide_all_markers();
         }
         this._visible = v;
-    },
+    }
 
-    getName: function() {
+    getName() {
         /*
          * Remove file extension and use that in lieu of a fileformat-specific
          * display name.
          */
         return this.filename.replace(/\.[^\.]+$/, '');
-    },
+    }
 
-    load: function() {
+    load() {
         let [status, buffer] = this.file.load_contents(null);
         this._fileContents = buffer;
         if (!status)
@@ -93,14 +93,14 @@ var ShapeLayer = new Lang.Class({
         this._parseContent();
         this._mapView.view.add_layer(this._markerLayer);
         this._mapView.view.add_overlay_source(this._mapSource, 255);
-    },
+    }
 
 
-    _parseContent: function() {
+    _parseContent() {
         /* Unimplemented */
-    },
+    }
 
-    unload: function() {
+    unload() {
         this._mapView.view.remove_layer(this._markerLayer);
         this._mapView.view.remove_overlay_source(this._mapSource);
     }


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