[gnome-documents/wip/christopherdavis/es6: 5/5] Initial port to ES6



commit c4c4de4d3fa5ca19cbec425309e49d8493a10ee1
Author: Christopher Davis <brainblasted disroot org>
Date:   Sun Apr 21 13:49:52 2019 -0400

    Initial port to ES6

 src/application.js         | 113 ++++++-----
 src/changeMonitor.js       |  41 ++--
 src/documents.js           | 492 ++++++++++++++++++++++-----------------------
 src/edit.js                |  63 +++---
 src/embed.js               |  55 +++--
 src/errorBox.js            |  14 +-
 src/evinceview.js          | 216 ++++++++++----------
 src/fullscreenAction.js    |  77 ++++---
 src/lokview.js             |  80 ++++----
 src/mainToolbar.js         |  34 ++--
 src/mainWindow.js          |  38 ++--
 src/manager.js             |  88 ++++----
 src/notifications.js       |  80 ++++----
 src/overview.js            | 324 +++++++++++++++--------------
 src/password.js            |  10 +-
 src/places.js              |  30 +--
 src/presentation.js        |  83 ++++----
 src/preview.js             | 303 ++++++++++++++--------------
 src/properties.js          |  10 +-
 src/query.js               |  67 +++---
 src/search.js              | 231 +++++++++++----------
 src/searchbar.js           |  41 ++--
 src/selections.js          | 271 ++++++++++++-------------
 src/sharing.js             |  77 ++++---
 src/shellSearchProvider.js | 101 +++++-----
 src/trackerController.js   | 154 +++++++-------
 src/trackerUtils.js        |  19 +-
 src/windowMode.js          |  19 +-
 28 files changed, 1555 insertions(+), 1576 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 23a959b1..91e7685e 100644
--- a/src/application.js
+++ b/src/application.js
@@ -92,14 +92,13 @@ function TrackerExtractPriority() {
 
 const MINER_REFRESH_TIMEOUT = 60; /* seconds */
 
-var Application = new Lang.Class({
-    Name: 'Application',
-    Extends: Gtk.Application,
+var Application = GObject.registerClass({
     Signals: {
         'miners-changed': {}
-    },
+    }
+}, class Application extends Gtk.Application {
 
-    _init: function() {
+    _init() {
         this.minersRunning = [];
         this._activationTimestamp = Gdk.CURRENT_TIME;
         this._extractPriority = null;
@@ -112,14 +111,14 @@ var Application = new Lang.Class({
         // needed by data/ui/view-menu.ui
         GObject.type_ensure(Gio.ThemedIcon);
 
-        this.parent({ application_id: appid,
+        super._init({ application_id: appid,
                       inactivity_timeout: 12000 });
 
         this.add_main_option('version', 'v'.charCodeAt(0), GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
                              _("Show the version of the program"), null);
-    },
+    }
 
-    _initGettingStarted: function() {
+    _initGettingStarted() {
         let manager = TrackerControl.MinerManager.new_full(false);
 
         let languages = GLib.get_language_names();
@@ -153,9 +152,9 @@ var Application = new Lang.Class({
 
         if (!this.gettingStartedLocation)
             log('Can\'t find a valid getting started PDF document');
-    },
+    }
 
-    _nightModeCreateHook: function(action) {
+    _nightModeCreateHook(action) {
         settings.connect('changed::night-mode', Lang.bind(this,
             function() {
                 let state = settings.get_value('night-mode');
@@ -169,17 +168,17 @@ var Application = new Lang.Class({
         let state = settings.get_value('night-mode');
         let gtkSettings = Gtk.Settings.get_default();
         gtkSettings.gtk_application_prefer_dark_theme = state.get_boolean();
-    },
+    }
 
-    _onActionQuit: function() {
+    _onActionQuit() {
         this._mainWindow.destroy();
-    },
+    }
 
-    _onActionAbout: function() {
+    _onActionAbout() {
         this._mainWindow.showAbout();
-    },
+    }
 
-    _onActionHelp: function() {
+    _onActionHelp() {
         try {
             Gtk.show_uri_on_window(this._mainWindow,
                                    'help:gnome-documents',
@@ -187,14 +186,14 @@ var Application = new Lang.Class({
         } catch (e) {
             logError(e, 'Unable to display help');
         }
-    },
+    }
 
-    _onActionNightMode: function(action) {
+    _onActionNightMode(action) {
         let state = action.get_state();
         settings.set_value('night-mode', GLib.Variant.new('b', !state.get_boolean()));
-    },
+    }
 
-    _createMiners: function(callback) {
+    _createMiners(callback) {
         let count = 3;
 
         this.gdataMiner = new Miners.GDataMiner(Lang.bind(this,
@@ -217,9 +216,9 @@ var Application = new Lang.Class({
                 if (count == 0)
                     callback();
             }));
-    },
+    }
 
-    _refreshMinerNow: function(miner) {
+    _refreshMinerNow(miner) {
         let env = GLib.getenv('DOCUMENTS_DISABLE_MINERS');
         if (env)
             return false;
@@ -253,9 +252,9 @@ var Application = new Lang.Class({
             }));
 
         return false;
-    },
+    }
 
-    _refreshMiners: function() {
+    _refreshMiners() {
         if (sourceManager.hasProviderType('google')) {
             try {
                 // startup a refresh of the gdocs cache
@@ -282,9 +281,9 @@ var Application = new Lang.Class({
                 logError(e, 'Unable to start Zpj miner');
             }
         }
-    },
+    }
 
-    _startMiners: function() {
+    _startMiners() {
         this._createMiners(Lang.bind(this,
             function() {
                 this._refreshMiners();
@@ -294,9 +293,9 @@ var Application = new Lang.Class({
                 this._sourceRemovedId = sourceManager.connect('item-removed',
                                                               Lang.bind(this, this._refreshMiners));
             }));
-    },
+    }
 
-    _stopMiners: function() {
+    _stopMiners() {
         if (this._sourceAddedId != 0) {
             sourceManager.disconnect(this._sourceAddedId);
             this._sourceAddedId = 0;
@@ -316,9 +315,9 @@ var Application = new Lang.Class({
         this.gdataMiner = null;
         this.owncloudMiner = null;
         this.zpjMiner = null;
-    },
+    }
 
-    _themeChanged: function(gtkSettings) {
+    _themeChanged(gtkSettings) {
         let screen = Gdk.Screen.get_default();
 
         if (gtkSettings.gtk_theme_name == 'Adwaita') {
@@ -334,11 +333,11 @@ var Application = new Lang.Class({
         } else if (cssProvider != null) {
             Gtk.StyleContext.remove_provider_for_screen(screen, cssProvider);
         }
-    },
+    }
 
-    vfunc_startup: function() {
+    vfunc_startup() {
         application = this;
-        this.parent();
+        super.vfunc_startup();
         String.prototype.format = Format.format;
 
         EvDoc.init();
@@ -396,9 +395,9 @@ var Application = new Lang.Class({
         ];
 
         Utils.populateActionGroup(this, actionEntries, 'app');
-    },
+    }
 
-    _createWindow: function() {
+    _createWindow() {
         if (this._mainWindow)
             return;
 
@@ -417,10 +416,10 @@ var Application = new Lang.Class({
 
         // start miners
         this._startMiners();
-    },
+    }
 
-    vfunc_dbus_register: function(connection, path) {
-        this.parent(connection, path);
+    vfunc_dbus_register(connection, path) {
+        super.vfunc_dbus_register(connection, path);
 
         if (this._searchProvider != null)
             throw(new Error('ShellSearchProvider already instantiated - dbus_register called twice?'));
@@ -437,27 +436,27 @@ var Application = new Lang.Class({
         }
 
         return true;
-    },
+    }
 
-    vfunc_dbus_unregister: function(connection, path) {
+    vfunc_dbus_unregister(connection, path) {
         if (this._searchProvider != null) {
             this._searchProvider.unexport(connection);
             this._searchProvider = null;
         }
 
-        this.parent(connection, path);
-    },
+        super.vfunc_dbus_unregister(connection, path);
+    }
 
-    vfunc_handle_local_options: function(options) {
+    vfunc_handle_local_options(options) {
         if (options.contains('version')) {
             print(pkg.version);
             return 0;
         }
 
         return -1;
-    },
+    }
 
-    vfunc_activate: function() {
+    vfunc_activate() {
         if (!this._mainWindow) {
             this._createWindow();
             modeController.setWindowMode(WindowMode.WindowMode.DOCUMENTS);
@@ -465,9 +464,9 @@ var Application = new Lang.Class({
 
         this._mainWindow.present_with_time(this._activationTimestamp);
         this._activationTimestamp = Gdk.CURRENT_TIME;
-    },
+    }
 
-    _clearState: function() {
+    _clearState() {
         // clean up signals
         changeMonitor.disconnectAll();
         documentManager.disconnectAll();
@@ -492,17 +491,17 @@ var Application = new Lang.Class({
 
         if (this._extractPriority)
             this._extractPriority.ClearRdfTypesRemote();
-    },
+    }
 
-    _onWindowDestroy: function(window) {
+    _onWindowDestroy(window) {
         this._mainWindow = null;
 
         // clear our state in an idle, so other handlers connected
         // to 'destroy' have the chance to perform their cleanups first
         Mainloop.idle_add(Lang.bind(this, this._clearState));
-    },
+    }
 
-    _onActivateResult: function(provider, urn, terms, timestamp) {
+    _onActivateResult(provider, urn, terms, timestamp) {
         this._createWindow();
 
         let doc = documentManager.getItemById(urn);
@@ -534,26 +533,26 @@ var Application = new Lang.Class({
                     }
                 }));
         }
-    },
+    }
 
-    _onLaunchSearch: function(provider, terms, timestamp) {
+    _onLaunchSearch(provider, terms, timestamp) {
         this._createWindow();
         modeController.setWindowMode(WindowMode.WindowMode.DOCUMENTS);
         searchController.setString(terms.join(' '));
 
         this._activationTimestamp = timestamp;
         this.activate();
-    },
+    }
 
-    getScaleFactor: function() {
+    getScaleFactor() {
         let scaleFactor = 1;
         if (this._mainWindow)
             scaleFactor = this._mainWindow.get_scale_factor();
 
         return scaleFactor;
-    },
+    }
 
-    getGdkWindow: function() {
+    getGdkWindow() {
         let window = null;
         if (this._mainWindow)
             window = this._mainWindow.get_window();
diff --git a/src/changeMonitor.js b/src/changeMonitor.js
index a9e3a5ba..a127bda9 100644
--- a/src/changeMonitor.js
+++ b/src/changeMonitor.js
@@ -20,6 +20,7 @@
  */
 
 const Gio = imports.gi.Gio;
+const GObject = imports.gi.GObject;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 const Signals = imports.signals;
@@ -51,10 +52,10 @@ var ChangeEventType = {
 
 const _RDF_TYPE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";;
 
-const ChangeEvent = new Lang.Class({
-    Name: 'ChangeEvent',
+const ChangeEvent = GObject.registerClass(
+    class ChangeEvent extends GObject.Object {
 
-    _init: function(urnId, predicateId, isDelete) {
+    _init(urnId, predicateId, isDelete) {
         this.urnId = urnId;
         this.predicateId = predicateId;
 
@@ -62,17 +63,17 @@ const ChangeEvent = new Lang.Class({
             this.type = ChangeEventType.DELETED;
         else
             this.type = ChangeEventType.CREATED;
-    },
+    }
 
-    setResolvedValues: function(urn, predicate) {
+    setResolvedValues(urn, predicate) {
         this.urn = urn;
         this.predicate = predicate;
 
         if (predicate != _RDF_TYPE)
             this.type = ChangeEventType.CHANGED;
-    },
+    }
 
-    merge: function(event) {
+    merge(event) {
         // deletions or creations override the current type
         if (event.type == ChangeEventType.DELETED ||
             event.type == ChangeEventType.CREATED) {
@@ -84,10 +85,10 @@ const ChangeEvent = new Lang.Class({
 const CHANGE_MONITOR_TIMEOUT = 500; // msecs
 const CHANGE_MONITOR_MAX_ITEMS = 500; // items
 
-var TrackerChangeMonitor = new Lang.Class({
-    Name: 'TrackerChangeMonitor',
+var TrackerChangeMonitor = GObject.registerClass(
+    class TrackerChangeMonitor extends GObject.Object {
 
-    _init: function() {
+    _init() {
         this._pendingChanges = {};
         this._unresolvedIds = {};
 
@@ -96,9 +97,9 @@ var TrackerChangeMonitor = new Lang.Class({
 
         this._resourceService = new TrackerResourcesService();
         this._resourceService.connectSignal('GraphUpdated', Lang.bind(this, this._onGraphUpdated));
-    },
+    }
 
-    _onGraphUpdated: function(proxy, senderName, [className, deleteEvents, insertEvents]) {
+    _onGraphUpdated(proxy, senderName, [className, deleteEvents, insertEvents]) {
         deleteEvents.forEach(Lang.bind(this,
             function(event) {
                 this._addPendingEvent(event, true);
@@ -108,9 +109,9 @@ var TrackerChangeMonitor = new Lang.Class({
             function(event) {
                 this._addPendingEvent(event, false);
             }));
-    },
+    }
 
-    _addPendingEvent: function(event, isDelete) {
+    _addPendingEvent(event, isDelete) {
         if (this._pendingEventsId != 0)
             Mainloop.source_remove(this._pendingEventsId);
 
@@ -123,9 +124,9 @@ var TrackerChangeMonitor = new Lang.Class({
         else
             this._pendingEventsId =
                 Mainloop.timeout_add(CHANGE_MONITOR_TIMEOUT, Lang.bind(this, this._processEvents));
-    },
+    }
 
-    _processEvents: function() {
+    _processEvents() {
         let events = this._pendingEvents;
         let idTable = this._unresolvedIds;
 
@@ -170,9 +171,9 @@ var TrackerChangeMonitor = new Lang.Class({
             }));
 
         return false;
-    },
+    }
 
-    _addEvent: function(event) {
+    _addEvent(event) {
         let urn = event.urn;
         let oldEvent = this._pendingChanges[urn];
 
@@ -182,9 +183,9 @@ var TrackerChangeMonitor = new Lang.Class({
         } else {
             this._pendingChanges[urn] = event;
         }
-    },
+    }
 
-    _sendEvents: function(events, idTable) {
+    _sendEvents(events, idTable) {
         events.forEach(Lang.bind(this,
             function(event) {
                 event.setResolvedValues(idTable[event.urnId], idTable[event.predicateId]);
diff --git a/src/documents.js b/src/documents.js
index a8e385c1..4f39e3ce 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -29,6 +29,7 @@ const GdPrivate = imports.gi.GdPrivate;
 const Gdk = imports.gi.Gdk;
 const GData = imports.gi.GData;
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const GnomeDesktop = imports.gi.GnomeDesktop;
 const Gtk = imports.gi.Gtk;
 const Zpj = imports.gi.Zpj;
@@ -48,15 +49,15 @@ const TrackerUtils = imports.trackerUtils;
 const Utils = imports.utils;
 const WindowMode = imports.windowMode;
 
-const DeleteItemJob = new Lang.Class({
-    Name: 'DeleteItemJob',
-// deletes the given resource
+const DeleteItemJob = GObject.registerClass(
+    class DeleteItemJob extends GObject.Object {
+    // deletes the given resource
 
-    _init: function(urn) {
+    _init(urn) {
         this._urn = urn;
-    },
+    }
 
-    run: function(callback) {
+    run(callback) {
         this._callback = callback;
 
         let query = Application.queryBuilder.buildDeleteResourceQuery(this._urn);
@@ -75,23 +76,23 @@ const DeleteItemJob = new Lang.Class({
 });
 
 
-const CollectionIconWatcher = new Lang.Class({
-    Name: 'CollectionIconWatcher',
+const CollectionIconWatcher = GObject.registerClass(
+    class CollectionIconWatcher extends GObject.Object {
 
-    _init: function(collection) {
+    _init(collection) {
         this._collection = collection;
         this._pixbuf = null;
 
         this._start();
-    },
+    }
 
-    _clear: function() {
+    _clear() {
         this._docConnections = {};
         this._urns = [];
         this._docs = [];
-    },
+    }
 
-    _start: function() {
+    _start() {
         this._clear();
 
         let query = Application.queryBuilder.buildCollectionIconQuery(this._collection.id);
@@ -107,9 +108,9 @@ const CollectionIconWatcher = new Lang.Class({
 
                 cursor.next_async(null, Lang.bind(this, this._onCursorNext));
             }));
-    },
+    }
 
-    _onCursorNext: function(cursor, res) {
+    _onCursorNext(cursor, res) {
         let valid = false;
 
         try {
@@ -131,9 +132,9 @@ const CollectionIconWatcher = new Lang.Class({
         this._urns.push(urn);
 
         cursor.next_async(null, Lang.bind(this, this._onCursorNext));
-    },
+    }
 
-    _onCollectionIconFinished: function() {
+    _onCollectionIconFinished() {
         if (!this._urns.length)
             return;
 
@@ -168,16 +169,16 @@ const CollectionIconWatcher = new Lang.Class({
                         this._toQueryCollector();
                     }));
             }));
-    },
+    }
 
-    _toQueryCollector: function() {
+    _toQueryCollector() {
         this._toQueryRemaining--;
 
         if (!this._toQueryRemaining)
             this._allDocsReady();
-    },
+    }
 
-    _allDocsReady: function() {
+    _allDocsReady() {
         this._docs.forEach(Lang.bind(this,
             function(doc) {
                 let updateId = doc.connect('info-updated',
@@ -186,9 +187,9 @@ const CollectionIconWatcher = new Lang.Class({
             }));
 
         this._createCollectionIcon();
-    },
+    }
 
-    _createCollectionIcon: function() {
+    _createCollectionIcon() {
         // now this._docs has an array of Document objects from which we will create the
         // collection icon
         let pixbufs = [];
@@ -208,30 +209,30 @@ const CollectionIconWatcher = new Lang.Class({
             Utils.getIconSize() * Application.application.getScaleFactor(),
             pixbufs);
         this._emitRefresh();
-    },
+    }
 
-    _emitRefresh: function() {
+    _emitRefresh() {
         this.emit('icon-updated', this._pixbuf);
-    },
+    }
 
-    destroy: function() {
+    destroy() {
         for (let id in this._docConnections) {
             let doc = this._docConnections[id];
             doc.disconnect(id);
         }
-    },
+    }
 
-    refresh: function() {
+    refresh() {
         this.destroy();
         this._start();
     }
 });
 Signals.addSignalMethods(CollectionIconWatcher.prototype);
 
-const DocCommon = new Lang.Class({
-    Name: 'DocCommon',
+const DocCommon = GObject.registerClass(
+    class DocCommon extends GObject.Object {
 
-    _init: function(cursor) {
+    _init(cursor) {
         this.id = null;
         this.uri = null;
         this.uriToLoad = null;
@@ -264,9 +265,9 @@ const DocCommon = new Lang.Class({
         this._refreshIconId =
             Application.settings.connect('changed::view-as',
                                          Lang.bind(this, this.refreshIcon));
-    },
+    }
 
-    refresh: function() {
+    refresh() {
         let job = new TrackerUtils.SingleItemJob(this.id, Application.queryBuilder);
         job.run(Query.QueryFlags.NONE, Lang.bind(this,
             function(cursor) {
@@ -275,13 +276,13 @@ const DocCommon = new Lang.Class({
 
                 this.populateFromCursor(cursor);
             }));
-    },
+    }
 
-    _sanitizeTitle: function() {
+    _sanitizeTitle() {
         this.name = this.name.replace(/Microsoft Word - /g, '');
-    },
+    }
 
-    populateFromCursor: function(cursor) {
+    populateFromCursor(cursor) {
         this.uri = cursor.get_string(Query.QueryColumns.URI)[0];
         this.id = cursor.get_string(Query.QueryColumns.URN)[0];
         this.identifier = cursor.get_string(Query.QueryColumns.IDENTIFIER)[0];
@@ -325,9 +326,9 @@ const DocCommon = new Lang.Class({
         this._sanitizeTitle();
 
         this.refreshIcon();
-    },
+    }
 
-    updateIconFromType: function() {
+    updateIconFromType() {
         let icon = null;
 
         if (this.mimeType)
@@ -350,9 +351,9 @@ const DocCommon = new Lang.Class({
                 logError(e, 'Unable to load pixbuf');
             }
         }
-    },
+    }
 
-    _refreshCollectionIcon: function() {
+    _refreshCollectionIcon() {
         if (!this._collectionIconWatcher) {
             this._collectionIconWatcher = new CollectionIconWatcher(this);
 
@@ -363,16 +364,16 @@ const DocCommon = new Lang.Class({
         } else {
             this._collectionIconWatcher.refresh();
         }
-    },
+    }
 
-    download: function(useCache, cancellable, callback) {
+    download(useCache, cancellable, callback) {
         let localFile = Gio.File.new_for_uri(this.uriToLoad);
         let localPath = localFile.get_path();
         let localDir = GLib.path_get_dirname(localPath);
         GLib.mkdir_with_parents(localDir, 448);
 
         if (!useCache) {
-            Utils.debug('Downloading ' + this.__name__ + ' ' + this.id + ' to ' + this.uriToLoad +
+            Utils.debug('Downloading ' + this.constructor.name + ' ' + this.id + ' to ' + this.uriToLoad +
                         ': bypass cache ');
             this.downloadImpl(localFile, cancellable, callback);
             return;
@@ -389,7 +390,7 @@ const DocCommon = new Lang.Class({
                 try {
                     info = object.query_info_finish(res);
                 } catch (e) {
-                    Utils.debug('Downloading ' + this.__name__ + ' ' + this.id + ' to ' + this.uriToLoad +
+                    Utils.debug('Downloading ' + this.constructor.name + ' ' + this.id + ' to ' + 
this.uriToLoad +
                                 ': cache miss');
                     this.downloadImpl(localFile, cancellable, callback);
                     return;
@@ -401,18 +402,18 @@ const DocCommon = new Lang.Class({
                     return;
                 }
 
-                Utils.debug('Downloading ' + this.__name__ + ' ' + this.id + ' to ' + this.uriToLoad +
+                Utils.debug('Downloading ' + this.constructor.name + ' ' + this.id + ' to ' + this.uriToLoad 
+
                             ': cache stale (' + this.mtime + ' > ' + cacheMtime + ')');
                 this.downloadImpl(localFile, cancellable, callback);
             }));
-    },
+    }
 
-    downloadImpl: function(localFile, cancellable, callback) {
+    downloadImpl(localFile, cancellable, callback) {
         throw(new Error('DocCommon implementations must override downloadImpl'));
-    },
+    }
 
-    load: function(passwd, cancellable, callback) {
-        Utils.debug('Loading ' + this.__name__ + ' ' + this.id);
+    load(passwd, cancellable, callback) {
+        Utils.debug('Loading ' + this.constructor.name + ' ' + this.id);
 
         if (this.collection) {
             Mainloop.idle_add(Lang.bind(this,
@@ -458,21 +459,21 @@ const DocCommon = new Lang.Class({
                         callback(this, docModel, null);
                     }));
             }));
-    },
+    }
 
-    canEdit: function() {
+    canEdit() {
         throw(new Error('DocCommon implementations must override canEdit'));
-    },
+    }
 
-    canShare: function() {
+    canShare() {
         throw(new Error('DocCommon implementations must override canShare'));
-    },
+    }
 
-    canTrash: function() {
+    canTrash() {
         throw(new Error('DocCommon implementations must override canTrash'));
-    },
+    }
 
-    canPrint: function(docModel) {
+    canPrint(docModel) {
         if (this.collection)
             return false;
 
@@ -480,9 +481,9 @@ const DocCommon = new Lang.Class({
             return false;
 
         return EvView.PrintOperation.exists_for_document(docModel.get_document());
-    },
+    }
 
-    trash: function() {
+    trash() {
         if (!this.canTrash())
             return;
 
@@ -490,17 +491,17 @@ const DocCommon = new Lang.Class({
 
         let job = new DeleteItemJob(this.id);
         job.run(null);
-    },
+    }
 
-    trashImpl: function() {
+    trashImpl() {
         throw(new Error('DocCommon implementations must override trashImpl'));
-    },
+    }
 
-    createThumbnail: function(callback) {
+    createThumbnail(callback) {
         throw(new Error('DocCommon implementations must override createThumbnail'));
-    },
+    }
 
-    refreshIcon: function() {
+    refreshIcon() {
         if (this._thumbPath) {
             this._refreshThumbPath();
             return;
@@ -522,9 +523,9 @@ const DocCommon = new Lang.Class({
                                     GLib.PRIORITY_DEFAULT,
                                     null,
                                     Lang.bind(this, this._onFileQueryInfo));
-    },
+    }
 
-    _onFileQueryInfo: function(object, res) {
+    _onFileQueryInfo(object, res) {
         let info = null;
         let haveNewIcon = false;
 
@@ -542,9 +543,9 @@ const DocCommon = new Lang.Class({
         } else {
             this.createThumbnail(Lang.bind(this, this._onCreateThumbnail));
         }
-    },
+    }
 
-    _onCreateThumbnail: function(thumbnailed) {
+    _onCreateThumbnail(thumbnailed) {
         if (!thumbnailed) {
             this._failedThumbnailing = true;
             return;
@@ -556,9 +557,9 @@ const DocCommon = new Lang.Class({
                                     GLib.PRIORITY_DEFAULT,
                                     null,
                                     Lang.bind(this, this._onThumbnailPathInfo));
-    },
+    }
 
-    _onThumbnailPathInfo: function(object, res) {
+    _onThumbnailPathInfo(object, res) {
         let info = null;
 
         try {
@@ -574,9 +575,9 @@ const DocCommon = new Lang.Class({
             this._refreshThumbPath();
         else
             this._failedThumbnailing = true;
-    },
+    }
 
-    _refreshThumbPath: function() {
+    _refreshThumbPath() {
         let thumbFile = Gio.file_new_for_path(this._thumbPath);
 
         thumbFile.read_async(GLib.PRIORITY_DEFAULT, null, Lang.bind(this,
@@ -618,16 +619,16 @@ const DocCommon = new Lang.Class({
                             this._setOrigPixbuf(pixbuf);
                         }));
             }));
-    },
+    }
 
-    _updateInfoFromType: function() {
+    _updateInfoFromType() {
         if (this.rdfType.indexOf('nfo#DataContainer') != -1)
             this.collection = true;
 
         this.updateTypeDescription();
-    },
+    }
 
-    _createSymbolicEmblem: function(name) {
+    _createSymbolicEmblem(name) {
         let pix = Gd.create_symbolic_icon(name, Utils.getIconSize() *
                                           Application.application.getScaleFactor());
 
@@ -635,17 +636,17 @@ const DocCommon = new Lang.Class({
             pix = new Gio.ThemedIcon({ name: name });
 
         return pix;
-    },
+    }
 
-    _setOrigPixbuf: function(pixbuf) {
+    _setOrigPixbuf(pixbuf) {
         if (pixbuf) {
             this.origPixbuf = pixbuf;
         }
 
         this._checkEffectsAndUpdateInfo();
-    },
+    }
 
-    _checkEffectsAndUpdateInfo: function() {
+    _checkEffectsAndUpdateInfo() {
         if (!this.origPixbuf)
             return;
 
@@ -694,19 +695,19 @@ const DocCommon = new Lang.Class({
             Application.application.getGdkWindow());
 
         this.emit('info-updated');
-    },
+    }
 
-    destroy: function() {
+    destroy() {
         if (this._collectionIconWatcher) {
             this._collectionIconWatcher.destroy();
             this._collectionIconWatcher = null;
         }
 
         Application.settings.disconnect(this._refreshIconId);
-    },
+    }
 
-    loadLocal: function(passwd, cancellable, callback) {
-        Utils.debug('Loading ' + this.__name__ + ' ' + this.id + ' from ' + this.uriToLoad);
+    loadLocal(passwd, cancellable, callback) {
+        Utils.debug('Loading ' + this.constructor.name + ' ' + this.id + ' from ' + this.uriToLoad);
 
         if (LOKView.isOpenDocumentFormat(this.mimeType)) {
             let exception = null;
@@ -728,9 +729,9 @@ const DocCommon = new Lang.Class({
                     callback(this, null, e);
                 }
             }));
-    },
+    }
 
-    open: function(parent, timestamp) {
+    open(parent, timestamp) {
         if (!this.defaultAppName)
             return;
 
@@ -744,9 +745,9 @@ const DocCommon = new Lang.Class({
         } catch (e) {
             logError(e, 'Unable to show URI ' + this.uri);
         }
-    },
+    }
 
-    print: function(toplevel) {
+    print(toplevel) {
         this.load(null, null, Lang.bind(this,
             function(doc, docModel, error) {
                 if (error) {
@@ -790,32 +791,31 @@ const DocCommon = new Lang.Class({
 
                 printOp.run(toplevel);
             }));
-    },
+    }
 
-    getSourceLink: function() {
+    getSourceLink() {
         // This should return an array of URI and source name
         log('Error: DocCommon implementations must override getSourceLink');
-    },
+    }
 
-    getWhere: function() {
+    getWhere() {
         let retval = '';
 
         if (this.collection)
             retval = '{ ?urn nie:isPartOf <' + this.id + '> }';
 
         return retval;
-    },
+    }
 });
 Signals.addSignalMethods(DocCommon.prototype);
 
-var LocalDocument = new Lang.Class({
-    Name: 'LocalDocument',
-    Extends: DocCommon,
+var LocalDocument = GObject.registerClass(
+    class LocalDocument extends DocCommon {
 
-    _init: function(cursor) {
+    _init(cursor) {
         this._failedThumbnailing = false;
 
-        this.parent(cursor);
+        super._init(cursor);
 
         this.sourceName = _("Local");
 
@@ -846,10 +846,10 @@ var LocalDocument = new Lang.Class({
 
         if (this.defaultApp)
             this.defaultAppName = this.defaultApp.get_name();
-    },
+    }
 
-    populateFromCursor: function(cursor) {
-        this.parent(cursor);
+    populateFromCursor(cursor) {
+        super.populateFromCursor(cursor);
         this.uriToLoad = this.uri;
 
         if (!Application.application.gettingStartedLocation)
@@ -863,9 +863,9 @@ var LocalDocument = new Lang.Class({
             this.author = _("GNOME");
             this.name = this.title = _("Getting Started with Documents");
         }
-    },
+    }
 
-    createThumbnail: function(callback) {
+    createThumbnail(callback) {
         GdPrivate.queue_thumbnail_job_for_file_async(this._file, Lang.bind(this,
             function(object, res) {
                 let thumbnailed = false;
@@ -880,9 +880,9 @@ var LocalDocument = new Lang.Class({
 
                 callback(thumbnailed);
             }));
-    },
+    }
 
-    updateTypeDescription: function() {
+    updateTypeDescription() {
         let description = '';
 
         if (this.collection)
@@ -891,14 +891,14 @@ var LocalDocument = new Lang.Class({
             description = Gio.content_type_get_description(this.mimeType);
 
         this.typeDescription = description;
-    },
+    }
 
-    downloadImpl: function(localFile, cancellable, callback) {
+    downloadImpl(localFile, cancellable, callback) {
         throw(new Error('LocalDocuments need not be downloaded'));
-    },
+    }
 
-    load: function(passwd, cancellable, callback) {
-        Utils.debug('Loading ' + this.__name__ + ' ' + this.id);
+    load(passwd, cancellable, callback) {
+        Utils.debug('Loading ' + this.constructor.name + ' ' + this.id);
 
         if (this.collection) {
             Mainloop.idle_add(Lang.bind(this,
@@ -914,21 +914,21 @@ var LocalDocument = new Lang.Class({
         }
 
         this.loadLocal(passwd, cancellable, callback);
-    },
+    }
 
-    canEdit: function() {
+    canEdit() {
         return this.collection;
-    },
+    }
 
-    canShare: function() {
+    canShare() {
         return false;
-    },
+    }
 
-    canTrash: function() {
+    canTrash() {
         return true;
-    },
+    }
 
-    trashImpl: function() {
+    trashImpl() {
         if (this.collection)
             return;
 
@@ -941,9 +941,9 @@ var LocalDocument = new Lang.Class({
                     logError(e, 'Unable to trash ' + this.uri);
                 }
             }));
-    },
+    }
 
-    getSourceLink: function() {
+    getSourceLink() {
         if (this.collection)
             return [ null, this.sourceName ];
 
@@ -957,21 +957,20 @@ var LocalDocument = new Lang.Class({
 
 const GOOGLE_PREFIX = 'google:drive:';
 
-const GoogleDocument = new Lang.Class({
-    Name: 'GoogleDocument',
-    Extends: DocCommon,
+const GoogleDocument = GObject.registerClass(
+    class GoogleDocument extends DocCommon {
 
-    _init: function(cursor) {
+    _init(cursor) {
         this._failedThumbnailing = false;
 
-        this.parent(cursor);
+        super._init(cursor);
 
         // overridden
         this.defaultAppName = _("Google Docs");
         this.sourceName = _("Google");
-    },
+    }
 
-    createGDataEntry: function(cancellable, callback) {
+    createGDataEntry(cancellable, callback) {
         let source = Application.sourceManager.getItemById(this.resourceUrn);
 
         let authorizer = new GData.GoaAuthorizer({ goa_object: source.object });
@@ -995,9 +994,9 @@ const GoogleDocument = new Lang.Class({
 
                      callback(entry, service, exception);
                  }));
-    },
+    }
 
-    downloadImpl: function(localFile, cancellable, callback) {
+    downloadImpl(localFile, cancellable, callback) {
         this.createGDataEntry(cancellable, Lang.bind(this,
             function(entry, service, error) {
                 if (error) {
@@ -1050,9 +1049,9 @@ const GoogleDocument = new Lang.Class({
                             }));
                     }));
             }))
-    },
+    }
 
-    createThumbnail: function(callback) {
+    createThumbnail(callback) {
         this.createGDataEntry(null, Lang.bind(this,
             function(entry, service, exception) {
                 if (exception) {
@@ -1104,9 +1103,9 @@ const GoogleDocument = new Lang.Class({
                                     }));
                         }));
             }));
-    },
+    }
 
-    updateTypeDescription: function() {
+    updateTypeDescription() {
         let description;
 
         if (this.collection)
@@ -1119,12 +1118,12 @@ const GoogleDocument = new Lang.Class({
             description = _("Document");
 
         this.typeDescription = description;
-    },
+    }
 
-    populateFromCursor: function(cursor) {
+    populateFromCursor(cursor) {
         this.shared = cursor.get_boolean(Query.QueryColumns.SHARED);
 
-        this.parent(cursor);
+        super.populateFromCursor(cursor);
 
         let localDir = GLib.build_filenamev([GLib.get_user_cache_dir(), "gnome-documents", "google"]);
 
@@ -1134,21 +1133,21 @@ const GoogleDocument = new Lang.Class({
         let localPath = GLib.build_filenamev([localDir, localFilename]);
         let localFile = Gio.File.new_for_path(localPath);
         this.uriToLoad = localFile.get_uri();
-    },
+    }
 
-    canEdit: function() {
+    canEdit() {
         return !this.collection;
-    },
+    }
 
-    canShare: function() {
+    canShare() {
         return true;
-    },
+    }
 
-    canTrash: function() {
+    canTrash() {
         return false;
-    },
+    }
 
-    getSourceLink: function() {
+    getSourceLink() {
         let uri = 'http://docs.google.com/';
         return [ uri, this.sourceName ];
     }
@@ -1156,14 +1155,13 @@ const GoogleDocument = new Lang.Class({
 
 const OWNCLOUD_PREFIX = 'owncloud:';
 
-const OwncloudDocument = new Lang.Class({
-    Name: 'OwncloudDocument',
-    Extends: DocCommon,
+const OwncloudDocument = GObject.registerClass(
+    class OwncloudDocument extends DocCommon {
 
-    _init: function(cursor) {
+    _init(cursor) {
         this._failedThumbnailing = true;
 
-        this.parent(cursor);
+        super._init(cursor);
 
         // overridden
         this.sourceName = _("ownCloud");
@@ -1173,10 +1171,10 @@ const OwncloudDocument = new Lang.Class({
 
         if (this.defaultApp)
             this.defaultAppName = this.defaultApp.get_name();
-    },
+    }
 
-    populateFromCursor: function(cursor) {
-        this.parent(cursor);
+    populateFromCursor(cursor) {
+        super.populateFromCursor(cursor);
 
         let localDir = GLib.build_filenamev([GLib.get_user_cache_dir(), "gnome-documents", "owncloud"]);
 
@@ -1188,9 +1186,9 @@ const OwncloudDocument = new Lang.Class({
         let localPath = GLib.build_filenamev([localDir, localFilename]);
         let localFile = Gio.File.new_for_path(localPath);
         this.uriToLoad = localFile.get_uri();
-    },
+    }
 
-    createThumbnail: function(callback) {
+    createThumbnail(callback) {
         GdPrivate.queue_thumbnail_job_for_file_async(this._file, Lang.bind(this,
             function(object, res) {
                 let thumbnailed = false;
@@ -1205,9 +1203,9 @@ const OwncloudDocument = new Lang.Class({
 
                 callback(thumbnailed);
             }));
-    },
+    }
 
-    updateTypeDescription: function() {
+    updateTypeDescription() {
         let description = '';
 
         if (this.collection)
@@ -1216,9 +1214,9 @@ const OwncloudDocument = new Lang.Class({
             description = Gio.content_type_get_description(this.mimeType);
 
         this.typeDescription = description;
-    },
+    }
 
-    downloadImpl: function(localFile, cancellable, callback) {
+    downloadImpl(localFile, cancellable, callback) {
         let remoteFile = Gio.File.new_for_uri(this.uri);
         remoteFile.read_async(GLib.PRIORITY_DEFAULT, cancellable, Lang.bind(this,
             function(object, res) {
@@ -1265,21 +1263,21 @@ const OwncloudDocument = new Lang.Class({
                             }));
                     }));
             }));
-    },
+    }
 
-    canEdit: function() {
+    canEdit() {
         return false;
-    },
+    }
 
-    canShare: function() {
+    canShare() {
         return false;
-    },
+    }
 
-    canTrash: function() {
+    canTrash() {
         return false;
-    },
+    }
 
-    getSourceLink: function() {
+    getSourceLink() {
         let source = Application.sourceManager.getItemById(this.resourceUrn);
         let account = source.object.get_account();
         let presentationIdentity = account.presentation_identity;
@@ -1290,22 +1288,21 @@ const OwncloudDocument = new Lang.Class({
 
 const SKYDRIVE_PREFIX = 'windows-live:skydrive:';
 
-const SkydriveDocument = new Lang.Class({
-    Name: 'SkydriveDocument',
-    Extends: DocCommon,
+const SkydriveDocument = GObject.registerClass(
+    class SkydriveDocument extends DocCommon {
 
-    _init: function(cursor) {
+    _init(cursor) {
         this._failedThumbnailing = true;
 
-        this.parent(cursor);
+        super._init(cursor);
 
         // overridden
         this.defaultAppName = _("OneDrive");
         this.sourceName = _("OneDrive");
-    },
+    }
 
-    populateFromCursor: function(cursor) {
-        this.parent(cursor);
+    populateFromCursor(cursor) {
+        super.populateFromCursor(cursor);
 
         let localDir = GLib.build_filenamev([GLib.get_user_cache_dir(), "gnome-documents", "skydrive"]);
 
@@ -1317,9 +1314,9 @@ const SkydriveDocument = new Lang.Class({
         let localPath = GLib.build_filenamev([localDir, localFilename]);
         let localFile = Gio.File.new_for_path(localPath);
         this.uriToLoad = localFile.get_uri();
-    },
+    }
 
-    _createZpjEntry: function(cancellable, callback) {
+    _createZpjEntry(cancellable, callback) {
         let source = Application.sourceManager.getItemById(this.resourceUrn);
 
         let authorizer = new Zpj.GoaAuthorizer({ goa_object: source.object });
@@ -1341,9 +1338,9 @@ const SkydriveDocument = new Lang.Class({
 
                      callback(entry, service, exception);
                  }));
-    },
+    }
 
-    downloadImpl: function(localFile, cancellable, callback) {
+    downloadImpl(localFile, cancellable, callback) {
         this._createZpjEntry(cancellable, Lang.bind(this,
             function(entry, service, error) {
                 if (error) {
@@ -1399,9 +1396,9 @@ const SkydriveDocument = new Lang.Class({
                             }));
                     }));
             }));
-    },
+    }
 
-    updateTypeDescription: function() {
+    updateTypeDescription() {
         let description;
 
         if (this.collection)
@@ -1414,32 +1411,31 @@ const SkydriveDocument = new Lang.Class({
             description = _("Document");
 
         this.typeDescription = description;
-    },
+    }
 
-    canEdit: function() {
+    canEdit() {
         return false;
-    },
+    }
 
-    canShare: function() {
+    canShare() {
         return false;
-    },
+    }
 
-    canTrash: function() {
+    canTrash() {
         return false;
-    },
+    }
 
-    getSourceLink: function() {
+    getSourceLink() {
         let uri = 'https://onedrive.live.com';
         return [ uri, this.sourceName ];
     }
 });
 
-var DocumentManager = new Lang.Class({
-    Name: 'DocumentManager',
-    Extends: Manager.BaseManager,
+var DocumentManager = GObject.registerClass(
+    class DocumentManager extends Manager.BaseManager {
 
-    _init: function() {
-        this.parent();
+    _init() {
+        super._init();
 
         this._loaderCancellable = null;
 
@@ -1452,9 +1448,9 @@ var DocumentManager = new Lang.Class({
 
         Application.changeMonitor.connect('changes-pending',
                                           Lang.bind(this, this._onChangesPending));
-    },
+    }
 
-    _onChangesPending: function(monitor, changes) {
+    _onChangesPending(monitor, changes) {
         for (let idx in changes) {
             let changeEvent = changes[idx];
 
@@ -1474,9 +1470,9 @@ var DocumentManager = new Lang.Class({
                 }
             }
         }
-    },
+    }
 
-    _onDocumentCreated: function(urn) {
+    _onDocumentCreated(urn) {
         let job = new TrackerUtils.SingleItemJob(urn, Application.queryBuilder);
         job.run(Query.QueryFlags.NONE, Lang.bind(this,
             function(cursor) {
@@ -1485,24 +1481,24 @@ var DocumentManager = new Lang.Class({
 
                 this.addDocumentFromCursor(cursor);
             }));
-    },
+    }
 
-    _identifierIsGoogle: function(identifier) {
+    _identifierIsGoogle(identifier) {
         return (identifier &&
                 (identifier.indexOf(GOOGLE_PREFIX) != -1));
-    },
+    }
 
-    _identifierIsOwncloud: function(identifier) {
+    _identifierIsOwncloud(identifier) {
         return (identifier &&
                 (identifier.indexOf(OWNCLOUD_PREFIX) != -1));
-    },
+    }
 
-    _identifierIsSkydrive: function(identifier) {
+    _identifierIsSkydrive(identifier) {
         return (identifier &&
                 (identifier.indexOf(SKYDRIVE_PREFIX) != -1));
-    },
+    }
 
-    createDocumentFromCursor: function(cursor) {
+    createDocumentFromCursor(cursor) {
         let identifier = cursor.get_string(Query.QueryColumns.IDENTIFIER)[0];
         let doc;
 
@@ -1516,9 +1512,9 @@ var DocumentManager = new Lang.Class({
             doc = new LocalDocument(cursor);
 
         return doc;
-    },
+    }
 
-    addDocumentFromCursor: function(cursor) {
+    addDocumentFromCursor(cursor) {
         let id = cursor.get_string(Query.QueryColumns.URN)[0];
         let doc = this.getItemById(id);
 
@@ -1530,9 +1526,9 @@ var DocumentManager = new Lang.Class({
         }
 
         return doc;
-    },
+    }
 
-    addItem: function(doc) {
+    addItem(doc) {
         if (doc.collection) {
             let oldCollection = this._collections[doc.id];
             if (oldCollection)
@@ -1541,10 +1537,10 @@ var DocumentManager = new Lang.Class({
             this._collections[doc.id] = doc;
         }
 
-        this.parent(doc);
-    },
+        super.addItem(doc);
+    }
 
-    clear: function() {
+    clear() {
         this._collections = {};
         this._activeCollection = null;
 
@@ -1553,34 +1549,34 @@ var DocumentManager = new Lang.Class({
             items[idx].destroy();
         };
 
-        this.parent();
-    },
+        super.clear();
+    }
 
-    clearRowRefs: function() {
+    clearRowRefs() {
         let items = this.getItems();
         for (let idx in items) {
             items[idx].rowRefs = {};
         }
-    },
+    }
 
-    getActiveCollection: function() {
+    getActiveCollection() {
         return this._activeCollection;
-    },
+    }
 
-    getCollections: function() {
+    getCollections() {
         return this._collections;
-    },
+    }
 
-    getWhere: function() {
+    getWhere() {
         let retval = '';
 
         if (this._activeCollection)
             retval = this._activeCollection.getWhere();
 
         return retval;
-    },
+    }
 
-    _humanizeError: function(error) {
+    _humanizeError(error) {
         let message = error.message;
         if (error.domain == GData.ServiceError) {
             switch (error.code) {
@@ -1612,9 +1608,9 @@ var DocumentManager = new Lang.Class({
 
         let exception = new GLib.Error(error.domain, error.code, message);
         return exception;
-    },
+    }
 
-    _onDocumentLoadError: function(doc, error) {
+    _onDocumentLoadError(doc, error) {
         if (error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
             return;
 
@@ -1629,9 +1625,9 @@ var DocumentManager = new Lang.Class({
         let message = _("Oops! Unable to load ā€œ%sā€").format(doc.name);
         let exception = this._humanizeError(error);
         this.emit('load-error', doc, message, exception);
-    },
+    }
 
-    _onDocumentLoaded: function(doc, docModel, error) {
+    _onDocumentLoaded(doc, docModel, error) {
         this._loaderCancellable = null;
 
         if (error) {
@@ -1640,9 +1636,9 @@ var DocumentManager = new Lang.Class({
         }
 
         this.emit('load-finished', doc, docModel);
-    },
+    }
 
-    _requestPreview: function(doc) {
+    _requestPreview(doc) {
         let windowMode;
         if (LOKView.isOpenDocumentFormat(doc.mimeType)) {
             windowMode = WindowMode.WindowMode.PREVIEW_LOK;
@@ -1651,18 +1647,18 @@ var DocumentManager = new Lang.Class({
         }
 
         Application.modeController.setWindowMode(windowMode);
-    },
+    }
 
-    _loadActiveItem: function(passwd) {
+    _loadActiveItem(passwd) {
         let doc = this.getActiveItem();
 
         this._loaderCancellable = new Gio.Cancellable();
         this._requestPreview(doc);
         this.emit('load-started', doc);
         doc.load(passwd, this._loaderCancellable, Lang.bind(this, this._onDocumentLoaded));
-    },
+    }
 
-    reloadActiveItem: function(passwd) {
+    reloadActiveItem(passwd) {
         let doc = this.getActiveItem();
 
         if (!doc)
@@ -1675,17 +1671,17 @@ var DocumentManager = new Lang.Class({
         this._clearActiveDocModel();
 
         this._loadActiveItem(passwd);
-    },
+    }
 
-    removeItemById: function(id) {
+    removeItemById(id) {
         if (this._collections[id]) {
             delete this._collections[id];
         }
 
-        this.parent(id);
-    },
+        super.removeItemById(id);
+    }
 
-    setActiveItem: function(doc) {
+    setActiveItem(doc) {
         let activeCollectionChanged = false;
         let activeDoc = this.getActiveItem();
         let retval = false;
@@ -1721,7 +1717,7 @@ var DocumentManager = new Lang.Class({
             }
         }
 
-        retval = this.parent(doc);
+        retval = super.setActiveItem(doc);
 
         if (retval && activeCollectionChanged)
             this.emit('active-collection-changed', this._activeCollection);
@@ -1734,18 +1730,18 @@ var DocumentManager = new Lang.Class({
         }
 
         return retval;
-    },
+    }
 
-    activatePreviousCollection: function() {
+    activatePreviousCollection() {
         this._clearActiveDocModel();
 
         let collection = this._collectionPath.pop();
         this._activeCollection = collection;
         Manager.BaseManager.prototype.setActiveItem.call(this, collection);
         this.emit('active-collection-changed', this._activeCollection);
-    },
+    }
 
-    _clearActiveDocModel: function() {
+    _clearActiveDocModel() {
         // cancel any pending load operation
         if (this._loaderCancellable) {
             this._loaderCancellable.cancel();
diff --git a/src/edit.js b/src/edit.js
index 649698d2..1e0fe92e 100644
--- a/src/edit.js
+++ b/src/edit.js
@@ -19,6 +19,7 @@
 
 const WebKit = imports.gi.WebKit2;
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 const _ = imports.gettext.gettext;
 
@@ -31,26 +32,25 @@ const Preview = imports.preview;
 
 const _BLANK_URI = "about:blank";
 
-var EditView = new Lang.Class({
-    Name: 'EditView',
-    Extends: Preview.Preview,
+var EditView = GObject.registerClass(
+    class EditView extends Preview.Preview {
 
-    _init: function(overlay, mainWindow) {
-        this.parent(overlay, mainWindow);
+    _init(overlay, mainWindow) {
+        super._init(overlay, mainWindow);
 
         let doc = Application.documentManager.getActiveItem();
         if (doc.uri)
             this._webView.load_uri(doc.uri);
-    },
+    }
 
-    createActions: function() {
+    createActions() {
         return [
             { name: 'view-current',
               callback: Lang.bind(this, this._viewCurrent) }
         ];
-    },
+    }
 
-    createView: function() {
+    createView() {
         let overlay = new Gtk.Overlay();
 
         this._webView = new WebKit.WebView();
@@ -73,32 +73,32 @@ var EditView = new Lang.Class({
         cookie_manager.set_persistent_storage(jarfile, WebKit.CookiePersistentStorage.SQLITE);
         overlay.show_all();
         return overlay;
-    },
+    }
 
-    createToolbar: function() {
+    createToolbar() {
         return new EditToolbar(this);
-    },
+    }
 
-    onLoadStarted: function() {
+    onLoadStarted() {
         this.getAction('view-current').enabled = false;
-    },
+    }
 
-    onLoadFinished: function(manager, doc) {
+    onLoadFinished(manager, doc) {
         if (doc.uri)
             this.getAction('view-current').enabled = true;
-    },
+    }
 
-    goBack: function() {
+    goBack() {
         Application.documentManager.setActiveItem(null);
         Application.modeController.goBack(2);
-    },
+    }
 
-    _viewCurrent: function() {
+    _viewCurrent() {
         Application.modeController.goBack();
         Application.documentManager.reloadActiveItem();
-    },
+    }
 
-    _onProgressChanged: function() {
+    _onProgressChanged() {
         if (!this._webView.uri || this._webView.uri == _BLANK_URI)
             return;
 
@@ -119,21 +119,20 @@ var EditView = new Lang.Class({
         if (loading || progress == 1.0)
             value = progress;
         this._progressBar.fraction = value;
-    },
+    }
 
-    _onTimeoutExpired: function() {
+    _onTimeoutExpired() {
         this._timeoutId = 0;
         this._progressBar.hide();
         return false;
     }
 });
 
-const EditToolbar = new Lang.Class({
-    Name: 'EditToolbar',
-    Extends: Preview.PreviewToolbar,
+const EditToolbar = GObject.registerClass(
+    class EditToolbar extends Preview.PreviewToolbar {
 
-    _init: function(preview) {
-        this.parent(preview);
+    _init(preview) {
+        super._init(preview);
 
         // view button, on the right of the toolbar
         let viewButton = new Gtk.Button({ label: _("View"),
@@ -141,13 +140,13 @@ const EditToolbar = new Lang.Class({
                                           visible: true });
         viewButton.get_style_context().add_class('suggested-action');
         this.toolbar.pack_end(viewButton);
-    },
+    }
 
-    createSearchbar: function() {
+    createSearchbar() {
         return null;
-    },
+    }
 
-    handleEvent: function(event) {
+    handleEvent(event) {
         return false;
     }
 });
diff --git a/src/embed.js b/src/embed.js
index 8fd36809..0f182915 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -31,18 +31,18 @@ const Overview = imports.overview;
 const WindowMode = imports.windowMode;
 
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 const _ = imports.gettext.gettext;
 
-const View = new Lang.Class({
-    Name: 'View',
-    Extends: Gtk.Overlay,
+const View = GObject.registerClass(
+    class View extends Gtk.Overlay {
 
-    _init: function(window) {
+    _init(window) {
         this._toolbar = null;
         this._window = window;
 
-        this.parent();
+        super._init();
 
         this._stack = new Gtk.Stack({ visible: true,
                                       homogeneous: true,
@@ -53,16 +53,16 @@ const View = new Lang.Class({
         this.add_overlay(Application.notificationManager);
 
         this.show();
-    },
+    }
 
-    _clearPreview: function() {
+    _clearPreview() {
         if (this._preview) {
             this._preview.destroy();
             this._preview = null;
         }
-    },
+    }
 
-    _createPreview: function(mode) {
+    _createPreview(mode) {
         let constructor;
         switch (mode) {
         case WindowMode.WindowMode.PREVIEW_EV:
@@ -80,20 +80,20 @@ const View = new Lang.Class({
 
         this._preview = new constructor(this, this._window);
         this._stack.add_named(this._preview, 'preview');
-    },
+    }
 
-    _ensureOverview: function(mode) {
+    _ensureOverview(mode) {
         if (!this._overview) {
             this._overview = new Overview.OverviewStack();
             this._stack.add_named(this._overview, 'overview');
         }
 
         this._overview.windowMode = mode;
-    },
+    }
 
-    _onActivateResult: function() {
+    _onActivateResult() {
         this.view.activateResult();
-    },
+    }
 
     set windowMode(mode) {
         let fromPreview = !!this._preview;
@@ -136,23 +136,22 @@ const View = new Lang.Class({
                                                 Lang.bind(this, this._onActivateResult));
             this._window.get_titlebar().add(this._toolbar);
         }
-    },
+    }
 
     get toolbar() {
         return this._toolbar;
-    },
+    }
 
     get view() {
         return this._stack.visible_child;
     }
 });
 
-var Embed = new Lang.Class({
-    Name: 'Embed',
-    Extends: Gtk.Box,
+var Embed = GObject.registerClass(
+    class Embed extends Gtk.Box {
 
-    _init: function(mainWindow) {
-        this.parent({ orientation: Gtk.Orientation.VERTICAL,
+    _init(mainWindow) {
+        super._init({ orientation: Gtk.Orientation.VERTICAL,
                       visible: true });
 
         let titlebar = new Gtk.Grid({ visible: true });
@@ -173,9 +172,9 @@ var Embed = new Lang.Class({
                                              Lang.bind(this, this._onSearchChanged));
 
         this._view.windowMode = Application.modeController.getWindowMode();
-    },
+    }
 
-    _onSearchChanged: function() {
+    _onSearchChanged() {
         // Whenever a search constraint is specified we want to switch to
         // the search mode, and when all constraints have been lifted we
         // want to go back to the previous mode which can be either
@@ -202,19 +201,19 @@ var Embed = new Lang.Class({
             let searchAction = this._view.view.getAction('search');
             searchAction.change_state(GLib.Variant.new('b', true));
         }
-    },
+    }
 
-    _onWindowModeChanged: function(object, newMode, oldMode) {
+    _onWindowModeChanged(object, newMode, oldMode) {
         this._view.windowMode = newMode;
-    },
+    }
 
-    getMainToolbar: function() {
+    getMainToolbar() {
         if (this._view.view.canFullscreen &&
             this._view.view.fullscreen)
             return this._view.view.getFullscreenToolbar();
 
         return this._view.toolbar;
-    },
+    }
 
     get view() {
         return this._view;
diff --git a/src/errorBox.js b/src/errorBox.js
index 8fdf154c..9f3a42b9 100644
--- a/src/errorBox.js
+++ b/src/errorBox.js
@@ -20,18 +20,18 @@
  */
 
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 
 const Lang = imports.lang;
 
 const _ICON_SIZE = 128;
 
-var ErrorBox = new Lang.Class({
-    Name: 'ErrorBox',
-    Extends: Gtk.Grid,
+var ErrorBox = GObject.registerClass(
+    class ErrorBox extends Gtk.Grid {
 
-    _init: function(primary, secondary) {
-        this.parent({ orientation: Gtk.Orientation.VERTICAL,
+    _init(primary, secondary) {
+        super._init({ orientation: Gtk.Orientation.VERTICAL,
                       row_spacing: 12,
                       hexpand: true,
                       vexpand: true,
@@ -61,9 +61,9 @@ var ErrorBox = new Lang.Class({
         this.add(this._secondaryLabel);
 
         this.show_all();
-    },
+    }
 
-    update: function(primary, secondary) {
+    update(primary, secondary) {
         let primaryMarkup = '<big><b>' + GLib.markup_escape_text(primary, -1) + '</b></big>';
         let secondaryMarkup = GLib.markup_escape_text(secondary, -1);
 
diff --git a/src/evinceview.js b/src/evinceview.js
index 6df5d94b..ddd5d423 100644
--- a/src/evinceview.js
+++ b/src/evinceview.js
@@ -24,6 +24,7 @@ const EvView = imports.gi.EvinceView;
 const GdPrivate = imports.gi.GdPrivate;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 const _ = imports.gettext.gettext;
 
@@ -38,66 +39,65 @@ const Preview = imports.preview;
 const Utils = imports.utils;
 const WindowMode = imports.windowMode;
 
-var EvinceView = new Lang.Class({
-    Name: 'EvinceView',
-    Extends: Preview.Preview,
+var EvinceView = GObject.registerClass(
+    class EvinceView extends Preview.Preview {
 
-    _init: function(overlay, mainWindow) {
+    _init(overlay, mainWindow) {
         this._model = null;
         this._jobFind = null;
         this._pageChanged = false;
         this._hasSelection = false;
         this._viewSelectionChanged = false;
 
-        this.parent(overlay, mainWindow);
+        super._init(overlay, mainWindow);
 
         this.getAction('bookmark-page').enabled = false;
-    },
+    }
 
-    _copy: function() {
+    _copy() {
         this._evView.copy();
-    },
+    }
 
-    _zoomIn: function() {
+    _zoomIn() {
         if (!this._model)
             return;
         this._model.set_sizing_mode(EvView.SizingMode.FREE);
         this._evView.zoom_in();
-    },
+    }
 
-    _zoomOut: function() {
+    _zoomOut() {
         if (!this._model)
             return;
         this._model.set_sizing_mode(EvView.SizingMode.FREE);
         this._evView.zoom_out();
-    },
+    }
 
-    _rotateLeft: function() {
+    _rotateLeft() {
         let rotation = this._model.get_rotation();
         this._model.set_rotation(rotation - 90);
-    },
+    }
 
-    _rotateRight: function() {
+    _rotateRight() {
         let rotation = this._model.get_rotation();
         this._model.set_rotation(rotation + 90);
-    },
+    }
 
-    findPrev: function() {
+    findPrev() {
         this._evView.find_previous();
-    },
+    }
 
-    findNext: function() {
+    findNext() {
         this._evView.find_next();
-    },
+    }
 
-    _places: function() {
+    _places() {
         let dialog = new Places.PlacesDialog(this._model, this._bookmarks);
         dialog.connect('response', Lang.bind(this, function(widget, response) {
             widget.destroy();
         }));
-    },
+    }
 
-    _findStateChanged: function(action) {
+    _findStateChanged(action) {
         let toolbar = this.toolbar;
         if (this.fullscreen)
             toolbar = this.getFullscreenToolbar().toolbar;
@@ -109,9 +109,9 @@ var EvinceView = new Lang.Class({
             toolbar.searchbar.conceal();
             this._evView.find_set_highlight_search(false);
         }
-    },
+    }
 
-    _bookmarkStateChanged: function(action) {
+    _bookmarkStateChanged(action) {
         let pageNumber = this._model.page;
         let bookmark = new GdPrivate.Bookmark({ page_number: pageNumber });
 
@@ -119,9 +119,9 @@ var EvinceView = new Lang.Class({
             this._bookmarks.add(bookmark);
         else
             this._bookmarks.remove(bookmark);
-    },
+    }
 
-    _presentStateChanged: function(action) {
+    _presentStateChanged(action) {
         if (!this._model)
             return;
 
@@ -129,27 +129,27 @@ var EvinceView = new Lang.Class({
             this._promptPresentation();
         else
             this._hidePresentation();
-    },
+    }
 
-    _edit: function() {
+    _edit() {
         Application.modeController.setWindowMode(WindowMode.WindowMode.EDIT);
-    },
+    }
 
-    _print: function() {
+    _print() {
         let doc = Application.documentManager.getActiveItem();
         if (doc)
             doc.print(this.mainWindow);
-    },
+    }
 
-    _scrollUp: function() {
+    _scrollUp() {
         this._evView.scroll(Gtk.ScrollType.PAGE_BACKWARD, false);
-    },
+    }
 
-    _scrollDown: function() {
+    _scrollDown() {
         this._evView.scroll(Gtk.ScrollType.PAGE_FORWARD, false);
-    },
+    }
 
-    createActions: function() {
+    createActions() {
         let actions = [
             { name: 'zoom-in',
               callback: Lang.bind(this, this._zoomIn),
@@ -205,17 +205,17 @@ var EvinceView = new Lang.Class({
                        accels: ['F5'] });
 
         return actions;
-    },
+    }
 
-    createNavControls: function() {
+    createNavControls() {
         return new EvinceViewNavControls(this, this.overlay);
-    },
+    }
 
-    createToolbar: function() {
+    createToolbar() {
         return new EvinceViewToolbar(this);
-    },
+    }
 
-    createView: function() {
+    createView() {
         let sw = new Gtk.ScrolledWindow({ hexpand: true,
                                           vexpand: true });
         sw.get_style_context().add_class('documents-scrolledwin');
@@ -242,23 +242,23 @@ var EvinceView = new Lang.Class({
             this._handleExternalLink));
 
         return sw;
-    },
+    }
 
-    onLoadStarted: function(manager, doc) {
-        this.parent(manager, doc);
+    onLoadStarted(manager, doc) {
+        super.onLoadStarted(manager, doc);
 
         this.getAction('bookmark-page').enabled = false;
         this.getAction('find').enabled = false;
         this.getAction('gear-menu').enabled = false;
         this.getAction('places').enabled = false;
-    },
+    }
 
-    onLoadFinished: function(manager, doc, docModel) {
+    onLoadFinished(manager, doc, docModel) {
         this.controlsVisible = false;
         this._lastSearch = '';
         this._model = docModel;
 
-        this.parent(manager, doc, docModel);
+        super.onLoadFinished(manager, doc, docModel);
 
         docModel.set_sizing_mode(EvView.SizingMode.AUTOMATIC);
 
@@ -293,16 +293,16 @@ var EvinceView = new Lang.Class({
 
         this.set_visible_child_full('view', Gtk.StackTransitionType.NONE);
         this.grab_focus();
-    },
+    }
 
-    onLoadError: function(manager, doc, message, exception) {
+    onLoadError(manager, doc, message, exception) {
         this._controlsVisible = true;
         this._syncControlsVisible();
 
-        this.parent(manager, doc, message, exception);
-    },
+        super.onLoadError(manager, doc, message, exception);
+    }
 
-    _enableSearch: function() {
+    _enableSearch() {
         let canFind = true;
 
         try {
@@ -318,9 +318,9 @@ var EvinceView = new Lang.Class({
         }
 
         this.getAction('find').enabled = (this.hasPages && canFind);
-    },
+    }
 
-    _onPageChanged: function() {
+    _onPageChanged() {
         let pageNumber = this._model.page;
         this._pageChanged = true;
         if (this._metadata)
@@ -333,25 +333,25 @@ var EvinceView = new Lang.Class({
         let hasBookmark = (this._bookmarks.find_bookmark(bookmark) != null);
 
         this.getAction('bookmark-page').change_state(GLib.Variant.new('b', hasBookmark));
-    },
+    }
 
-    _hidePresentation: function() {
+    _hidePresentation() {
         if (this._presentation) {
             this._presentation.close();
             this._presentation = null;
         }
 
         this.getAction('present-current').change_state(GLib.Variant.new('b', false));
-    },
+    }
 
-    _showPresentation: function(output) {
+    _showPresentation(output) {
         this._presentation = new Presentation.PresentationWindow(this._model);
         this._presentation.connect('destroy', Lang.bind(this, this._hidePresentation));
         if (output)
             this._presentation.setOutput(output);
-    },
+    }
 
-    _promptPresentation: function() {
+    _promptPresentation() {
         let outputs = new Presentation.PresentationOutputs();
         if (outputs.list.length < 2) {
             this._showPresentation();
@@ -367,9 +367,9 @@ var EvinceView = new Lang.Class({
                 }));
 
         }
-    },
+    }
 
-    _onViewSelectionChanged: function() {
+    _onViewSelectionChanged() {
         let hasSelection = this._evView.get_has_selection();
         this.getAction('copy').enabled = hasSelection;
 
@@ -383,9 +383,9 @@ var EvinceView = new Lang.Class({
         this._viewSelectionChanged = true;
         if (!hasSelection)
             this.cancelControlsFlip();
-    },
+    }
 
-    _uriRewrite: function(uri) {
+    _uriRewrite(uri) {
         if (uri.substring(0, 3) != 'www.') {
             /* Prepending "http://"; when the url is a webpage (starts with
              * "www.").
@@ -406,9 +406,9 @@ var EvinceView = new Lang.Class({
         }
 
         return uri;
-    },
+    }
 
-    _launchExternalUri: function(widget, action) {
+    _launchExternalUri(widget, action) {
         let uri = action.get_uri();
         let screen = widget.get_screen();
         let context = screen.get_display().get_app_launch_context();
@@ -434,22 +434,22 @@ var EvinceView = new Lang.Class({
         } catch (e) {
             logError(e, 'Unable to open external link');
         }
-    },
+    }
 
-    _handleExternalLink: function(widget, action) {
+    _handleExternalLink(widget, action) {
         if (action.type == EvDocument.LinkActionType.EXTERNAL_URI)
             this._launchExternalUri(widget, action);
-    },
+    }
 
-    _onCanZoomInChanged: function() {
+    _onCanZoomInChanged() {
         this.getAction('zoom-in').enabled = this._evView.can_zoom_in;
-    },
+    }
 
-    _onCanZoomOutChanged: function() {
+    _onCanZoomOutChanged() {
         this.getAction('zoom-out').enabled = this._evView.can_zoom_out;
-    },
+    }
 
-    _onButtonPressEvent: function(widget, event) {
+    _onButtonPressEvent(widget, event) {
         let button = event.get_button()[1];
 
         if (button == 3) {
@@ -460,9 +460,9 @@ var EvinceView = new Lang.Class({
 
         this._viewSelectionChanged = false;
         return false;
-   },
+    }
 
-    _onButtonReleaseEvent: function(widget, event) {
+    _onButtonReleaseEvent(widget, event) {
         let button = event.get_button()[1];
         let clickCount = event.get_click_count()[1];
 
@@ -476,26 +476,26 @@ var EvinceView = new Lang.Class({
         this._viewSelectionChanged = false;
 
         return false;
-    },
+    }
 
-    _onScrollbarClick: function() {
+    _onScrollbarClick() {
         this.controlsVisible = false;
         return false;
-    },
+    }
 
-    _onAdjustmentChanged: function() {
+    _onAdjustmentChanged() {
         if (!this._pageChanged)
             this.controlsVisible = false;
         this._pageChanged = false;
-    },
+    }
 
-    search: function(str) {
+    search(str) {
         this._evView.find_search_changed();
 
         if (!this._model)
             return;
 
-        this.parent(str);
+        super.search(str);
 
         if (this._jobFind) {
             if (!this._jobFind.is_finished())
@@ -515,15 +515,15 @@ var EvinceView = new Lang.Class({
         this._evView.find_started(this._jobFind);
 
         this._jobFind.scheduler_push_job(EvView.JobPriority.PRIORITY_NONE);
-    },
+    }
 
-    _onSearchJobUpdated: function(job, page) {
+    _onSearchJobUpdated(job, page) {
         let hasResults = job.has_results();
         this.getAction('find-prev').enabled = hasResults;
         this.getAction('find-next').enabled = hasResults;
-    },
+    }
 
-    _loadMetadata: function() {
+    _loadMetadata() {
         let evDoc = this._model.get_document();
         let file = Gio.File.new_for_uri(evDoc.get_uri());
         if (!GdPrivate.is_metadata_supported_for_file(file))
@@ -536,31 +536,31 @@ var EvinceView = new Lang.Class({
             this._model.set_page(val);
 
         return metadata;
-    },
+    }
 
-    goPrev: function() {
+    goPrev() {
         this._evView.previous_page();
-    },
+    }
 
-    goNext: function() {
+    goNext() {
         this._evView.next_page();
-    },
+    }
 
     get hasPages() {
         return this._model ? (this._model.document.get_n_pages() > 0) : false;
-    },
+    }
 
     get page() {
         return this._model ? this._model.page : 0;
-    },
+    }
 
     get numPages() {
         return this._model ? this._model.document.get_n_pages() : 0;
-    },
+    }
 
     get canFullscreen() {
         return true;
-    },
+    }
 
     set nightMode(v) {
         if (this._model)
@@ -568,11 +568,10 @@ var EvinceView = new Lang.Class({
     }
 });
 
-const EvinceViewNavControls = new Lang.Class({
-    Name: 'EvinceViewNavControls',
-    Extends: Preview.PreviewNavControls,
+const EvinceViewNavControls = GObject.registerClass(
+    class EvinceViewNavControls extends Preview.PreviewNavControls {
 
-    createBarWidget: function() {
+    createBarWidget() {
         let barWidget = new GdPrivate.NavBar();
 
         let buttonArea = barWidget.get_button_area();
@@ -594,20 +593,19 @@ const EvinceViewNavControls = new Lang.Class({
         buttonArea.pack_start(button, false, false, 0);
 
         return barWidget;
-    },
+    }
 
-    setModel: function(model) {
+    setModel(model) {
         this.barWidget.document_model = model;
         model.connect('page-changed', Lang.bind(this, this._updateVisibility));
     }
 });
 
-const EvinceViewToolbar = new Lang.Class({
-    Name: 'EvinceViewToolbar',
-    Extends: Preview.PreviewToolbar,
+const EvinceViewToolbar = GObject.registerClass(
+    class EvinceViewToolbar extends Preview.PreviewToolbar {
 
-    _init: function(preview) {
-        this.parent(preview);
+    _init(preview) {
+        super._init(preview);
 
         this._handleEvent = false;
 
diff --git a/src/fullscreenAction.js b/src/fullscreenAction.js
index df12a9e1..b2f4ecad 100644
--- a/src/fullscreenAction.js
+++ b/src/fullscreenAction.js
@@ -27,9 +27,7 @@ const Gtk = imports.gi.Gtk;
 
 const Lang = imports.lang;
 
-var FullscreenAction = new Lang.Class({
-    Name: 'FullscreenAction',
-    Extends: GObject.Object,
+var FullscreenAction = GObject.registerClass({
     Implements: [Gio.Action],
     Properties: {
         'enabled': GObject.ParamSpec.boolean('enabled', 'enabled', 'Whether the action is enabled',
@@ -42,33 +40,34 @@ var FullscreenAction = new Lang.Class({
         'window': GObject.ParamSpec.object('window', 'Window', 'The GtkWindow',
                                            GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE,
                                            Gtk.Window.$gtype)
-    },
+    }
+}, class FullscreenAction extends GObject.Object {
 
-    _init: function(params) {
+    _init(params) {
         this._enabled = true;
         this._fullscreen = false;
         this._window = null;
         this._windowStateId = 0;
 
-        this.parent(params);
-    },
+        super._init(params);
+    }
 
-    _disconnectFromWindow: function() {
+    _disconnectFromWindow() {
         if (this._windowStateId != 0) {
             this._window.disconnect(this._windowStateId);
             this._windowStateId = 0;
         }
-    },
+    }
 
-    _connectToWindow: function() {
+    _connectToWindow() {
         if (this._window) {
             this._windowStateId = this._window.connect('window-state-event',
                                                        Lang.bind(this, this._onWindowStateEvent));
             this._onWindowStateEvent();
         }
-    },
+    }
 
-    _onWindowStateEvent: function() {
+    _onWindowStateEvent() {
         let window = this._window.get_window();
         if (!window)
             return;
@@ -80,9 +79,9 @@ var FullscreenAction = new Lang.Class({
 
         this._fullscreen = fullscreen;
         this.notify('state');
-    },
+    }
 
-    _changeState: function(fullscreen) {
+    _changeState(fullscreen) {
         if (!this._window)
             return;
 
@@ -90,40 +89,40 @@ var FullscreenAction = new Lang.Class({
             this._window.fullscreen();
         else
             this._window.unfullscreen();
-    },
+    }
 
-    vfunc_activate: function() {
+    vfunc_activate() {
         this._changeState(!this._fullscreen);
-    },
+    }
 
-    vfunc_change_state: function(state) {
+    vfunc_change_state(state) {
         let fullscreen = state.get_boolean();
         this._changeState(fullscreen);
-    },
+    }
 
-    vfunc_get_enabled: function() {
+    vfunc_get_enabled() {
         return this.enabled;
-    },
+    }
 
-    vfunc_get_name: function() {
+    vfunc_get_name() {
         return this.name;
-    },
+    }
 
-    vfunc_get_parameter_type: function() {
+    vfunc_get_parameter_type() {
         return this.parameter_type;
-    },
+    }
 
-    vfunc_get_state: function() {
+    vfunc_get_state() {
         return this.state;
-    },
+    }
 
-    vfunc_get_state_hint: function() {
+    vfunc_get_state_hint() {
         return null;
-    },
+    }
 
-    vfunc_get_state_type: function() {
+    vfunc_get_state_type() {
         return this.state_type;
-    },
+    }
 
     set enabled(v) {
         if (v == this._enabled)
@@ -131,27 +130,27 @@ var FullscreenAction = new Lang.Class({
 
         this._enabled = v;
         this.notify('enabled');
-    },
+    }
 
     get enabled() {
         return this._enabled;
-    },
+    }
 
     get name() {
         return 'fullscreen';
-    },
+    }
 
     get parameter_type() {
         return null;
-    },
+    }
 
     get state() {
         return new GLib.Variant('b', this._fullscreen);
-    },
+    }
 
     get state_type() {
         return new GLib.VariantType('b');
-    },
+    }
 
     set window(w) {
         if (w == this._window)
@@ -162,9 +161,9 @@ var FullscreenAction = new Lang.Class({
         this._connectToWindow();
 
         this.notify('window');
-    },
+    }
 
     get window() {
         return this._window;
-    },
+    }
 });
diff --git a/src/lokview.js b/src/lokview.js
index dfa0b962..14c05179 100644
--- a/src/lokview.js
+++ b/src/lokview.js
@@ -30,6 +30,7 @@ try {
 
 const Gdk = imports.gi.Gdk;
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 const _ = imports.gettext.gettext;
 
@@ -97,20 +98,25 @@ function isOpenDocumentFormat(mimeType) {
     return false;
 }
 
-var LOKView = new Lang.Class({
-    Name: 'LOKView',
-    Extends: Preview.Preview,
+print('Gjs Value Of Preview.Preview: ' + Preview.Preview);
+print('Gjs Value Of Preview.PreviewNavControls: ' + Preview.PreviewNavControls);
+print('Gjs Value Of Preview.PreviewToolbar: ' + Preview.PreviewToolbar);
+print('Gjs Value Of Preview.PreviewSearchbar: ' + Preview.PreviewSearchbar);
+print('Gjs Value Of Preview.PREVIEW_NAVBAR_MARGIN: ' + Preview.PREVIEW_NAVBAR_MARGIN);
+print('Preview\'s keys: ' + Object.keys(Preview));
+var LOKView = GObject.registerClass(
+    class LOKView extends Preview.Preview {
 
-    _init: function(overlay, mainWindow) {
-        this.parent(overlay, mainWindow);
+    _init(overlay, mainWindow) {
+        super._init(overlay, mainWindow);
 
         this._progressBar = new Gtk.ProgressBar({ halign: Gtk.Align.FILL,
                                                   valign: Gtk.Align.START });
         this._progressBar.get_style_context().add_class('osd');
         this.overlay.add_overlay(this._progressBar);
-    },
+    }
 
-    createActions: function() {
+    createActions() {
         return [
             { name: 'zoom-in',
               callback: Lang.bind(this, this._zoomIn),
@@ -122,9 +128,9 @@ var LOKView = new Lang.Class({
               callback: Lang.bind(this, this._copy),
               accels: ['<Primary>c'] }
         ];
-    },
+    }
 
-    createView: function() {
+    createView() {
         let sw = new Gtk.ScrolledWindow({ hexpand: true,
                                           vexpand: true });
         sw.get_style_context().add_class('documents-scrolledwin');
@@ -142,58 +148,58 @@ var LOKView = new Lang.Class({
         }
 
         return sw;
-    },
+    }
 
-    onLoadFinished: function(manager, doc) {
-        this.parent(manager, doc);
+    onLoadFinished(manager, doc) {
+        super.onLoadFinished(manager, doc);
 
         if (!isAvailable())
             return;
         this._doc = doc;
         this._lokview.open_document(doc.uriToLoad, '{}', null, Lang.bind(this, this._onDocumentOpened));
         this._progressBar.show();
-    },
+    }
 
-    _onDocumentOpened: function(res, doc) {
+    _onDocumentOpened(res, doc) {
         // TODO: Call _finish and check failure
         this._progressBar.hide();
         this.set_visible_child_name('view');
         this._lokview.set_edit(false);
-    },
+    }
 
-    _copy: function() {
+    _copy() {
         let [selectedText, mimeType] = this._lokview.copy_selection('text/plain;charset=utf-8');
         let display = Gdk.Display.get_default();
         let clipboard = Gtk.Clipboard.get_default(display);
 
         clipboard.set_text(selectedText, selectedText.length);
-    },
+    }
 
-    _zoomIn: function() {
+    _zoomIn() {
         // FIXME: https://bugs.documentfoundation.org/show_bug.cgi?id=97301
         if (!this._doc)
             return;
         let zoomLevel = this._lokview.get_zoom() * ZOOM_IN_FACTOR;
         this._lokview.set_zoom(zoomLevel);
-    },
+    }
 
-    _zoomOut: function() {
+    _zoomOut() {
         // FIXME: https://bugs.documentfoundation.org/show_bug.cgi?id=97301
         if (!this._doc)
             return;
         let zoomLevel = this._lokview.get_zoom() * ZOOM_OUT_FACTOR;
         this._lokview.set_zoom(zoomLevel);
-    },
+    }
 
-    _onCanZoomInChanged: function() {
+    _onCanZoomInChanged() {
         this.getAction('zoom-in').enabled = this._lokview.can_zoom_in;
-    },
+    }
 
-    _onCanZoomOutChanged: function() {
+    _onCanZoomOutChanged() {
         this.getAction('zoom-out').enabled = this._lokview.can_zoom_out;
-    },
+    }
 
-    _onButtonPressEvent: function(widget, event) {
+    _onButtonPressEvent(widget, event) {
         let button = event.get_button()[1];
 
         if (button == 3) {
@@ -203,17 +209,17 @@ var LOKView = new Lang.Class({
         }
 
         return false;
-   },
+    }
 
-    _onProgressChanged: function() {
+    _onProgressChanged() {
         this._progressBar.fraction = this._lokview.load_progress;
-    },
+    }
 
-    _onTextSelection: function(hasSelection) {
+    _onTextSelection(hasSelection) {
         this.getAction('copy').enabled = hasSelection;
-    },
+    }
 
-    goPrev: function() {
+    goPrev() {
         let currentPart = this._lokview.get_part();
         currentPart -= 1;
         if (currentPart < 0)
@@ -221,9 +227,9 @@ var LOKView = new Lang.Class({
         this._lokview.set_part(currentPart);
         // FIXME: https://bugs.documentfoundation.org/show_bug.cgi?id=97236
         this._lokview.reset_view();
-    },
+    }
 
-    goNext: function() {
+    goNext() {
         let totalParts  = this._lokview.get_parts();
         let currentPart = this._lokview.get_part();
         currentPart += 1;
@@ -232,15 +238,15 @@ var LOKView = new Lang.Class({
         this._lokview.set_part(currentPart);
         // FIXME: https://bugs.documentfoundation.org/show_bug.cgi?id=97236
         this._lokview.reset_view();
-    },
+    }
 
     get hasPages() {
         return this._doc ? isOpenDocumentPartDocument(this._doc.mimeType) : false;
-    },
+    }
 
     get page() {
         return this._lokview.get_part();
-    },
+    }
 
     get numPages() {
         return this._lokview.get_parts();
diff --git a/src/mainToolbar.js b/src/mainToolbar.js
index 8cbf88bf..f9e87d1b 100644
--- a/src/mainToolbar.js
+++ b/src/mainToolbar.js
@@ -22,6 +22,7 @@
 
 const Gd = imports.gi.Gd;
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 
 const Gettext = imports.gettext;
@@ -32,15 +33,14 @@ const Lang = imports.lang;
 const Application = imports.application;
 const Searchbar = imports.searchbar;
 
-var MainToolbar = new Lang.Class({
-    Name: 'MainToolbar',
-    Extends: Gtk.Box,
+var MainToolbar = GObject.registerClass(
+    class MainToolbar extends Gtk.Box {
 
-    _init: function() {
+    _init() {
         this._model = null;
         this._handleEvent = true;
 
-        this.parent({ orientation: Gtk.Orientation.VERTICAL });
+        super._init({ orientation: Gtk.Orientation.VERTICAL });
         this.show();
 
         this.toolbar = new Gtk.HeaderBar({ hexpand: true });
@@ -68,25 +68,25 @@ var MainToolbar = new Lang.Class({
                 Application.documentManager.disconnect(loadErrorId);
                 Application.documentManager.disconnect(passwordNeededId);
             }));
-    },
+    }
 
-    createSearchbar: function() {
+    createSearchbar() {
         return null;
-    },
+    }
 
-    _onLoadErrorOrPassword: function() {
+    _onLoadErrorOrPassword() {
         this._handleEvent = false;
-    },
+    }
 
-    handleEvent: function(event) {
+    handleEvent(event) {
         if (!this._handleEvent)
             return false;
 
         let res = this.searchbar.handleEvent(event);
         return res;
-    },
+    }
 
-    addMenuButton: function() {
+    addMenuButton() {
       let model_name = null;
 
       let builder = Gtk.Builder.new_from_resource("/org/gnome/Documents/ui/documents-app-menu.ui");
@@ -98,18 +98,18 @@ var MainToolbar = new Lang.Class({
 
       this.toolbar.pack_end(menuButton);
       return menuButton;
-    },
+    }
 
-    addSearchButton: function(actionName) {
+    addSearchButton(actionName) {
         let searchButton = new Gtk.ToggleButton({ image: new Gtk.Image ({ icon_name: 'edit-find-symbolic' }),
                                                   tooltip_text: Gettext.pgettext("toolbar button tooltip", 
"Search"),
                                                   action_name: actionName,
                                                   visible: true });
         this.toolbar.pack_start(searchButton);
         return searchButton;
-    },
+    }
 
-    addBackButton: function() {
+    addBackButton() {
         let backButton = new Gtk.Button({ image: new Gtk.Image({ icon_name: 'go-previous-symbolic' }),
                                           tooltip_text: _("Back"),
                                           action_name: 'view.go-back' });
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 505a91ea..7adde45d 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -22,6 +22,7 @@
 const GdPrivate = imports.gi.GdPrivate;
 const Gdk = imports.gi.Gdk;
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 
 const Lang = imports.lang;
@@ -37,14 +38,13 @@ const _CONFIGURE_ID_TIMEOUT = 100; // msecs
 const _WINDOW_MIN_WIDTH = 600;
 const _WINDOW_MIN_HEIGHT = 500;
 
-var MainWindow = new Lang.Class({
-    Name: 'MainWindow',
-    Extends: Gtk.ApplicationWindow,
+var MainWindow = GObject.registerClass(
+    class MainWindow extends Gtk.ApplicationWindow {
 
-    _init: function(app) {
+    _init(app) {
         this._configureId = 0;
 
-        this.parent({ application: app,
+        super._init({ application: app,
                       width_request: _WINDOW_MIN_WIDTH,
                       height_request: _WINDOW_MIN_HEIGHT,
                       window_position: Gtk.WindowPosition.CENTER,
@@ -78,9 +78,9 @@ var MainWindow = new Lang.Class({
 
         this._embed = new Embed.Embed(this);
         this.add(this._embed);
-    },
+    }
 
-    _saveWindowGeometry: function() {
+    _saveWindowGeometry() {
         let window = this.get_window();
         let state = window.get_state();
 
@@ -95,9 +95,9 @@ var MainWindow = new Lang.Class({
         let position = this.get_position();
         variant = GLib.Variant.new ('ai', position);
         Application.settings.set_value('window-position', variant);
-    },
+    }
 
-    _onConfigureEvent: function(widget, event) {
+    _onConfigureEvent(widget, event) {
         let window = this.get_window();
         let state = window.get_state();
 
@@ -115,16 +115,16 @@ var MainWindow = new Lang.Class({
                 this._saveWindowGeometry();
                 return false;
             }));
-    },
+    }
 
-    _onWindowStateEvent: function(widget, event) {
+    _onWindowStateEvent(widget, event) {
         let window = widget.get_window();
         let state = window.get_state();
         let maximized = (state & Gdk.WindowState.MAXIMIZED);
         Application.settings.set_boolean('window-maximized', maximized);
-    },
+    }
 
-    _onButtonPressEvent: function(widget, event) {
+    _onButtonPressEvent(widget, event) {
         let button = event.get_button()[1];
         let clickCount = event.get_click_count()[1];
 
@@ -143,14 +143,14 @@ var MainWindow = new Lang.Class({
         }
 
         return false;
-    },
+    }
 
-    _onKeyPressEvent: function(widget, event) {
+    _onKeyPressEvent(widget, event) {
         let toolbar = this._embed.getMainToolbar();
         return toolbar.handleEvent(event);
-    },
+    }
 
-    _quit: function() {
+    _quit() {
         // remove configure event handler if still there
         if (this._configureId != 0) {
             Mainloop.source_remove(this._configureId);
@@ -161,9 +161,9 @@ var MainWindow = new Lang.Class({
         this._saveWindowGeometry();
 
         return false;
-    },
+    }
 
-    showAbout: function() {
+    showAbout() {
         GdPrivate.show_about_dialog(this);
     }
 });
diff --git a/src/manager.js b/src/manager.js
index c7749e57..316fed34 100644
--- a/src/manager.js
+++ b/src/manager.js
@@ -21,14 +21,15 @@
 
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 
 const Lang = imports.lang;
 const Signals = imports.signals;
 
-var BaseManager = new Lang.Class({
-    Name: 'BaseManager',
+var BaseManager = GObject.registerClass(
+    class BaseManager extends GObject.Object {
 
-    _init: function(title, actionId, context) {
+    _init(title, actionId, context) {
         this._items = {};
         this._activeItem = null;
         this._title = null;
@@ -41,26 +42,26 @@ var BaseManager = new Lang.Class({
             this._actionId = actionId;
 
         this.context = context;
-    },
+    }
 
-    getActionId: function() {
+    getActionId() {
         return this._actionId;
-    },
+    }
 
-    getTitle: function() {
+    getTitle() {
         return this._title;
-    },
+    }
 
-    getItemById: function(id) {
+    getItemById(id) {
         let retval = this._items[id];
 
         if (!retval)
             retval = null;
 
         return retval;
-    },
+    }
 
-    addItem: function(item) {
+    addItem(item) {
         item._manager = this;
 
         let oldItem = this._items[item.id];
@@ -69,9 +70,9 @@ var BaseManager = new Lang.Class({
 
         this._items[item.id] = item;
         this.emit('item-added', item);
-    },
+    }
 
-    setActiveItem: function(item) {
+    setActiveItem(item) {
         if (item != this._activeItem) {
             this._activeItem = item;
             this.emit('active-changed', this._activeItem);
@@ -80,30 +81,30 @@ var BaseManager = new Lang.Class({
         }
 
         return false;
-    },
+    }
 
-    setActiveItemById: function(id) {
+    setActiveItemById(id) {
         let item = this.getItemById(id);
         return this.setActiveItem(item);
-    },
+    }
 
-    getItems: function() {
+    getItems() {
         return this._items;
-    },
+    }
 
-    getItemsCount: function() {
+    getItemsCount() {
         return Object.keys(this._items).length;
-    },
+    }
 
-    getActiveItem: function() {
+    getActiveItem() {
         return this._activeItem;
-    },
+    }
 
-    removeItem: function(item) {
+    removeItem(item) {
         this.removeItemById(item.id);
-    },
+    }
 
-    removeItemById: function(id) {
+    removeItemById(id) {
         let item = this._items[id];
 
         if (item) {
@@ -111,19 +112,19 @@ var BaseManager = new Lang.Class({
             this.emit('item-removed', item);
             item._manager = null;
         }
-    },
+    }
 
-    clear: function() {
+    clear() {
         this._items = {};
         this._activeItem = null;
         this.emit('clear');
-    },
+    }
 
-    getFilter: function(flags) {
+    getFilter(flags) {
         log('Error: BaseManager implementations must override getFilter');
-    },
+    }
 
-    getWhere: function() {
+    getWhere() {
         let item = this.getActiveItem();
         let retval = '';
 
@@ -131,14 +132,14 @@ var BaseManager = new Lang.Class({
             retval = item.getWhere();
 
         return retval;
-    },
+    }
 
-    forEachItem: function(func) {
+    forEachItem(func) {
         for (let idx in this._items)
             func(this._items[idx]);
-    },
+    }
 
-    getAllFilter: function() {
+    getAllFilter() {
         let filters = [];
 
         this.forEachItem(function(item) {
@@ -147,9 +148,9 @@ var BaseManager = new Lang.Class({
         });
 
         return '(' + filters.join(' || ') + ')';
-    },
+    }
 
-    processNewItems: function(newItems) {
+    processNewItems(newItems) {
         let oldItems = this.getItems();
         let idx;
 
@@ -174,20 +175,19 @@ var BaseManager = new Lang.Class({
 });
 Signals.addSignalMethods(BaseManager.prototype);
 
-var BaseModel = new Lang.Class({
-    Name: 'BaseModel',
-    Extends: Gio.Menu,
+var BaseModel = GObject.registerClass(
+    class BaseModel extends Gio.Menu {
 
-    _init: function(manager) {
-        this.parent();
+    _init(manager) {
+        super._init();
         this._manager = manager;
         this._manager.connect('item-added', Lang.bind(this, this._refreshModel));
         this._manager.connect('item-removed', Lang.bind(this, this._refreshModel));
 
         this._refreshModel();
-    },
+    }
 
-    _refreshModel: function() {
+    _refreshModel() {
         this.remove_all();
 
         let menuItem;
diff --git a/src/notifications.js b/src/notifications.js
index 6e542b09..45a4796c 100644
--- a/src/notifications.js
+++ b/src/notifications.js
@@ -21,6 +21,7 @@
 
 const Gd = imports.gi.Gd;
 const Gettext = imports.gettext;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 const TrackerControl = imports.gi.TrackerControl;
 const _ = imports.gettext.gettext;
@@ -33,10 +34,10 @@ const Mainloop = imports.mainloop;
 
 var DELETE_TIMEOUT = 10; // seconds
 
-var DeleteNotification = new Lang.Class({
-    Name: 'DeleteNotification',
+var DeleteNotification = GObject.registerClass(
+    class DeleteNotification extends GObject.Object {
 
-    _init: function(docs) {
+    _init(docs) {
         this._docs = docs;
         this.widget = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL,
                                      column_spacing: 12 });
@@ -89,9 +90,9 @@ var DeleteNotification = new Lang.Class({
                 this._deleteItems();
                 return false;
             }));
-    },
+    }
 
-    _deleteItems: function() {
+    _deleteItems() {
         this._docs.forEach(Lang.bind(this,
             function(doc) {
                 doc.trash();
@@ -99,9 +100,9 @@ var DeleteNotification = new Lang.Class({
 
         this._removeTimeout();
         this.widget.destroy();
-    },
+    }
 
-    _removeTimeout: function() {
+    _removeTimeout() {
         if (this._timeoutId != 0) {
             Mainloop.source_remove(this._timeoutId);
             this._timeoutId = 0;
@@ -109,10 +110,10 @@ var DeleteNotification = new Lang.Class({
     }
 });
 
-var PrintNotification = new Lang.Class({
-    Name: 'PrintNotification',
+var PrintNotification = GObject.registerClass(
+    class PrintNotification extends GObject.Object {
 
-    _init: function(printOp, doc) {
+    _init(printOp, doc) {
         this.widget = null;
         this._printOp = printOp;
         this._doc = doc;
@@ -121,9 +122,9 @@ var PrintNotification = new Lang.Class({
                               Lang.bind(this, this._onPrintBegin));
         this._printOp.connect('status-changed',
                               Lang.bind(this, this._onPrintStatus));
-    },
+    }
 
-    _onPrintBegin: function() {
+    _onPrintBegin() {
         this.widget = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
                                      row_spacing: 6 });
 
@@ -148,9 +149,9 @@ var PrintNotification = new Lang.Class({
             }));
 
         Application.notificationManager.addNotification(this);
-    },
+    }
 
-    _onPrintStatus: function() {
+    _onPrintStatus() {
         if (!this.widget)
             return;
 
@@ -169,10 +170,10 @@ var PrintNotification = new Lang.Class({
 const REMOTE_MINER_TIMEOUT = 10; // seconds
 const TRACKER_MINER_FILES_NAME = 'org.freedesktop.Tracker1.Miner.Files';
 
-const IndexingNotification = new Lang.Class({
-    Name: 'IndexingNotification',
+const IndexingNotification = GObject.registerClass(
+    class IndexingNotification extends GObject.Object {
 
-    _init: function() {
+    _init() {
         this._closed = false;
         this._timeoutId = 0;
 
@@ -187,9 +188,9 @@ const IndexingNotification = new Lang.Class({
 
         Application.application.connect('miners-changed', Lang.bind(this, this._checkNotification));
         Application.modeController.connect('window-mode-changed', Lang.bind(this, this._checkNotification));
-    },
+    }
 
-    _checkNotification: function() {
+    _checkNotification() {
         if (Application.modeController.getWindowMode() == WindowMode.WindowMode.PREVIEW_EV) {
             this._destroy(false);
             return;
@@ -220,9 +221,9 @@ const IndexingNotification = new Lang.Class({
         } else {
             this._destroy(false);
         }
-    },
+    }
 
-    _onTimeoutExpired: function() {
+    _onTimeoutExpired() {
         this._timeoutId = 0;
 
         let primary = null;
@@ -243,16 +244,16 @@ const IndexingNotification = new Lang.Class({
         this._display(primary, null);
 
         return false;
-    },
+    }
 
-    _removeTimeout: function() {
+    _removeTimeout() {
         if (this._timeoutId != 0) {
             Mainloop.source_remove(this._timeoutId);
             this._timeoutId = 0;
         }
-    },
+    }
 
-    _buildWidget: function() {
+    _buildWidget() {
         this.widget = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL,
                                      column_spacing: 12 });
 
@@ -286,9 +287,9 @@ const IndexingNotification = new Lang.Class({
         this.widget.add(close);
 
         Application.notificationManager.addNotification(this);
-    },
+    }
 
-    _update: function(primaryText, secondaryText) {
+    _update(primaryText, secondaryText) {
         this._primaryLabel.label = primaryText;
         this._secondaryLabel.label = secondaryText;
 
@@ -299,9 +300,9 @@ const IndexingNotification = new Lang.Class({
             this._primaryLabel.vexpand = true;
             this._secondaryLabel.hide();
         }
-    },
+    }
 
-    _display: function(primaryText, secondaryText) {
+    _display(primaryText, secondaryText) {
         if (this._closed) {
             return;
         }
@@ -310,9 +311,9 @@ const IndexingNotification = new Lang.Class({
             this._buildWidget();
 
         this._update(primaryText, secondaryText);
-    },
+    }
 
-    _destroy: function(closed) {
+    _destroy(closed) {
         this._removeTimeout();
 
         if (this.widget) {
@@ -324,12 +325,11 @@ const IndexingNotification = new Lang.Class({
     }
 });
 
-var NotificationManager = new Lang.Class({
-    Name: 'NotificationManager',
-    Extends: Gtk.Revealer,
+var NotificationManager = GObject.registerClass(
+    class NotificationManager extends Gtk.Revealer {
 
-    _init: function() {
-        this.parent({ halign: Gtk.Align.CENTER,
+    _init() {
+        super._init({ halign: Gtk.Align.CENTER,
                       valign: Gtk.Align.START });
 
         let frame = new Gtk.Frame();
@@ -343,17 +343,17 @@ var NotificationManager = new Lang.Class({
 
         // add indexing monitor notification
         this._indexingNotification = new IndexingNotification();
-    },
+    }
 
-    addNotification: function(notification) {
+    addNotification(notification) {
         this._grid.add(notification.widget);
         notification.widget.connect('destroy', Lang.bind(this, this._onWidgetDestroy));
 
         this.show_all();
         this.reveal_child = true;
-    },
+    }
 
-    _onWidgetDestroy: function() {
+    _onWidgetDestroy() {
         let children = this._grid.get_children();
 
         if (children.length == 0)
diff --git a/src/overview.js b/src/overview.js
index f6a86aa4..1928ba1b 100644
--- a/src/overview.js
+++ b/src/overview.js
@@ -70,12 +70,11 @@ function getController(windowMode) {
 
 const _RESET_COUNT_TIMEOUT = 500; // msecs
 
-const ViewModel = new Lang.Class({
-    Name: 'ViewModel',
-    Extends: Gtk.ListStore,
+const ViewModel = GObject.registerClass(
+    class ViewModel extends Gtk.ListStore {
 
-    _init: function(windowMode) {
-        this.parent();
+    _init(windowMode) {
+        super._init();
         this.set_column_types(
             [ GObject.TYPE_STRING,
               GObject.TYPE_STRING,
@@ -110,9 +109,9 @@ const ViewModel = new Lang.Class({
         for (let idx in items) {
             this._onItemAdded(Application.documentManager, items[idx]);
         }
-    },
+    }
 
-    _clear: function() {
+    _clear() {
         let items = Application.documentManager.getItems();
         for (let idx in items) {
             let doc = items[idx];
@@ -120,9 +119,9 @@ const ViewModel = new Lang.Class({
         }
 
         this.clear();
-    },
+    }
 
-    _addItem: function(doc) {
+    _addItem(doc) {
         // Update the count so that OffsetController has the correct
         // values. Otherwise things like loading more items and "No
         // Results" page will not work correctly.
@@ -137,9 +136,9 @@ const ViewModel = new Lang.Class({
         let treePath = this.get_path(iter);
         let treeRowRef = Gtk.TreeRowReference.new(this, treePath);
         doc.rowRefs[this._rowRefKey] = treeRowRef;
-    },
+    }
 
-    _removeItem: function(doc) {
+    _removeItem(doc) {
         // Update the count so that OffsetController has the correct
         // values. Otherwise things like loading more items and "No
         // Results" page will not work correctly.
@@ -158,9 +157,9 @@ const ViewModel = new Lang.Class({
             }));
 
         doc.rowRefs[this._rowRefKey] = null;
-    },
+    }
 
-    _onInfoUpdated: function(doc) {
+    _onInfoUpdated(doc) {
         let activeCollection = Application.documentManager.getActiveCollection();
         let treeRowRef = doc.rowRefs[this._rowRefKey];
 
@@ -191,9 +190,9 @@ const ViewModel = new Lang.Class({
                     [ doc.id, doc.uri, doc.name,
                       doc.author, doc.surface, doc.mtime ]);
         }
-    },
+    }
 
-    _onItemAdded: function(source, doc) {
+    _onItemAdded(source, doc) {
         if (doc.rowRefs[this._rowRefKey])
             return;
 
@@ -216,15 +215,15 @@ const ViewModel = new Lang.Class({
 
         this._addItem(doc);
         this._infoUpdatedIds[doc.id] = doc.connect('info-updated', Lang.bind(this, this._onInfoUpdated));
-    },
+    }
 
-    _onItemRemoved: function(source, doc) {
+    _onItemRemoved(source, doc) {
         this._removeItem(doc);
         doc.disconnect(this._infoUpdatedIds[doc.id]);
         delete this._infoUpdatedIds[doc.id];
-    },
+    }
 
-    _resetCount: function() {
+    _resetCount() {
         if (this._resetCountId == 0) {
             this._resetCountId = Mainloop.timeout_add(_RESET_COUNT_TIMEOUT, Lang.bind(this,
                 function() {
@@ -236,13 +235,12 @@ const ViewModel = new Lang.Class({
     }
 });
 
-const EmptyResultsBox = new Lang.Class({
-    Name: 'EmptyResultsBox',
-    Extends: Gtk.Grid,
+const EmptyResultsBox = GObject.registerClass(
+    class EmptyResultsBox extends Gtk.Grid {
 
-    _init: function(mode) {
+    _init(mode) {
         this._mode = mode;
-        this.parent({ orientation: Gtk.Orientation.VERTICAL,
+        super._init({ orientation: Gtk.Orientation.VERTICAL,
                       row_spacing: 12,
                       hexpand: true,
                       vexpand: true,
@@ -255,9 +253,9 @@ const EmptyResultsBox = new Lang.Class({
         this._addSecondaryLabel();
 
         this.show_all();
-    },
+    }
 
-    _addImage: function() {
+    _addImage() {
         let iconName;
         if (this._mode == WindowMode.WindowMode.SEARCH)
             iconName = 'system-search-symbolic';
@@ -267,9 +265,9 @@ const EmptyResultsBox = new Lang.Class({
             iconName = 'x-office-document-symbolic';
 
         this.add(new Gtk.Image({ pixel_size: 128, icon_name: iconName, margin_bottom: 9 }));
-    },
+    }
 
-    _addPrimaryLabel: function() {
+    _addPrimaryLabel() {
         let text;
         if (this._mode == WindowMode.WindowMode.COLLECTIONS)
             text = _("No collections found");
@@ -279,9 +277,9 @@ const EmptyResultsBox = new Lang.Class({
         this.add(new Gtk.Label({ label: '<b><span size="large">' + text + '</span></b>',
                                  use_markup: true,
                                  margin_top: 9 }));
-    },
+    }
 
-    _addSecondaryLabel: function() {
+    _addSecondaryLabel() {
         if (this._mode == WindowMode.WindowMode.SEARCH) {
             this.add(new Gtk.Label({ label: _("Try a different search") }));
             return;
@@ -325,14 +323,13 @@ const EmptyResultsBox = new Lang.Class({
     }
 });
 
-const OverviewSearchbar = new Lang.Class({
-    Name: 'OverviewSearchbar',
-    Extends: Searchbar.Searchbar,
+const OverviewSearchbar = GObject.registerClass(
+    class OverviewSearchbar extends Searchbar.Searchbar {
 
-    _init: function(view) {
+    _init(view) {
         this._view = view;
 
-        this.parent();
+        super._init();
 
         let sourcesId = Application.sourceManager.connect('active-changed',
             Lang.bind(this, this._onActiveSourceChanged));
@@ -367,9 +364,9 @@ const OverviewSearchbar = new Lang.Class({
 
                 searchAction.disconnect(searchStateId);
             }));
-    },
+    }
 
-    createSearchWidget: function() {
+    createSearchWidget() {
         // create the search entry
         this.searchEntry = new Gd.TaggedEntry({ width_request: 500 });
         this.searchEntry.connect('tag-clicked',
@@ -403,9 +400,9 @@ const OverviewSearchbar = new Lang.Class({
         box.show_all();
 
         return box;
-    },
+    }
 
-    entryChanged: function() {
+    entryChanged() {
         let currentText = this.searchEntry.get_text();
 
         Application.searchController.disconnect(this._searchChangedId);
@@ -414,13 +411,13 @@ const OverviewSearchbar = new Lang.Class({
         // connect to search string changes in the controller
         this._searchChangedId = Application.searchController.connect('search-string-changed',
             Lang.bind(this, this._onSearchStringChanged));
-    },
+    }
 
-    _onSearchStringChanged: function(controller, string) {
+    _onSearchStringChanged(controller, string) {
         this.searchEntry.set_text(string);
-    },
+    }
 
-    _onActiveCollectionChanged: function(manager, collection) {
+    _onActiveCollectionChanged(manager, collection) {
         if (!collection)
             return;
 
@@ -431,9 +428,9 @@ const OverviewSearchbar = new Lang.Class({
             Application.searchTypeManager.setActiveItemById('all');
             this.searchEntry.set_text('');
         }
-    },
+    }
 
-    _onActiveChangedCommon: function(id, manager, tag) {
+    _onActiveChangedCommon(id, manager, tag) {
         let item = manager.getActiveItem();
 
         if (item.id == 'all') {
@@ -444,21 +441,21 @@ const OverviewSearchbar = new Lang.Class({
         }
 
         this.searchEntry.grab_focus_without_selecting();
-    },
+    }
 
-    _onActiveSourceChanged: function() {
+    _onActiveSourceChanged() {
         this._onActiveChangedCommon('source', Application.sourceManager, this._sourceTag);
-    },
+    }
 
-    _onActiveTypeChanged: function() {
+    _onActiveTypeChanged() {
         this._onActiveChangedCommon('type', Application.searchTypeManager, this._typeTag);
-    },
+    }
 
-    _onActiveMatchChanged: function() {
+    _onActiveMatchChanged() {
         this._onActiveChangedCommon('match', Application.searchMatchManager, this._matchTag);
-    },
+    }
 
-    _onTagButtonClicked: function(entry, tag) {
+    _onTagButtonClicked(entry, tag) {
         let manager = null;
 
         if (tag == this._matchTag) {
@@ -472,35 +469,34 @@ const OverviewSearchbar = new Lang.Class({
         if (manager) {
             manager.setActiveItemById('all');
         }
-    },
+    }
 
-    _onTagClicked: function() {
+    _onTagClicked() {
         this._dropdownButton.set_active(true);
-    },
+    }
 
-    _onActionStateChanged: function(action) {
+    _onActionStateChanged(action) {
         if (action.state.get_boolean())
             this.reveal();
         else
             this.conceal();
-    },
+    }
 
-    conceal: function() {
+    conceal() {
         this._dropdownButton.set_active(false);
 
         Application.searchTypeManager.setActiveItemById('all');
         Application.searchMatchManager.setActiveItemById('all');
         Application.sourceManager.setActiveItemById('all');
 
-        this.parent();
+        super.conceal();
     }
 });
 
-const OverviewToolbar = new Lang.Class({
-    Name: 'OverviewToolbar',
-    Extends: MainToolbar.MainToolbar,
+const OverviewToolbar = GObject.registerClass(
+    class OverviewToolbar extends MainToolbar.MainToolbar {
 
-    _init: function(view) {
+    _init(view) {
         this._collBackButton = null;
         this._collectionId = 0;
         this._selectionChangedId = 0;
@@ -512,7 +508,7 @@ const OverviewToolbar = new Lang.Class({
 
         this._view = view;
 
-        this.parent();
+        super._init();
 
         let builder = new Gtk.Builder();
         builder.add_from_resource('/org/gnome/Documents/ui/selection-menu.ui');
@@ -542,9 +538,9 @@ const OverviewToolbar = new Lang.Class({
                 this._clearStateData();
                 selectionModeAction.disconnect(selectionModeStateId);
             }));
-    },
+    }
 
-    _addViewMenuButton: function() {
+    _addViewMenuButton() {
         let builder = new Gtk.Builder();
         builder.add_from_resource('/org/gnome/Documents/ui/view-menu.ui');
         let viewMenu = builder.get_object('viewMenu');
@@ -557,15 +553,15 @@ const OverviewToolbar = new Lang.Class({
         this._viewSettingsId = Application.settings.connect('changed::view-as',
             Lang.bind(this, this._updateViewMenuButton));
         this._updateViewMenuButton();
-    },
+    }
 
-    _updateViewMenuButton: function() {
+    _updateViewMenuButton() {
         let viewType = Application.settings.get_enum('view-as');
         let iconName = viewType == Gd.MainViewType.ICON ? 'view-grid-symbolic' : 'view-list-symbolic';
         this._viewMenuButton.image = new Gtk.Image({ icon_name: iconName, pixel_size: 16 })
-    },
+    }
 
-    _setToolbarTitle: function() {
+    _setToolbarTitle() {
         let selectionMode = this._view.getAction('selection-mode').state.get_boolean();
         let activeCollection = Application.documentManager.getActiveCollection();
         let primary = null;
@@ -598,9 +594,9 @@ const OverviewToolbar = new Lang.Class({
         } else {
             this.toolbar.set_title(primary);
         }
-    },
+    }
 
-    _populateForSelectionMode: function() {
+    _populateForSelectionMode() {
         this.toolbar.get_style_context().add_class('selection-mode');
         this.toolbar.set_custom_title(this._selectionMenu);
 
@@ -614,9 +610,9 @@ const OverviewToolbar = new Lang.Class({
                                                Lang.bind(this, this._setToolbarTitle));
 
         this.addSearchButton('view.search');
-    },
+    }
 
-    _checkCollectionWidgets: function() {
+    _checkCollectionWidgets() {
         let customTitle;
         let item = Application.documentManager.getActiveCollection();
 
@@ -636,9 +632,9 @@ const OverviewToolbar = new Lang.Class({
         }
 
         this.toolbar.set_custom_title(customTitle);
-    },
+    }
 
-    _onActiveCollectionChanged: function(manager, activeCollection) {
+    _onActiveCollectionChanged(manager, activeCollection) {
         if (activeCollection) {
             this._infoUpdatedId = activeCollection.connect('info-updated', Lang.bind(this, 
this._setToolbarTitle));
         } else {
@@ -650,9 +646,9 @@ const OverviewToolbar = new Lang.Class({
         this._activeCollection = activeCollection;
         this._checkCollectionWidgets();
         this._setToolbarTitle();
-    },
+    }
 
-    _populateForOverview: function() {
+    _populateForOverview() {
         this.toolbar.set_show_close_button(true);
         this.toolbar.set_custom_title(this._stackSwitcher);
         this._checkCollectionWidgets();
@@ -671,9 +667,9 @@ const OverviewToolbar = new Lang.Class({
         this._collectionId =
             Application.documentManager.connect('active-collection-changed',
                                              Lang.bind(this, this._onActiveCollectionChanged));
-    },
+    }
 
-    _clearStateData: function() {
+    _clearStateData() {
         this._collBackButton = null;
         this._viewMenuButton = null;
         this.toolbar.set_custom_title(null);
@@ -697,18 +693,18 @@ const OverviewToolbar = new Lang.Class({
             Application.settings.disconnect(this._viewSettingsId);
             this._viewSettingsId = 0;
         }
-    },
+    }
 
-    _clearToolbar: function() {
+    _clearToolbar() {
         this._clearStateData();
         this.toolbar.set_show_close_button(false);
 
         this.toolbar.get_style_context().remove_class('selection-mode');
         let children = this.toolbar.get_children();
         children.forEach(function(child) { child.destroy(); });
-    },
+    }
 
-    _resetToolbarMode: function() {
+    _resetToolbarMode() {
         this._clearToolbar();
 
         let selectionMode = this._view.getAction('selection-mode').state.get_boolean();
@@ -730,24 +726,23 @@ const OverviewToolbar = new Lang.Class({
 
         if (Application.searchController.getString() != '')
             this._view.getAction('search').change_state(GLib.Variant.new('b', true));
-    },
+    }
 
-    createSearchbar: function() {
+    createSearchbar() {
         return new OverviewSearchbar(this._view);
     }
 });
 
-const ViewContainer = new Lang.Class({
-    Name: 'ViewContainer',
-    Extends: Gtk.Stack,
+const ViewContainer = GObject.registerClass(
+    class ViewContainer extends Gtk.Stack {
 
-    _init: function(overview, windowMode) {
+    _init(overview, windowMode) {
         this._edgeHitId = 0;
         this._mode = windowMode;
 
         this._model = new ViewModel(this._mode);
 
-        this.parent({ homogeneous: true,
+        super._init({ homogeneous: true,
                       transition_type: Gtk.StackTransitionType.CROSSFADE });
 
         this.view = new Gd.MainView({ shadow_type: Gtk.ShadowType.NONE });
@@ -804,14 +799,14 @@ const ViewContainer = new Lang.Class({
 
         // this will create the model if we're done querying
         this._onQueryStatusChanged();
-    },
+    }
 
-    _onViewTypeChanged: function() {
+    _onViewTypeChanged() {
         if (this.view.view_type == Gd.MainViewType.LIST)
             this._addListRenderers();
-    },
+    }
 
-    _getFirstDocument: function() {
+    _getFirstDocument() {
         let doc = null;
 
         let [success, iter] = this._model.get_iter_first();
@@ -821,9 +816,9 @@ const ViewContainer = new Lang.Class({
         }
 
         return doc;
-    },
+    }
 
-    _addListRenderers: function() {
+    _addListRenderers() {
         let listWidget = this.view.get_generic_view();
 
         let typeRenderer =
@@ -892,21 +887,21 @@ const ViewContainer = new Lang.Class({
                                                          years).format(years);
                 }
             }));
-    },
+    }
 
-    _onSelectionModeRequest: function() {
+    _onSelectionModeRequest() {
         this._selectionModeAction.change_state(GLib.Variant.new('b', true));
-    },
+    }
 
-    _onItemActivated: function(widget, id, path) {
+    _onItemActivated(widget, id, path) {
         Application.documentManager.setActiveItemById(id);
-    },
+    }
 
-    _onQueryError: function(manager, message, exception) {
+    _onQueryError(manager, message, exception) {
         this._setError(message, exception.message);
-    },
+    }
 
-    _onQueryStatusChanged: function() {
+    _onQueryStatusChanged() {
         let status = this._trackerController.getQueryStatus();
 
         if (!status) {
@@ -932,14 +927,14 @@ const ViewContainer = new Lang.Class({
             this._spinner.start();
             this.set_visible_child_name('spinner');
         }
-    },
+    }
 
-    _setError: function(primary, secondary) {
+    _setError(primary, secondary) {
         this._errorBox.update(primary, secondary);
         this.set_visible_child_name('error');
-    },
+    }
 
-    _updateSelection: function() {
+    _updateSelection() {
         let selected = Application.selectionController.getSelection();
         let newSelection = [];
 
@@ -970,14 +965,14 @@ const ViewContainer = new Lang.Class({
             }));
 
         Application.selectionController.setSelection(newSelection);
-    },
+    }
 
-    _onSelectionModeChanged: function() {
+    _onSelectionModeChanged() {
         let selectionMode = this._selectionModeAction.state.get_boolean();
         this.view.set_selection_mode(selectionMode);
-    },
+    }
 
-    _onViewSelectionChanged: function() {
+    _onViewSelectionChanged() {
         let mode = Application.modeController.getWindowMode();
         if (this._mode != mode)
             return;
@@ -986,48 +981,47 @@ const ViewContainer = new Lang.Class({
         let selectedURNs = Utils.getURNsFromPaths(this.view.get_selection(),
                                                   this._model);
         Application.selectionController.setSelection(selectedURNs);
-    },
+    }
 
-    _onWindowModeChanged: function() {
+    _onWindowModeChanged() {
         let mode = Application.modeController.getWindowMode();
         if (mode == this._mode)
             this._connectView();
         else
             this._disconnectView();
-    },
+    }
 
-    _connectView: function() {
+    _connectView() {
         this._edgeHitId = this.view.connect('edge-reached', Lang.bind(this,
             function (view, pos) {
                 if (pos == Gtk.PositionType.BOTTOM)
                     this._offsetController.increaseOffset();
             }));
-    },
+    }
 
-    _disconnectView: function() {
+    _disconnectView() {
         if (this._edgeHitId != 0) {
             this.view.disconnect(this._edgeHitId);
             this._edgeHitId = 0;
         }
-    },
+    }
 
-    activateResult: function() {
+    activateResult() {
         let doc = this._getFirstDocument();
         if (doc)
             Application.documentManager.setActiveItem(doc)
-    },
+    }
 
     get model() {
         return this._model;
     }
 });
 
-var OverviewStack = new Lang.Class({
-    Name: 'OverviewStack',
-    Extends: Gtk.Box,
+var OverviewStack = GObject.registerClass(
+    class OverviewStack extends Gtk.Box {
 
-    _init: function() {
-        this.parent({ orientation: Gtk.Orientation.VERTICAL,
+    _init() {
+        super._init({ orientation: Gtk.Orientation.VERTICAL,
                       visible: true });
 
         let actions = this._getDefaultActions();
@@ -1053,9 +1047,9 @@ var OverviewStack = new Lang.Class({
 
         this._stack.connect('notify::visible-child',
                             Lang.bind(this, this._onVisibleChildChanged));
-    },
+    }
 
-    _getDefaultActions: function() {
+    _getDefaultActions() {
         let backAccels = ['Back'];
         if (this.get_direction() == Gtk.TextDirection.LTR)
             backAccels.push('<Alt>Left');
@@ -1099,27 +1093,27 @@ var OverviewStack = new Lang.Class({
               stateChanged: Lang.bind(this, this._updateSearchMatch),
               create_hook: Lang.bind(this, this._initSearchMatch) }
         ];
-    },
+    }
 
-    _goBack: function() {
+    _goBack() {
         Application.documentManager.activatePreviousCollection();
-    },
+    }
 
-    _selectAll: function() {
+    _selectAll() {
         this.getAction('selection-mode').change_state(GLib.Variant.new('b', true));
         this.view.view.select_all();
-    },
+    }
 
-    _selectNone: function() {
+    _selectNone() {
         this.view.view.unselect_all();
-    },
+    }
 
-    _updateTypeForSettings: function() {
+    _updateTypeForSettings() {
         let viewType = Application.settings.get_enum('view-as');
         this.view.view.set_view_type(viewType);
-    },
+    }
 
-    _updateSortForSettings: function() {
+    _updateSortForSettings() {
         let sortBy = Application.settings.get_enum('sort-by');
         let sortType;
 
@@ -1140,9 +1134,9 @@ var OverviewStack = new Lang.Class({
         }
 
         this.view.model.set_sort_column_id(sortBy, sortType);
-    },
+    }
 
-    _updateSelectionMode: function(action) {
+    _updateSelectionMode(action) {
         let selectionMode = action.state.get_boolean();
 
         if (selectionMode) {
@@ -1152,42 +1146,42 @@ var OverviewStack = new Lang.Class({
             Application.application.set_accels_for_action('view.selection-mode', []);
             this._selectionToolbar.hide();
         }
-    },
+    }
 
-    _initSearchSource: function(action) {
+    _initSearchSource(action) {
         Application.sourceManager.connect('active-changed', Lang.bind(this, function(manager, activeItem) {
             action.state = GLib.Variant.new('s', activeItem.id);
         }));
-    },
+    }
 
-    _initSearchType: function(action) {
+    _initSearchType(action) {
         Application.searchTypeManager.connect('active-changed', Lang.bind(this, function(manager, 
activeItem) {
             action.state = GLib.Variant.new('s', activeItem.id);
         }));
-    },
+    }
 
-    _initSearchMatch: function(action) {
+    _initSearchMatch(action) {
         Application.searchMatchManager.connect('active-changed', Lang.bind(this, function(manager, 
activeItem) {
             action.state = GLib.Variant.new('s', activeItem.id);
         }));
-    },
+    }
 
-    _updateSearchSource: function(action) {
+    _updateSearchSource(action) {
         let itemId = action.state.get_string()[0];
         Application.sourceManager.setActiveItemById(itemId);
-    },
+    }
 
-    _updateSearchType: function(action) {
+    _updateSearchType(action) {
         let itemId = action.state.get_string()[0];
         Application.searchTypeManager.setActiveItemById(itemId);
-    },
+    }
 
-    _updateSearchMatch: function(action) {
+    _updateSearchMatch(action) {
         let itemId = action.state.get_string()[0];
         Application.searchMatchManager.setActiveItemById(itemId);
-    },
+    }
 
-    _onVisibleChildChanged: function() {
+    _onVisibleChildChanged() {
         let windowMode;
 
         if (this.view == this._collections)
@@ -1198,7 +1192,7 @@ var OverviewStack = new Lang.Class({
             return;
 
         Application.modeController.setWindowMode(windowMode);
-    },
+    }
 
     set windowMode(mode) {
         let visibleChild;
@@ -1220,23 +1214,23 @@ var OverviewStack = new Lang.Class({
         this._stack.visible_child = visibleChild;
         this._updateSortForSettings();
         this._updateTypeForSettings();
-    },
+    }
 
-    activateResult: function() {
+    activateResult() {
         this.view.activateResult();
-    },
+    }
 
-    createToolbar: function() {
+    createToolbar() {
         return new OverviewToolbar(this);
-    },
+    }
 
-    getAction: function(name) {
+    getAction(name) {
         return this.actionGroup.lookup_action(name);
-    },
+    }
 
     get stack() {
         return this._stack;
-    },
+    }
 
     get view() {
         return this._stack.visible_child;
diff --git a/src/password.js b/src/password.js
index 5a179be9..fdf43a80 100644
--- a/src/password.js
+++ b/src/password.js
@@ -19,6 +19,7 @@
  *
  */
 
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 const _ = imports.gettext.gettext;
 
@@ -26,13 +27,12 @@ const Application = imports.application;
 
 const Lang = imports.lang;
 
-var PasswordDialog = new Lang.Class({
-    Name: 'PasswordDialog',
-    Extends: Gtk.Dialog,
+var PasswordDialog = GObject.registerClass(
+    class PasswordDialog extends Gtk.Dialog {
 
-    _init: function(doc) {
+    _init(doc) {
         let toplevel = Application.application.get_windows()[0];
-        this.parent({ resizable: false,
+        super._init({ resizable: false,
                       transient_for: toplevel,
                       modal: true,
                       destroy_with_parent: true,
diff --git a/src/places.js b/src/places.js
index 0bebbde0..1c9fd5e4 100644
--- a/src/places.js
+++ b/src/places.js
@@ -17,6 +17,7 @@
  *
  */
 
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 
 const EvDocument = imports.gi.EvinceDocument;
@@ -25,13 +26,12 @@ const Application = imports.application;
 
 const Lang = imports.lang;
 
-var PlacesDialog = new Lang.Class({
-    Name: 'PlacesDialog',
-    Extends: Gtk.Dialog,
+var PlacesDialog = GObject.registerClass(
+    class PlacesDialog extends Gtk.Dialog {
 
-    _init: function(model, bookmarks) {
+    _init(model, bookmarks) {
         let toplevel = Application.application.get_windows()[0];
-        this.parent({ resizable: true,
+        super._init({ resizable: true,
                       transient_for: toplevel,
                       modal: true,
                       destroy_with_parent: true,
@@ -45,9 +45,9 @@ var PlacesDialog = new Lang.Class({
         this._bookmarks = bookmarks;
         this._createWindow();
         this.show_all();
-    },
+    }
 
-    _createWindow: function() {
+    _createWindow() {
         let contentArea = this.get_content_area();
         this._stack = new Gtk.Stack({ border_width: 5,
                                       homogeneous: true });
@@ -90,21 +90,21 @@ var PlacesDialog = new Lang.Class({
             let switcher = new Gtk.StackSwitcher({ stack: this._stack });
             header.set_custom_title(switcher);
         }
-    },
+    }
 
-    _handleLink: function(link) {
+    _handleLink(link) {
         if (link.action.type == EvDocument.LinkActionType.GOTO_DEST) {
             this._gotoDest(link.action.dest);
         }
         this.response(Gtk.ResponseType.DELETE_EVENT);
-    },
+    }
 
-    _handleBookmark: function(bookmark) {
+    _handleBookmark(bookmark) {
         this._model.set_page(bookmark.page_number);
         this.response(Gtk.ResponseType.DELETE_EVENT);
-    },
+    }
 
-    _gotoDest: function(dest) {
+    _gotoDest(dest) {
         switch (dest.type) {
         case EvDocument.LinkDestType.PAGE:
         case EvDocument.LinkDestType.XYZ:
@@ -120,9 +120,9 @@ var PlacesDialog = new Lang.Class({
             this._model.set_page_by_label(dest.page_label);
             break;
         }
-    },
+    }
 
-    _addPage: function(widget) {
+    _addPage(widget) {
         widget.document_model = this._model;
         this._stack.add_titled(widget, widget.name, widget.name);
     }
diff --git a/src/presentation.js b/src/presentation.js
index 5f0b455a..a401da25 100644
--- a/src/presentation.js
+++ b/src/presentation.js
@@ -21,6 +21,7 @@ const EvView = imports.gi.EvinceView;
 const GnomeDesktop = imports.gi.GnomeDesktop;
 const GdPrivate = imports.gi.GdPrivate;
 const Gdk = imports.gi.Gdk;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 const _ = imports.gettext.gettext;
 
@@ -28,16 +29,15 @@ const Lang = imports.lang;
 
 const Application = imports.application;
 
-var PresentationWindow = new Lang.Class({
-    Name: 'PresentationWindow',
-    Extends: Gtk.Window,
+var PresentationWindow = GObject.registerClass(
+    class PresentationWindow extends Gtk.Window {
 
-    _init: function(model) {
+    _init(model) {
         this._model = model;
         this._inhibitId = 0;
 
         let toplevel = Application.application.get_windows()[0];
-        this.parent({ type: Gtk.WindowType.TOPLEVEL,
+        super._init({ type: Gtk.WindowType.TOPLEVEL,
                       transient_for: toplevel,
                       destroy_with_parent: true,
                       title: _("Presentation"),
@@ -51,28 +51,28 @@ var PresentationWindow = new Lang.Class({
         this._createView();
         this.fullscreen();
         this.show_all();
-    },
+    }
 
-    _onPageChanged: function() {
+    _onPageChanged() {
         this.view.current_page = this._model.page;
-    },
+    }
 
-    _onPresentationPageChanged: function() {
+    _onPresentationPageChanged() {
         this._model.page = this.view.current_page;
-    },
+    }
 
-    _onKeyPressEvent: function(widget, event) {
+    _onKeyPressEvent(widget, event) {
         let keyval = event.get_keyval()[1];
         if (keyval == Gdk.KEY_Escape)
             this.close();
-    },
+    }
 
-    setOutput: function(output) {
+    setOutput(output) {
         let [x, y, width, height] = output.get_geometry();
         this.move(x, y);
-    },
+    }
 
-    _createView: function() {
+    _createView() {
         let doc = this._model.get_document();
         let inverted = this._model.inverted_colors;
         let page = this._model.page;
@@ -88,20 +88,20 @@ var PresentationWindow = new Lang.Class({
         this.view.show();
 
         this._inhibitIdle();
-    },
+    }
 
-    close: function() {
+    close() {
         this._uninhibitIdle();
         this.destroy();
-    },
+    }
 
-    _inhibitIdle: function() {
+    _inhibitIdle() {
         this._inhibitId = Application.application.inhibit(null,
                                                           Gtk.ApplicationInhibitFlags.IDLE,
                                                           _("Running in presentation mode"));
-    },
+    }
 
-    _uninhibitIdle: function() {
+    _uninhibitIdle() {
         if (this._inhibitId == 0)
             return;
 
@@ -110,18 +110,17 @@ var PresentationWindow = new Lang.Class({
     }
 });
 
-var PresentationOutputChooser = new Lang.Class({
-    Name: 'PresentationOutputChooser',
-    Extends: Gtk.Dialog,
+var PresentationOutputChooser = GObject.registerClass({
     Signals: {
         'output-activated': {
             param_types: [GnomeDesktop.RROutputInfo.$gtype]
         }
-    },
+    }
+}, class PresentationOutputChooser extends Gtk.Dialog {
 
-    _init: function(outputs) {
+    _init(outputs) {
         let toplevel = Application.application.get_windows()[0];
-        this.parent({ resizable: false,
+        super._init({ resizable: false,
                       modal: true,
                       transient_for: toplevel,
                       destroy_with_parent: true,
@@ -136,9 +135,9 @@ var PresentationOutputChooser = new Lang.Class({
         this._createWindow();
         this._populateList();
         this.show_all();
-    },
+    }
 
-    _populateList: function() {
+    _populateList() {
         let sizeGroup = new Gtk.SizeGroup({ mode: Gtk.SizeGroupMode.HORIZONTAL });
 
         for (let i = 0; i < this._outputs.list.length; i++) {
@@ -181,9 +180,9 @@ var PresentationOutputChooser = new Lang.Class({
             if (!output.is_active())
                 row.sensitive = false;
         }
-    },
+    }
 
-    _onActivated: function(box, row) {
+    _onActivated(box, row) {
         let output = row.get_child().output;
         if (!output.is_active())
             return;
@@ -191,13 +190,13 @@ var PresentationOutputChooser = new Lang.Class({
         this.output = output;
         this.emit('output-activated', this.output);
         this.close();
-    },
+    }
 
-    close: function() {
+    close() {
         this.destroy();
-    },
+    }
 
-    _createWindow: function() {
+    _createWindow() {
         this.connect('response', Lang.bind(this,
             function(widget, response) {
                 this.emit('output-activated', null);
@@ -228,10 +227,10 @@ var PresentationOutputChooser = new Lang.Class({
     }
 });
 
-var PresentationOutputs = new Lang.Class({
-    Name: 'PresentationOutputs',
+var PresentationOutputs = GObject.registerClass(
+    class PresentationOutputs extends GObject.Object {
 
-    _init: function() {
+    _init() {
         this.list = [];
 
         let gdkscreen = Gdk.Screen.get_default();
@@ -243,13 +242,13 @@ var PresentationOutputs = new Lang.Class({
         this._infos = this._config.get_outputs();
 
         this.load();
-    },
+    }
 
-    _onScreenChanged: function() {
+    _onScreenChanged() {
         this.load();
-    },
+    }
 
-    load: function() {
+    load() {
         this.list = [];
         for (let idx in this._infos) {
             let info = this._infos[idx];
diff --git a/src/preview.js b/src/preview.js
index dd3766d3..63b4795d 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -2,6 +2,7 @@ const GdPrivate = imports.gi.GdPrivate;
 const Gio = imports.gi.Gio;
 const Gdk = imports.gi.Gdk;
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 
 const Lang = imports.lang;
@@ -19,11 +20,10 @@ const Utils = imports.utils;
 const _ICON_SIZE = 32;
 const _PDF_LOADER_TIMEOUT = 400;
 
-var Preview = new Lang.Class({
-    Name: 'Preview',
-    Extends: Gtk.Stack,
+var Preview = GObject.registerClass(
+    class Preview extends Gtk.Stack {
 
-    _init: function(overlay, mainWindow) {
+    _init(overlay, mainWindow) {
         this._lastSearch = '';
         this._loadShowId = 0;
         this._controlsFlipId = 0;
@@ -33,7 +33,7 @@ var Preview = new Lang.Class({
         this.overlay = overlay;
         this.mainWindow = mainWindow;
 
-        this.parent({ homogeneous: true,
+        super._init({ homogeneous: true,
                       transition_type: Gtk.StackTransitionType.CROSSFADE });
 
         this.actionGroup = this._createActionGroup();
@@ -112,9 +112,9 @@ var Preview = new Lang.Class({
                     this._nightModeId = 0;
                 }
             }));
-    },
+    }
 
-    _getDefaultActions: function() {
+    _getDefaultActions() {
         let backAccels = ['Back'];
         if (this.get_direction() == Gtk.TextDirection.LTR)
             backAccels.push('<Alt>Left');
@@ -140,9 +140,9 @@ var Preview = new Lang.Class({
               callback: Lang.bind(this, this.goBack),
               accels: backAccels }
         ];
-    },
+    }
 
-    _properties: function() {
+    _properties() {
         let doc = Application.documentManager.getActiveItem();
         if (!doc)
             return;
@@ -151,19 +151,19 @@ var Preview = new Lang.Class({
         dialog.connect('response', Lang.bind(this, function(widget, response) {
             widget.destroy();
         }));
-    },
+    }
 
-    _openCurrent: function() {
+    _openCurrent() {
         let doc = Application.documentManager.getActiveItem();
         if (doc)
             doc.open(this.mainWindow, Gtk.get_current_event_time());
-    },
+    }
 
-    _updateNightMode: function() {
+    _updateNightMode() {
         this.nightMode = Application.settings.get_boolean('night-mode');
-    },
+    }
 
-    _onFullscreenChanged: function(action) {
+    _onFullscreenChanged(action) {
         let fullscreen = action.state.get_boolean();
 
         this.toolbar.visible = !fullscreen;
@@ -188,15 +188,15 @@ var Preview = new Lang.Class({
         }
 
         this._syncControlsVisible();
-    },
+    }
 
-    getFullscreenToolbar: function() {
+    getFullscreenToolbar() {
         return this._fsToolbar;
-    },
+    }
 
     get controlsVisible() {
         return this._controlsVisible;
-    },
+    }
 
     set controlsVisible(visible) {
         // reset any pending timeout, as we're about to change controls state
@@ -207,17 +207,17 @@ var Preview = new Lang.Class({
 
         this._controlsVisible = visible;
         this._syncControlsVisible();
-    },
+    }
 
-    _flipControlsTimeout: function() {
+    _flipControlsTimeout() {
         this._controlsFlipId = 0;
         let visible = this.controlsVisible;
         this.controlsVisible = !visible;
 
         return false;
-    },
+    }
 
-     queueControlsFlip: function() {
+     queueControlsFlip() {
          if (this._controlsFlipId)
              return;
 
@@ -225,16 +225,16 @@ var Preview = new Lang.Class({
          let doubleClick = settings.gtk_double_click_time;
 
          this._controlsFlipId = Mainloop.timeout_add(doubleClick, Lang.bind(this, 
this._flipControlsTimeout));
-     },
+     }
 
-     cancelControlsFlip: function() {
+     cancelControlsFlip() {
          if (this._controlsFlipId != 0) {
              Mainloop.source_remove(this._controlsFlipId);
              this._controlsFlipId = 0;
          }
-     },
+     }
 
-    _syncControlsVisible: function() {
+    _syncControlsVisible() {
         if (this._controlsVisible) {
             if (this._fsToolbar)
                 this._fsToolbar.reveal();
@@ -242,9 +242,9 @@ var Preview = new Lang.Class({
             if (this._fsToolbar)
                 this._fsToolbar.conceal();
         }
-    },
+    }
 
-    _createActionGroup: function() {
+    _createActionGroup() {
         let actions = this.createActions().concat(this._getDefaultActions());
         let actionGroup = new Gio.SimpleActionGroup();
         Utils.populateActionGroup(actionGroup, actions, 'view');
@@ -257,47 +257,47 @@ var Preview = new Lang.Class({
         }
 
         return actionGroup;
-    },
+    }
 
-    createActions: function() {
+    createActions() {
         return [];
-    },
+    }
 
-    createNavControls: function() {
+    createNavControls() {
         return new PreviewNavControls(this, this.overlay);
-    },
+    }
 
-    activateResult: function() {
+    activateResult() {
         this.findNext();
-    },
+    }
 
-    createFullscreenToolbar: function() {
+    createFullscreenToolbar() {
         return new PreviewFullscreenToolbar(this);
-    },
+    }
 
-    createToolbar: function() {
+    createToolbar() {
         return new PreviewToolbar(this);
-    },
+    }
 
-    createView: function() {
+    createView() {
         throw(new Error('Not implemented'));
-    },
+    }
 
-    createContextMenu: function() {
+    createContextMenu() {
         let builder = new Gtk.Builder();
         builder.add_from_resource('/org/gnome/Documents/ui/preview-context-menu.ui');
         let model = builder.get_object('preview-context-menu');
         return Gtk.Menu.new_from_model(model);
-    },
+    }
 
-    _clearLoadTimer: function() {
+    _clearLoadTimer() {
         if (this._loadShowId != 0) {
             Mainloop.source_remove(this._loadShowId);
             this._loadShowId = 0;
         }
-    },
+    }
 
-    onPasswordNeeded: function(manager, doc) {
+    onPasswordNeeded(manager, doc) {
         this._clearLoadTimer();
         this._spinner.stop();
 
@@ -307,9 +307,9 @@ var Preview = new Lang.Class({
             if (response == Gtk.ResponseType.CANCEL || response == Gtk.ResponseType.DELETE_EVENT)
                 Application.documentManager.setActiveItem(null);
         }));
-    },
+    }
 
-    onLoadStarted: function(manager, doc) {
+    onLoadStarted(manager, doc) {
         this._clearLoadTimer();
         this._loadShowId = Mainloop.timeout_add(_PDF_LOADER_TIMEOUT, Lang.bind(this, function() {
             this._loadShowId = 0;
@@ -318,95 +318,94 @@ var Preview = new Lang.Class({
             this._spinner.start();
             return false;
         }));
-    },
+    }
 
-    onLoadFinished: function(manager, doc) {
+    onLoadFinished(manager, doc) {
         this._clearLoadTimer();
         this._spinner.stop();
 
         this.set_visible_child_name('view');
         this.getAction('open-current').enabled = (doc.defaultAppName != null);
         this._updateNightMode();
-    },
+    }
 
-    onLoadError: function(manager, doc, message, exception) {
+    onLoadError(manager, doc, message, exception) {
         this._clearLoadTimer();
         this._spinner.stop();
 
         this._errorBox.update(message, exception.message);
         this.set_visible_child_name('error');
-    },
+    }
 
-    getAction: function(name) {
+    getAction(name) {
         return this.actionGroup.lookup_action(name);
-    },
+    }
 
-    goBack: function() {
+    goBack() {
         Application.documentManager.setActiveItem(null);
         Application.modeController.goBack();
-    },
+    }
 
-    goPrev: function() {
+    goPrev() {
         throw (new Error('Not implemented'));
-    },
+    }
 
-    goNext: function() {
+    goNext() {
         throw (new Error('Not implemented'));
-    },
+    }
 
     get hasPages() {
         return false;
-    },
+    }
 
     get page() {
         return 0;
-    },
+    }
 
     get numPages() {
         return 0;
-    },
+    }
 
-    search: function(str) {
+    search(str) {
         this._lastSearch = str;
-    },
+    }
 
     get lastSearch() {
         return this._lastSearch;
-    },
+    }
 
     get fullscreen() {
         if (!this.canFullscreen)
             return false;
 
         return this.getAction('fullscreen').state.get_boolean();
-    },
+    }
 
     get canFullscreen() {
         return false;
-    },
+    }
 
     set nightMode(v) {
         // do nothing
-    },
+    }
 
-    findPrev: function() {
+    findPrev() {
         throw (new Error('Not implemented'));
-    },
+    }
 
-    findNext: function() {
+    findNext() {
         throw (new Error('Not implemented'));
     }
 });
 
-var PreviewToolbar = new Lang.Class({
-    Name: 'PreviewToolbar',
-    Extends: MainToolbar.MainToolbar,
+var PreviewToolbar = GObject.registerClass(
+    class PreviewToolbar extends MainToolbar.MainToolbar {
 
-    _init: function(preview) {
+    _init(preview) {
         this._fsStateId = 0;
         this.preview = preview;
 
-        this.parent();
+        super._init();
         this.toolbar.set_show_close_button(true);
 
         // back button, on the left of the toolbar
@@ -425,9 +424,9 @@ var PreviewToolbar = new Lang.Class({
             if (this._fsStateId > 0)
                 this.preview.getAction('fullscreen').disconnect(this._fsStateId);
         }));
-    },
+    }
 
-    _getPreviewMenu: function() {
+    _getPreviewMenu() {
         let builder = new Gtk.Builder();
         builder.add_from_resource('/org/gnome/Documents/ui/preview-menu.ui');
         let menu = builder.get_object('preview-menu');
@@ -440,18 +439,18 @@ var PreviewToolbar = new Lang.Class({
         }
 
         return menu;
-    },
+    }
 
-    _addNightmodeButton: function() {
+    _addNightmodeButton() {
         let nightmodeButton = new Gtk.ToggleButton({ image: new Gtk.Image ({ icon_name: 
'display-brightness-symbolic' }),
                                                      tooltip_text: _("Night Mode"),
                                                      action_name: 'app.night-mode',
                                                      visible: true });
         this.toolbar.pack_end(nightmodeButton);
         return nightmodeButton;
-    },
+    }
 
-    _addFullscreenButton: function() {
+    _addFullscreenButton() {
         this._fullscreenButton = new Gtk.Button({ image: new Gtk.Image ({ icon_name: 
'view-fullscreen-symbolic' }),
                                                   tooltip_text: _("Fullscreen"),
                                                   action_name: 'view.fullscreen',
@@ -461,9 +460,9 @@ var PreviewToolbar = new Lang.Class({
         let action = this.preview.getAction('fullscreen');
         this._fsStateId = action.connect('notify::state', Lang.bind(this, this._fullscreenStateChanged));
         this._fullscreenStateChanged();
-    },
+    }
 
-    _fullscreenStateChanged: function() {
+    _fullscreenStateChanged() {
         let action = this.preview.getAction('fullscreen');
         let fullscreen = action.state.get_boolean();
 
@@ -471,13 +470,13 @@ var PreviewToolbar = new Lang.Class({
             this._fullscreenButton.image.icon_name = 'view-restore-symbolic';
         else
             this._fullscreenButton.image.icon_name = 'view-fullscreen-symbolic';
-    },
+    }
 
-    createSearchbar: function() {
+    createSearchbar() {
         return new PreviewSearchbar(this.preview);
-    },
+    }
 
-    updateTitle: function() {
+    updateTitle() {
         let primary = null;
         let doc = Application.documentManager.getActiveItem();
 
@@ -488,15 +487,14 @@ var PreviewToolbar = new Lang.Class({
     }
 });
 
-const PreviewFullscreenToolbar = new Lang.Class({
-    Name: 'PreviewFullscreenToolbar',
-    Extends: Gtk.Revealer,
+const PreviewFullscreenToolbar = GObject.registerClass({
     Signals: {
         'show-controls': {}
-    },
+    }
+}, class PreviewFullscreenToolbar extends Gtk.Revealer {
 
-    _init: function(preview) {
-        this.parent({ valign: Gtk.Align.START });
+    _init(preview) {
+        super._init({ valign: Gtk.Align.START });
 
         this.toolbar = preview.createToolbar();
 
@@ -524,17 +522,17 @@ const PreviewFullscreenToolbar = new Lang.Class({
                 preview.actionGroup.disconnect(signalId);
             });
         }));
-    },
+    }
 
-    handleEvent: function(event) {
+    handleEvent(event) {
         this.toolbar.handleEvent(event);
-    },
+    }
 
-    reveal: function() {
+    reveal() {
         this.set_reveal_child(true);
-    },
+    }
 
-    conceal: function() {
+    conceal() {
         this.set_reveal_child(false);
         this.toolbar.preview.getAction('find').change_state(GLib.Variant.new('b', false));
     }
@@ -543,10 +541,10 @@ const PreviewFullscreenToolbar = new Lang.Class({
 const _AUTO_HIDE_TIMEOUT = 2;
 var PREVIEW_NAVBAR_MARGIN = 30;
 
-var PreviewNavControls = new Lang.Class({
-    Name: 'PreviewNavControls',
+var PreviewNavControls = GObject.registerClass(
+    class PreviewNavControls extends GObject.Object {
 
-    _init: function(preview, overlay) {
+    _init(preview, overlay) {
         this._barRevealer = null;
         this.preview = preview;
         this._overlay = overlay;
@@ -615,32 +613,32 @@ var PreviewNavControls = new Lang.Class({
                                                        widget: this.preview.view });
         this._tapGesture.connect('released', Lang.bind(this, this._onMultiPressReleased));
         this._tapGesture.connect('stopped', Lang.bind(this, this._onMultiPressStopped));
-    },
+    }
 
-    createBarWidget: function() {
+    createBarWidget() {
         return null;
-    },
+    }
 
-    _onEnterNotify: function() {
+    _onEnterNotify() {
         this._unqueueAutoHide();
         return false;
-    },
+    }
 
-    _onLeaveNotify: function() {
+    _onLeaveNotify() {
         this._queueAutoHide();
         return false;
-    },
+    }
 
-    _motionTimeout: function() {
+    _motionTimeout() {
         this._motionId = 0;
         this._visibleInternal = true;
         this._updateVisibility();
         if (this.barWidget && !this.barWidget.hover)
             this._queueAutoHide();
         return false;
-    },
+    }
 
-    _onMotion: function(widget, event) {
+    _onMotion(widget, event) {
         if (this._motionId != 0)
             return false;
 
@@ -650,48 +648,48 @@ var PreviewNavControls = new Lang.Class({
 
         this._motionId = Mainloop.idle_add(Lang.bind(this, this._motionTimeout));
         return false;
-    },
+    }
 
-    _onMultiPressReleased: function() {
+    _onMultiPressReleased() {
         this._tapGesture.set_state(Gtk.EventSequenceState.CLAIMED);
         this._visibleInternal = !this._visibleInternal;
         this._unqueueAutoHide();
         this._updateVisibility();
-    },
+    }
 
-    _onMultiPressStopped: function() {
+    _onMultiPressStopped() {
         this._tapGesture.set_state(Gtk.EventSequenceState.DENIED);
-    },
+    }
 
-    _onPrevClicked: function() {
+    _onPrevClicked() {
         this.preview.goPrev();
-    },
+    }
 
-    _onNextClicked: function() {
+    _onNextClicked() {
         this.preview.goNext();
-    },
+    }
 
-    _autoHide: function() {
+    _autoHide() {
         this._autoHideId = 0;
         this._visibleInternal = false;
         this._updateVisibility();
         return false;
-    },
+    }
 
-    _unqueueAutoHide: function() {
+    _unqueueAutoHide() {
         if (this._autoHideId == 0)
             return;
 
         Mainloop.source_remove(this._autoHideId);
         this._autoHideId = 0;
-    },
+    }
 
-    _queueAutoHide: function() {
+    _queueAutoHide() {
         this._unqueueAutoHide();
         this._autoHideId = Mainloop.timeout_add_seconds(_AUTO_HIDE_TIMEOUT, Lang.bind(this, this._autoHide));
-    },
+    }
 
-    _updateVisibility: function() {
+    _updateVisibility() {
         let currentPage = this.preview.page;
         let numPages = this.preview.numPages;
 
@@ -708,22 +706,22 @@ var PreviewNavControls = new Lang.Class({
 
         this._prevRevealer.reveal_child = currentPage > 0;
         this._nextRevealer.reveal_child = numPages > currentPage + 1;
-    },
+    }
 
-    show: function() {
+    show() {
         this._visible = true;
         this._visibleInternal = true;
         this._updateVisibility();
         this._queueAutoHide();
-    },
+    }
 
-    hide: function() {
+    hide() {
         this._visible = false;
         this._visibleInternal = false;
         this._updateVisibility();
-    },
+    }
 
-    destroy: function() {
+    destroy() {
         if (this._barRevealer)
             this._barRevealer.destroy();
         this._prevRevealer.destroy();
@@ -732,22 +730,21 @@ var PreviewNavControls = new Lang.Class({
     }
 });
 
-var PreviewSearchbar = new Lang.Class({
-    Name: 'PreviewSearchbar',
-    Extends: Searchbar.Searchbar,
+var PreviewSearchbar = GObject.registerClass(
+    class PreviewSearchbar extends Searchbar.Searchbar {
 
-    _init: function(preview) {
+    _init(preview) {
         this.preview = preview;
 
-        this.parent();
+        super._init();
 
         this.connect('notify::search-mode-enabled', Lang.bind(this, function() {
             let action = this.preview.getAction('find');
             action.change_state(GLib.Variant.new('b', this.search_mode_enabled));
         }));
-    },
+    }
 
-    createSearchWidget: function() {
+    createSearchWidget() {
         let box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL,
                                 halign: Gtk.Align.CENTER});
         box.get_style_context().add_class('linked');
@@ -771,14 +768,14 @@ var PreviewSearchbar = new Lang.Class({
         box.add(this._next);
 
         return box;
-    },
+    }
 
-    entryChanged: function() {
+    entryChanged() {
         this.preview.search(this.searchEntry.get_text());
-    },
+    }
 
-    reveal: function() {
-        this.parent();
+    reveal() {
+        super.reveal();
 
         if (!this.searchEntry.get_text()) {
             this.searchEntry.set_text(this.preview.lastSearch);
@@ -786,11 +783,11 @@ var PreviewSearchbar = new Lang.Class({
         }
 
         this.preview.search(this.searchEntry.get_text());
-    },
+    }
 
-    conceal: function() {
+    conceal() {
         this.searchChangeBlocked = true;
-        this.parent();
+        super.conceal();
         this.searchChangeBlocked = false;
     }
 });
diff --git a/src/properties.js b/src/properties.js
index 3647ef35..17bde5e5 100644
--- a/src/properties.js
+++ b/src/properties.js
@@ -21,6 +21,7 @@
  */
 
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 const Pango = imports.gi.Pango;
 const _ = imports.gettext.gettext;
@@ -35,11 +36,10 @@ const Lang = imports.lang;
 
 const _TITLE_ENTRY_TIMEOUT = 200;
 
-var PropertiesDialog = new Lang.Class({
-    Name: 'PropertiesDialog',
-    Extends: Gtk.Dialog,
+var PropertiesDialog = GObject.registerClass(
+    class PropertiesDialog extends Gtk.Dialog {
 
-    _init: function(urn) {
+    _init(urn) {
         let doc = Application.documentManager.getItemById(urn);
 
         let dateModified = GLib.DateTime.new_from_unix_local(doc.mtime);
@@ -52,7 +52,7 @@ var PropertiesDialog = new Lang.Class({
         }
 
         let toplevel = Application.application.get_windows()[0];
-        this.parent({ resizable: false,
+        super._init({ resizable: false,
                       transient_for: toplevel,
                       modal: true,
                       destroy_with_parent: true,
diff --git a/src/query.js b/src/query.js
index d296e718..6b8bbb7f 100644
--- a/src/query.js
+++ b/src/query.js
@@ -23,6 +23,7 @@ const Gd = imports.gi.Gd;
 const GdPrivate = imports.gi.GdPrivate;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const Lang = imports.lang;
 const Search = imports.search;
 
@@ -51,19 +52,19 @@ var QueryFlags = {
 
 var LOCAL_DOCUMENTS_COLLECTIONS_IDENTIFIER = 'gd:collection:local:';
 
-var QueryBuilder = new Lang.Class({
-    Name: 'QueryBuilder',
+var QueryBuilder = GObject.registerClass(
+    class QueryBuilder extends GObject.Object {
 
-    _init: function(context) {
+    _init(context) {
         this._context = context;
-    },
+    }
 
-    _createQuery: function(sparql) {
+    _createQuery(sparql) {
         return { sparql: sparql,
                  activeSource: this._context.sourceManager.getActiveItem() };
-    },
+    }
 
-    _buildFilterString: function(currentType, flags, isFtsEnabled) {
+    _buildFilterString(currentType, flags, isFtsEnabled) {
         let filters = [];
 
         if (!isFtsEnabled)
@@ -75,17 +76,17 @@ var QueryBuilder = new Lang.Class({
         }
 
         return 'FILTER (' + filters.join(' && ') + ')';
-    },
+    }
 
-    _buildOptional: function() {
+    _buildOptional() {
         let sparql =
             'OPTIONAL { ?urn nco:creator ?creator . } ' +
             'OPTIONAL { ?urn nco:publisher ?publisher . } ';
 
         return sparql;
-    },
+    }
 
-    _addWhereClauses: function(partsList, global, flags, searchTypes, ftsQuery) {
+    _addWhereClauses(partsList, global, flags, searchTypes, ftsQuery) {
         // build an array of WHERE clauses; each clause maps to one
         // type of resource we're looking for.
         searchTypes.forEach(Lang.bind(this,
@@ -103,9 +104,9 @@ var QueryBuilder = new Lang.Class({
                 part += ' }';
                 partsList.push(part);
             }));
-    },
+    }
 
-    _buildWhere: function(global, flags) {
+    _buildWhere(global, flags) {
         let whereSparql = 'WHERE { ';
         let whereParts = [];
         let searchTypes = [];
@@ -142,9 +143,9 @@ var QueryBuilder = new Lang.Class({
         whereSparql += ' }';
 
         return whereSparql;
-    },
+    }
 
-    _buildQueryInternal: function(global, flags, offsetController, sortBy) {
+    _buildQueryInternal(global, flags, offsetController, sortBy) {
         let whereSparql = this._buildWhere(global, flags);
         let tailSparql = '';
 
@@ -194,28 +195,28 @@ var QueryBuilder = new Lang.Class({
             whereSparql + tailSparql;
 
         return sparql;
-    },
+    }
 
-    buildSingleQuery: function(flags, resource) {
+    buildSingleQuery(flags, resource) {
         let sparql = this._buildQueryInternal(false, flags, null);
         sparql = sparql.replace(/\?urn/g, '<' + resource + '>');
 
         return this._createQuery(sparql);
-    },
+    }
 
-    buildGlobalQuery: function(flags, offsetController, sortBy) {
+    buildGlobalQuery(flags, offsetController, sortBy) {
         return this._createQuery(this._buildQueryInternal(true, flags, offsetController, sortBy));
-    },
+    }
 
-    buildCountQuery: function(flags) {
+    buildCountQuery(flags) {
         let sparql = 'SELECT DISTINCT COUNT(?urn) ' +
             this._buildWhere(true, flags);
 
         return this._createQuery(sparql);
-    },
+    }
 
     // queries for all the items which are part of the given collection
-    buildCollectionIconQuery: function(resource) {
+    buildCollectionIconQuery(resource) {
         let sparql =
             ('SELECT ' +
              '?urn ' +
@@ -225,10 +226,10 @@ var QueryBuilder = new Lang.Class({
              'LIMIT 4').replace(/\?collUrn/, '<' + resource + '>');
 
         return this._createQuery(sparql);
-    },
+    }
 
     // queries for all the collections the given item is part of
-    buildFetchCollectionsQuery: function(resource) {
+    buildFetchCollectionsQuery(resource) {
         let sparql =
             ('SELECT ' +
              '?urn ' +
@@ -236,25 +237,25 @@ var QueryBuilder = new Lang.Class({
             ).replace(/\?docUrn/, '<' + resource + '>');
 
         return this._createQuery(sparql);
-    },
+    }
 
     // adds or removes the given item to the given collection
-    buildSetCollectionQuery: function(itemUrn, collectionUrn, setting) {
+    buildSetCollectionQuery(itemUrn, collectionUrn, setting) {
         let sparql = ('%s { <%s> nie:isPartOf <%s> }'
                      ).format((setting ? 'INSERT' : 'DELETE'), itemUrn, collectionUrn);
         return this._createQuery(sparql);
-    },
+    }
 
     // bumps the mtime to current time for the given resource
-    buildUpdateMtimeQuery: function(resource) {
+    buildUpdateMtimeQuery(resource) {
         let time = GdPrivate.iso8601_from_timestamp(GLib.get_real_time() / GLib.USEC_PER_SEC);
         let sparql = ('INSERT OR REPLACE { <%s> nie:contentLastModified \"%s\" }'
                      ).format(resource, time);
 
         return this._createQuery(sparql);
-    },
+    }
 
-    buildCreateCollectionQuery: function(name) {
+    buildCreateCollectionQuery(name) {
         let time = GdPrivate.iso8601_from_timestamp(GLib.get_real_time() / GLib.USEC_PER_SEC);
         let sparql = ('INSERT { _:res a nfo:DataContainer ; a nie:DataObject ; ' +
                       'nie:contentLastModified \"' + time + '\" ; ' +
@@ -262,9 +263,9 @@ var QueryBuilder = new Lang.Class({
                       'nao:identifier \"' + LOCAL_DOCUMENTS_COLLECTIONS_IDENTIFIER + name + '\" }');
 
         return this._createQuery(sparql);
-    },
+    }
 
-    buildDeleteResourceQuery: function(resource) {
+    buildDeleteResourceQuery(resource) {
         let sparql = ('DELETE { <%s> a rdfs:Resource }').format(resource);
 
         return this._createQuery(sparql);
diff --git a/src/search.js b/src/search.js
index 281bb4cf..1f99e228 100644
--- a/src/search.js
+++ b/src/search.js
@@ -29,6 +29,7 @@ const Signals = imports.signals;
 
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const Tracker = imports.gi.Tracker;
 const _ = imports.gettext.gettext;
 const C_ = imports.gettext.pgettext;
@@ -42,10 +43,10 @@ function initSearch(context) {
     context.queryBuilder = new Query.QueryBuilder(context);
 };
 
-const SearchState = new Lang.Class({
-    Name: 'SearchState',
+const SearchState = GObject.registerClass(
+    class SearchState extends GObject.Object {
 
-    _init: function(searchMatch, searchType, source, str) {
+    _init(searchMatch, searchType, source, str) {
         this.searchMatch = searchMatch;
         this.searchType = searchType;
         this.source = source;
@@ -53,26 +54,26 @@ const SearchState = new Lang.Class({
     }
 });
 
-const SearchController = new Lang.Class({
-    Name: 'SearchController',
+const SearchController = GObject.registerClass(
+    class SearchController extends GObject.Object {
 
-    _init: function() {
+    _init() {
         this._string = '';
-    },
+    }
 
-    setString: function(string) {
+    setString(string) {
         if (this._string == string)
             return;
 
         this._string = string;
         this.emit('search-string-changed', this._string);
-    },
+    }
 
-    getString: function() {
+    getString() {
         return this._string;
-    },
+    }
 
-    getTerms: function() {
+    getTerms() {
         let escapedStr = Tracker.sparql_escape_string(this._string);
         let [tokens, ] = GLib.str_tokenize_and_fold(escapedStr, null);
         return tokens;
@@ -80,21 +81,21 @@ const SearchController = new Lang.Class({
 });
 Signals.addSignalMethods(SearchController.prototype);
 
-const SearchType = new Lang.Class({
-    Name: 'SearchType',
+const SearchType = GObject.registerClass(
+    class SearchType extends GObject.Object {
 
-    _init: function(params) {
+    _init(params) {
         this.id = params.id;
         this.name = params.name;
         this._filter = (params.filter) ? (params.filter) : '(true)';
         this._where = (params.where) ? (params.where) : '';
-    },
+    }
 
-    getFilter: function() {
+    getFilter() {
         return this._filter;
-    },
+    }
 
-    getWhere: function() {
+    getWhere() {
         return this._where;
     }
 });
@@ -108,14 +109,13 @@ var SearchTypeStock = {
     TEXTDOCS: 'textdocs'
 };
 
-const SearchTypeManager = new Lang.Class({
-    Name: 'SearchTypeManager',
-    Extends: Manager.BaseManager,
+const SearchTypeManager = GObject.registerClass(
+    class SearchTypeManager extends Manager.BaseManager {
 
-    _init: function(context) {
+    _init(context) {
         // Translators: "Type" refers to a search filter on the document type
         // (PDF, spreadsheet, ...)
-        this.parent(C_("Search Filter", "Type"), 'search-type', context);
+        super._init(C_("Search Filter", "Type"), 'search-type', context);
 
         this.addItem(new SearchType({ id: SearchTypeStock.ALL,
                                       name: _("All") }));
@@ -140,18 +140,18 @@ const SearchTypeManager = new Lang.Class({
                                       where: '?urn rdf:type nfo:PaginatedTextDocument .' }));
 
         this.setActiveItemById(SearchTypeStock.ALL);
-    },
+    }
 
-    getCurrentTypes: function() {
+    getCurrentTypes() {
         let activeItem = this.getActiveItem();
 
         if (activeItem.id == SearchTypeStock.ALL)
             return this.getAllTypes();
 
         return [ activeItem ];
-    },
+    }
 
-    getDocumentTypes: function() {
+    getDocumentTypes() {
         let types = [];
 
         types.push(this.getItemById(SearchTypeStock.PDF));
@@ -160,9 +160,9 @@ const SearchTypeManager = new Lang.Class({
         types.push(this.getItemById(SearchTypeStock.TEXTDOCS));
 
         return types;
-    },
+    }
 
-    getAllTypes: function() {
+    getAllTypes() {
         let types = [];
 
         this.forEachItem(function(item) {
@@ -181,20 +181,20 @@ var SearchMatchStock = {
     CONTENT: 'content'
 };
 
-const SearchMatch = new Lang.Class({
-    Name: 'SearchMatch',
+const SearchMatch = GObject.registerClass(
+    class SearchMatch extends GObject.Object {
 
-    _init: function(params) {
+    _init(params) {
         this.id = params.id;
         this.name = params.name;
         this._term = '';
-    },
+    }
 
-    setFilterTerm: function(term) {
+    setFilterTerm(term) {
         this._term = term;
-    },
+    }
 
-    getFilter: function() {
+    getFilter() {
         if (this.id == SearchMatchStock.TITLE)
             return ('fn:contains ' +
                     '(tracker:unaccent(tracker:case-fold' +
@@ -219,15 +219,14 @@ const SearchMatch = new Lang.Class({
     }
 });
 
-const SearchMatchManager = new Lang.Class({
-    Name: 'SearchMatchManager',
-    Extends: Manager.BaseManager,
+const SearchMatchManager = GObject.registerClass(
+    class SearchMatchManager extends Manager.BaseManager {
 
-    _init: function(context) {
+    _init(context) {
         // Translators: this is a verb that refers to "All", "Title", "Author",
         // and "Content" as in "Match All", "Match Title", "Match Author", and
         // "Match Content"
-        this.parent(_("Match"), 'search-match', context);
+        super._init(_("Match"), 'search-match', context);
 
         this.addItem(new SearchMatch({ id: SearchMatchStock.ALL,
                                        name: _("All") }));
@@ -242,9 +241,9 @@ const SearchMatchManager = new Lang.Class({
                                        name: C_("Search Filter", "Content") }));
 
         this.setActiveItemById(SearchMatchStock.ALL);
-    },
+    }
 
-    getWhere: function() {
+    getWhere() {
         let item = this.getActiveItem();
         if (item.id != SearchMatchStock.ALL &&
             item.id != SearchMatchStock.CONTENT)
@@ -261,9 +260,9 @@ const SearchMatchManager = new Lang.Class({
         }
 
         return '?urn fts:match \'%s\' . '.format(ftsterms.join(' '));
-    },
+    }
 
-    getFilter: function(flags) {
+    getFilter(flags) {
         if ((flags & Query.QueryFlags.SEARCH) == 0)
             return '(true)';
 
@@ -297,10 +296,10 @@ var SearchSourceStock = {
 const TRACKER_SCHEMA = 'org.freedesktop.Tracker.Miner.Files';
 const TRACKER_KEY_RECURSIVE_DIRECTORIES = 'index-recursive-directories';
 
-const Source = new Lang.Class({
-    Name: 'Source',
+const Source = GObject.registerClass(
+    class Source extends GObject.Object {
 
-    _init: function(params) {
+    _init(params) {
         this.id = null;
         this.name = null;
         this.icon = null;
@@ -318,16 +317,16 @@ const Source = new Lang.Class({
         }
 
         this.builtin = params.builtin;
-    },
+    }
 
-    _getGettingStartedLocations: function() {
+    _getGettingStartedLocations() {
         if (Application.application.gettingStartedLocation)
             return Application.application.gettingStartedLocation;
         else
             return [];
-    },
+    }
 
-    _getTrackerLocations: function() {
+    _getTrackerLocations() {
         let settings = new Gio.Settings({ schema_id: TRACKER_SCHEMA });
         let locations = settings.get_strv(TRACKER_KEY_RECURSIVE_DIRECTORIES);
         let files = [];
@@ -355,9 +354,9 @@ const Source = new Lang.Class({
             }));
 
         return files;
-    },
+    }
 
-    _getBuiltinLocations: function() {
+    _getBuiltinLocations() {
         let files = [];
         let xdgDirs = [GLib.UserDirectory.DIRECTORY_DESKTOP,
                        GLib.UserDirectory.DIRECTORY_DOCUMENTS,
@@ -371,9 +370,9 @@ const Source = new Lang.Class({
             }));
 
         return files;
-    },
+    }
 
-    _buildFilterLocal: function() {
+    _buildFilterLocal() {
         let locations = this._getBuiltinLocations();
         locations = locations.concat(
             this._getTrackerLocations(),
@@ -388,9 +387,9 @@ const Source = new Lang.Class({
         filters.push('(fn:starts-with (nao:identifier(?urn), "gd:collection:local:"))');
 
         return '(' + filters.join(' || ') + ')';
-    },
+    }
 
-    getFilter: function() {
+    getFilter() {
         let filters = [];
 
         if (this.id == SearchSourceStock.LOCAL) {
@@ -403,9 +402,9 @@ const Source = new Lang.Class({
         }
 
         return '(' + filters.join(' || ') + ')';
-    },
+    }
 
-    _buildFilterResource: function() {
+    _buildFilterResource() {
         let filter = '(false)';
 
         if (!this.builtin)
@@ -415,12 +414,11 @@ const Source = new Lang.Class({
     }
 });
 
-const SourceManager = new Lang.Class({
-    Name: 'SourceManager',
-    Extends: Manager.BaseManager,
+const SourceManager = GObject.registerClass(
+    class SourceManager extends Manager.BaseManager {
 
-    _init: function(context) {
-        this.parent(_("Sources"), 'search-source', context);
+    _init(context) {
+        super._init(_("Sources"), 'search-source', context);
 
         let source = new Source({ id: SearchSourceStock.ALL,
         // Translators: this refers to documents
@@ -441,9 +439,9 @@ const SourceManager = new Lang.Class({
         this._refreshGoaAccounts();
 
         this.setActiveItemById(SearchSourceStock.ALL);
-    },
+    }
 
-    _refreshGoaAccounts: function() {
+    _refreshGoaAccounts() {
         let newItems = {};
         let newSources = new Map();
         let accounts = Application.goaClient.get_accounts();
@@ -483,9 +481,9 @@ const SourceManager = new Lang.Class({
         });
 
         this.processNewItems(newItems);
-    },
+    }
 
-    getFilter: function(flags) {
+    getFilter(flags) {
         let item;
 
         if (flags & Query.QueryFlags.SEARCH)
@@ -501,9 +499,9 @@ const SourceManager = new Lang.Class({
             filter = item.getFilter();
 
         return filter;
-    },
+    }
 
-    getFilterNotLocal: function() {
+    getFilterNotLocal() {
         let sources = this.getItems();
         let filters = [];
 
@@ -517,9 +515,9 @@ const SourceManager = new Lang.Class({
             filters.push('false');
 
         return '(' + filters.join(' || ') + ')';
-    },
+    }
 
-    hasOnlineSources: function() {
+    hasOnlineSources() {
         let hasOnline = false;
         this.forEachItem(
             function(source) {
@@ -528,14 +526,14 @@ const SourceManager = new Lang.Class({
             });
 
         return hasOnline;
-    },
+    }
 
-    hasProviderType: function(providerType) {
+    hasProviderType(providerType) {
         let items = this.getForProviderType(providerType);
         return (items.length > 0);
-    },
+    }
 
-    getForProviderType: function(providerType) {
+    getForProviderType(providerType) {
         let items = [];
         this.forEachItem(Lang.bind(this,
             function(source) {
@@ -553,22 +551,22 @@ const SourceManager = new Lang.Class({
 
 var OFFSET_STEP = 50;
 
-const OffsetController = new Lang.Class({
-    Name: 'OffsetController',
+const OffsetController = GObject.registerClass(
+    class OffsetController extends GObject.Object {
 
-    _init: function() {
+    _init() {
         this._offset = 0;
         this._itemCount = 0;
-    },
+    }
 
     // to be called by the view
-    increaseOffset: function() {
+    increaseOffset() {
         this._offset += OFFSET_STEP;
         this.emit('offset-changed', this._offset);
-    },
+    }
 
     // to be called by the model
-    resetItemCount: function() {
+    resetItemCount() {
         let query = this.getQuery();
 
         Application.connectionQueue.add
@@ -594,44 +592,43 @@ const OffsetController = new Lang.Class({
                             cursor.close();
                         }));
                 }));
-    },
+    }
 
-    getQuery: function() {
+    getQuery() {
         log('Error: OffsetController implementations must override getQuery');
-    },
+    }
 
     // to be called by the model
-    resetOffset: function() {
+    resetOffset() {
         this._offset = 0;
-    },
+    }
 
-    getItemCount: function() {
+    getItemCount() {
         return this._itemCount;
-    },
+    }
 
-    getRemainingDocs: function() {
+    getRemainingDocs() {
         return (this._itemCount - (this._offset + OFFSET_STEP));
-    },
+    }
 
-    getOffsetStep: function() {
+    getOffsetStep() {
         return OFFSET_STEP;
-    },
+    }
 
-    getOffset: function() {
+    getOffset() {
         return this._offset;
     }
 });
 Signals.addSignalMethods(OffsetController.prototype);
 
-var OffsetCollectionsController = new Lang.Class({
-    Name: 'OffsetCollectionsController',
-    Extends: OffsetController,
+var OffsetCollectionsController = GObject.registerClass(
+    class OffsetCollectionsController extends OffsetController {
 
-    _init: function() {
-        this.parent();
-    },
+    _init() {
+        super._init();
+    }
 
-    getQuery: function() {
+    getQuery() {
         let activeCollection = Application.documentManager.getActiveCollection();
         let flags;
 
@@ -644,28 +641,26 @@ var OffsetCollectionsController = new Lang.Class({
     }
 });
 
-var OffsetDocumentsController = new Lang.Class({
-    Name: 'OffsetDocumentsController',
-    Extends: OffsetController,
+var OffsetDocumentsController = GObject.registerClass(
+    class OffsetDocumentsController extends OffsetController {
 
-    _init: function() {
-        this.parent();
-    },
+    _init() {
+        super._init();
+    }
 
-    getQuery: function() {
+    getQuery() {
         return Application.queryBuilder.buildCountQuery(Query.QueryFlags.DOCUMENTS);
     }
 });
 
-var OffsetSearchController = new Lang.Class({
-    Name: 'OffsetSearchController',
-    Extends: OffsetController,
+var OffsetSearchController = GObject.registerClass(
+    class OffsetSearchController extends OffsetController {
 
-    _init: function() {
-        this.parent();
-    },
+    _init() {
+        super._init();
+    }
 
-    getQuery: function() {
+    getQuery() {
         return Application.queryBuilder.buildCountQuery(Query.QueryFlags.SEARCH);
     }
 });
diff --git a/src/searchbar.js b/src/searchbar.js
index cb338796..ce9fa305 100644
--- a/src/searchbar.js
+++ b/src/searchbar.js
@@ -21,6 +21,7 @@
 
 const Gdk = imports.gi.Gdk;
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 
 const Lang = imports.lang;
@@ -28,17 +29,16 @@ const Lang = imports.lang;
 const Application = imports.application;
 const Manager = imports.manager;
 
-var Searchbar = new Lang.Class({
-    Name: 'Searchbar',
-    Extends: Gtk.SearchBar,
+var Searchbar = GObject.registerClass({
     Signals: {
         'activate-result': {}
-    },
+    }
+}, class Searchbar extends Gtk.SearchBar {
 
-    _init: function() {
+    _init() {
         this.searchChangeBlocked = false;
 
-        this.parent();
+        super._init();
 
         // subclasses will create this.searchEntry
         let searchWidget = this.createSearchWidget();
@@ -55,17 +55,17 @@ var Searchbar = new Lang.Class({
             }));
 
         this.show_all();
-    },
+    }
 
-    createSearchWidget: function() {
+    createSearchWidget() {
         log('Error: Searchbar implementations must override createSearchWidget');
-    },
+    }
 
-    entryChanged: function() {
+    entryChanged() {
         log('Error: Searchbar implementations must override entryChanged');
-    },
+    }
 
-    handleEvent: function(event) {
+    handleEvent(event) {
         // Skip if the search bar is shown and the focus is elsewhere
         if (this.search_mode_enabled && !this.searchEntry.is_focus)
             return false;
@@ -80,13 +80,13 @@ var Searchbar = new Lang.Class({
         if (retval == Gdk.EVENT_STOP)
             this.searchEntry.grab_focus_without_selecting();
         return retval;
-    },
+    }
 
-    reveal: function() {
+    reveal() {
         this.search_mode_enabled = true;
-    },
+    }
 
-    conceal: function() {
+    conceal() {
         this.search_mode_enabled = false;
 
         // clear all the search properties when hiding the entry
@@ -94,12 +94,11 @@ var Searchbar = new Lang.Class({
     }
 });
 
-var Dropdown = new Lang.Class({
-    Name: 'Dropdown',
-    Extends: Gtk.Popover,
+var Dropdown = GObject.registerClass(
+    class Dropdown extends Gtk.Popover {
 
-    _init: function() {
-        this.parent({ position: Gtk.PositionType.BOTTOM });
+    _init() {
+        super._init({ position: Gtk.PositionType.BOTTOM });
 
         let grid = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL,
                                   row_homogeneous: true,
diff --git a/src/selections.js b/src/selections.js
index 98f2d961..328c73be 100644
--- a/src/selections.js
+++ b/src/selections.js
@@ -23,6 +23,7 @@
 const Gdk = imports.gi.Gdk;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 const Pango = imports.gi.Pango;
 const _ = imports.gettext.gettext;
@@ -41,15 +42,15 @@ const Lang = imports.lang;
 const Signals = imports.signals;
 
 // fetch all the collections a given item is part of
-const FetchCollectionsJob = new Lang.Class({
-    Name: 'FetchCollectionsJob',
+const FetchCollectionsJob = GObject.registerClass(
+    class FetchCollectionsJob extends GObject.Object {
 
-    _init: function(urn) {
+    _init(urn) {
         this._urn = urn;
         this._collections = [];
-    },
+    }
 
-    run: function(callback) {
+    run(callback) {
         this._callback = callback;
 
         let query = Application.queryBuilder.buildFetchCollectionsQuery(this._urn);
@@ -65,9 +66,9 @@ const FetchCollectionsJob = new Lang.Class({
                     this._emitCallback();
                 }
             }));
-    },
+    }
 
-    _onCursorNext: function(cursor, res) {
+    _onCursorNext(cursor, res) {
         let valid = false;
 
         try {
@@ -87,9 +88,9 @@ const FetchCollectionsJob = new Lang.Class({
         this._collections.push(urn);
 
         cursor.next_async(null, Lang.bind(this, this._onCursorNext));
-    },
+    }
 
-    _emitCallback: function() {
+    _emitCallback() {
         if (this._callback)
             this._callback(this._collections);
     }
@@ -103,15 +104,15 @@ const OrganizeCollectionState = {
     HIDDEN: 1 << 2
 };
 
-const FetchCollectionStateForSelectionJob = new Lang.Class({
-    Name: 'FetchCollectionStateForSelectionJob',
+const FetchCollectionStateForSelectionJob = GObject.registerClass(
+    class FetchCollectionStateForSelectionJob extends GObject.Object {
 
-    _init: function() {
+    _init() {
         this._collectionsForItems = {};
         this._runningJobs = 0;
-    },
+    }
 
-    run: function(callback) {
+    run(callback) {
         this._callback = callback;
 
         let urns = Application.selectionController.getSelection();
@@ -122,17 +123,17 @@ const FetchCollectionStateForSelectionJob = new Lang.Class({
                 this._runningJobs++;
                 job.run(Lang.bind(this, this._jobCollector, urn));
             }));
-    },
+    }
 
-    _jobCollector: function(collectionsForItem, urn) {
+    _jobCollector(collectionsForItem, urn) {
         this._collectionsForItems[urn] = collectionsForItem;
 
         this._runningJobs--;
         if (!this._runningJobs)
             this._emitCallback();
-    },
+    }
 
-    _emitCallback: function() {
+    _emitCallback() {
         let collectionState = {};
         let collections = Application.documentManager.getCollections();
 
@@ -191,14 +192,14 @@ const FetchCollectionStateForSelectionJob = new Lang.Class({
 });
 
 // updates the mtime for the given resource to the current system time
-const UpdateMtimeJob = new Lang.Class({
-    Name: 'UpdateMtimeJob',
+const UpdateMtimeJob = GObject.registerClass(
+    class UpdateMtimeJob extends GObject.Object {
 
-    _init: function(urn) {
+    _init(urn) {
         this._urn = urn;
-    },
+    }
 
-    run: function(callback) {
+    run(callback) {
         this._callback = callback;
 
         let query = Application.queryBuilder.buildUpdateMtimeQuery(this._urn);
@@ -217,16 +218,16 @@ const UpdateMtimeJob = new Lang.Class({
 });
 
 // adds or removes the selected items to the given collection
-const SetCollectionForSelectionJob = new Lang.Class({
-    Name: 'SetCollectionForSelectionJob',
+const SetCollectionForSelectionJob = GObject.registerClass(
+    class SetCollectionForSelectionJob extends GObject.Object {
 
-    _init: function(collectionUrn, setting) {
+    _init(collectionUrn, setting) {
         this._collectionUrn = collectionUrn;
         this._setting = setting;
         this._runningJobs = 0;
-    },
+    }
 
-    run: function(callback) {
+    run(callback) {
         this._callback = callback;
 
         let urns = Application.selectionController.getSelection();
@@ -251,9 +252,9 @@ const SetCollectionForSelectionJob = new Lang.Class({
                         this._jobCollector();
                     }));
             }));
-    },
+    }
 
-    _jobCollector: function() {
+    _jobCollector() {
         this._runningJobs--;
 
         if (this._runningJobs == 0) {
@@ -269,15 +270,15 @@ const SetCollectionForSelectionJob = new Lang.Class({
 });
 
 // creates an (empty) collection with the given name
-const CreateCollectionJob = new Lang.Class({
-    Name: 'CreateCollectionJob',
+const CreateCollectionJob = GObject.registerClass(
+    class CreateCollectionJob extends GObject.Object {
 
-    _init: function(name) {
+    _init(name) {
         this._name = name;
         this._createdUrn = null;
-    },
+    }
 
-    run: function(callback) {
+    run(callback) {
         this._callback = callback;
 
         let query = Application.queryBuilder.buildCreateCollectionQuery(this._name);
@@ -312,21 +313,20 @@ const CollectionRowViews = {
     RENAME: 'rename-view'
 };
 
-const CollectionRow = new Lang.Class({
-    Name: "CollectionRow",
-    Extends: Gtk.ListBoxRow,
+const CollectionRow = GObject.registerClass(
+    class CollectionRow extends Gtk.ListBoxRow {
 
-    _init: function(collection, collectionState) {
+    _init(collection, collectionState) {
         this.collection = collection;
         this._collectionState = collectionState;
         this._timeoutId = 0;
         this.views = new Gtk.Stack();
-        this.parent();
+        super._init();
         this.add(this.views);
         this.setDefaultView();
-    },
+    }
 
-    _initDefaultView: function() {
+    _initDefaultView() {
         let isActive = (this._collectionState & OrganizeCollectionState.ACTIVE);
         let isInconsistent = (this._collectionState & OrganizeCollectionState.INCONSISTENT);
 
@@ -368,9 +368,9 @@ const CollectionRow = new Lang.Class({
         grid.add(menuButton);
         grid.show_all();
         this.views.add_named(grid, CollectionRowViews.DEFAULT);
-    },
+    }
 
-    _initDeleteView: function() {
+    _initDeleteView() {
         let grid = new Gtk.Grid({ margin: 6, orientation: Gtk.Orientation.HORIZONTAL });
         let message = _("ā€œ%sā€ removed").format(this.collection.name);
         let deleteLabel = new Gtk.Label({ label: message,
@@ -390,9 +390,9 @@ const CollectionRow = new Lang.Class({
 
         grid.show_all();
         this.views.add_named(grid, CollectionRowViews.DELETE);
-    },
+    }
 
-    _initRenameView: function() {
+    _initRenameView() {
         this.renameEntry = new Gtk.Entry({ activates_default: true,
                                            expand: true,
                                            text: this.collection.name,
@@ -412,23 +412,23 @@ const CollectionRow = new Lang.Class({
             }));
         this.renameEntry.show();
         this.views.add_named(this.renameEntry, CollectionRowViews.RENAME);
-    },
+    }
 
-    _resetTimeout: function() {
+    _resetTimeout() {
         if (this._timeoutId != 0) {
             Mainloop.source_remove(this._timeoutId);
             this._timeoutId = 0;
         }
-    },
+    }
 
-    applyRename: function() {
+    applyRename() {
         let newName = this.renameEntry.get_text();
         this.collection.name = newName;
         TrackerUtils.setEditedName(newName, this.collection.id, null);
         this.checkButton.set_label(newName);
-    },
+    }
 
-    conceal: function() {
+    conceal() {
         let revealer = new Gtk.Revealer({ reveal_child: true, transition_duration: 500 });
         revealer.show();
         // inserting revealer between (this) and (this.views)
@@ -438,23 +438,23 @@ const CollectionRow = new Lang.Class({
 
         revealer.connect("notify::child-revealed", Lang.bind(this, this.deleteCollection));
         revealer.reveal_child = false;
-    },
+    }
 
-    deleteCollection: function() {
+    deleteCollection() {
         this._resetTimeout();
         Application.documentManager.removeItem(this.collection);
         this.collection.trash();
-    },
+    }
 
-    setDefaultView: function() {
+    setDefaultView() {
         if (!this.views.get_child_by_name(CollectionRowViews.DEFAULT))
             this._initDefaultView();
 
         this.get_style_context().remove_class('delete-row');
         this.views.set_visible_child_name(CollectionRowViews.DEFAULT);
-    },
+    }
 
-    setDeleteView: function() {
+    setDeleteView() {
         if (!this.views.get_child_by_name(CollectionRowViews.DELETE))
             this._initDeleteView();
 
@@ -469,9 +469,9 @@ const CollectionRow = new Lang.Class({
         this.get_style_context().add_class('delete-row');
         this.views.set_visible_child_name(CollectionRowViews.DELETE);
 
-    },
+    }
 
-    setRenameView: function(onTextChanged) {
+    setRenameView(onTextChanged) {
         if (!this.views.get_child_by_name(CollectionRowViews.RENAME)) {
             this._initRenameView();
             this.renameEntry.connect('changed', onTextChanged);
@@ -481,16 +481,15 @@ const CollectionRow = new Lang.Class({
         this.views.set_transition_duration(200);
         this.renameEntry.set_text(this.collection.name);
         this.views.set_visible_child_name(CollectionRowViews.RENAME);
-    },
+    }
 
 });
 
-const CollectionList = new Lang.Class({
-    Name: 'CollectionList',
-    Extends: Gtk.ListBox,
+const CollectionList = GObject.registerClass(
+    class CollectionList extends Gtk.ListBox {
 
-    _init: function() {
-        this.parent({ vexpand: false,
+    _init() {
+        super._init({ vexpand: false,
                       margin: 0,
                       selection_mode: Gtk.SelectionMode.NONE });
 
@@ -533,18 +532,18 @@ const CollectionList = new Lang.Class({
         // populate the list
         let job = new FetchCollectionStateForSelectionJob();
         job.run(Lang.bind(this, this._onFetchCollectionStateForSelection));
-    },
+    }
 
-    _onCollectionAdded: function(manager, itemAdded) {
+    _onCollectionAdded(manager, itemAdded) {
         if (!itemAdded.collection)
             return;
 
         let collection =  new CollectionRow(itemAdded, OrganizeCollectionState.ACTIVE);
         collection.show_all();
         this.add(collection);
-    },
+    }
 
-    _onCollectionRemoved: function(manager, itemRemoved) {
+    _onCollectionRemoved(manager, itemRemoved) {
         if (!itemRemoved.collection)
             return;
 
@@ -555,9 +554,9 @@ const CollectionList = new Lang.Class({
                 return;
             }
         }
-    },
+    }
 
-    _onFetchCollectionStateForSelection: function(collectionState) {
+    _onFetchCollectionStateForSelection(collectionState) {
         for (let idx in collectionState) {
             let item = Application.documentManager.getItemById(idx);
 
@@ -569,14 +568,14 @@ const CollectionList = new Lang.Class({
 
             this.add(collection);
         }
-    },
+    }
 
-    isEmpty: function() {
+    isEmpty() {
         let rows = this.get_children();
         return (rows.length == 0);
-    },
+    }
 
-    isValidName: function(name) {
+    isValidName(name) {
         if (!name || name == '')
             return false;
 
@@ -590,9 +589,7 @@ const CollectionList = new Lang.Class({
     }
 });
 
-const OrganizeCollectionDialog = new Lang.Class({
-    Name: 'OrganizeCollectionDialog',
-    Extends: Gtk.Window,
+const OrganizeCollectionDialog = GObject.registerClass({
     Template: 'resource:///org/gnome/Documents/ui/organize-collection-dialog.ui',
     InternalChildren: [ 'content',
                         'viewEmpty',
@@ -607,9 +604,10 @@ const OrganizeCollectionDialog = new Lang.Class({
                         'headerBar',
                         'cancelButton',
                         'doneButton' ],
+}, class OrganizeCollectionDialog extends Gtk.Window {
 
-    _init: function(toplevel) {
-        this.parent({ transient_for: toplevel });
+    _init(toplevel) {
+        super._init({ transient_for: toplevel });
 
         this._renameMode = false;
 
@@ -666,9 +664,9 @@ const OrganizeCollectionDialog = new Lang.Class({
                 this._content.set_transition_type(Gtk.StackTransitionType.CROSSFADE)
                 return false;
             }));
-    },
+    }
 
-    _onAddClicked: function() {
+    _onAddClicked() {
         let addEntry = this._collectionList.isEmpty() ? this._addEntryEmpty : this._addEntryCollections;
         let newText = addEntry.get_text();
         let job = new CreateCollectionJob(newText);
@@ -687,9 +685,9 @@ const OrganizeCollectionDialog = new Lang.Class({
         } else {
             this._scrolledWindowCollections.get_vadjustment().set_value(0);
         }
-    },
+    }
 
-    _onTextChanged: function(entry) {
+    _onTextChanged(entry) {
         let sensitive = this._collectionList.isValidName(entry.get_text());
         if (this._renameMode)
             this._doneButton.set_sensitive(sensitive);
@@ -697,9 +695,9 @@ const OrganizeCollectionDialog = new Lang.Class({
             let addButton = this._collectionList.isEmpty() ? this._addButtonEmpty : 
this._addButtonCollections;
             addButton.set_sensitive(sensitive);
         }
-    },
+    }
 
-    _onKeyPressed: function (window, event) {
+    _onKeyPressed (window, event) {
         let keyval = event.get_keyval()[1];
         if (keyval == Gdk.KEY_Escape) {
             if (this._renameMode)
@@ -710,9 +708,9 @@ const OrganizeCollectionDialog = new Lang.Class({
             return Gdk.EVENT_STOP;
         }
         return Gdk.EVENT_PROPAGATE;
-    },
+    }
 
-    _renameModeStart: function(action, parameter) {
+    _renameModeStart(action, parameter) {
         let collId = parameter.get_string()[0];
         this._setRenameMode(true);
 
@@ -732,9 +730,9 @@ const OrganizeCollectionDialog = new Lang.Class({
 
                 row.setRenameView(Lang.bind(this, this._onTextChanged));
             }));
-    },
+    }
 
-    _renameModeStop: function(rename) {
+    _renameModeStop(rename) {
         this._setRenameMode(false);
 
         let rows = this._collectionList.get_children();
@@ -750,9 +748,9 @@ const OrganizeCollectionDialog = new Lang.Class({
 
             row.setDefaultView();
         });
-    },
+    }
 
-    _onCollectionListChanged: function() {
+    _onCollectionListChanged() {
         if (this._collectionList.isEmpty()) {
             this._viewSpinner.stop();
             this._content.set_visible_child(this._viewEmpty);
@@ -764,9 +762,9 @@ const OrganizeCollectionDialog = new Lang.Class({
             this._addEntryCollections.grab_focus();
             this._addButtonCollections.grab_default();
         }
-    },
+    }
 
-    _setRenameMode: function(renameMode) {
+    _setRenameMode(renameMode) {
         this._renameMode = renameMode;
         if (this._renameMode) {
             this._headerBar.set_title(_("Rename"));
@@ -786,17 +784,17 @@ const OrganizeCollectionDialog = new Lang.Class({
     }
 });
 
-var SelectionController = new Lang.Class({
-    Name: 'SelectionController',
+var SelectionController = GObject.registerClass(
+    class SelectionController extends GObject.Object {
 
-    _init: function() {
+    _init() {
         this._selection = [];
 
         Application.documentManager.connect('item-removed',
             Lang.bind(this, this._onDocumentRemoved));
-    },
+    }
 
-    _onDocumentRemoved: function(manager, item) {
+    _onDocumentRemoved(manager, item) {
         let changed = false;
         let filtered = this._selection.filter(Lang.bind(this,
             function(value, index) {
@@ -809,9 +807,9 @@ var SelectionController = new Lang.Class({
             this._selection = filtered;
             this.emit('selection-changed', this._selection);
         }
-    },
+    }
 
-    setSelection: function(selection) {
+    setSelection(selection) {
         if (this._isFrozen)
             return;
 
@@ -821,13 +819,13 @@ var SelectionController = new Lang.Class({
             this._selection = selection;
 
         this.emit('selection-changed', this._selection);
-    },
+    }
 
-    getSelection: function() {
+    getSelection() {
         return this._selection;
-    },
+    }
 
-    freezeSelection: function(freeze) {
+    freezeSelection(freeze) {
         if (freeze == this._isFrozen)
             return;
 
@@ -838,9 +836,7 @@ Signals.addSignalMethods(SelectionController.prototype);
 
 const _SELECTION_TOOLBAR_DEFAULT_WIDTH = 500;
 
-var SelectionToolbar = new Lang.Class({
-    Name: 'SelectionToolbar',
-    Extends: Gtk.ActionBar,
+var SelectionToolbar = GObject.registerClass({
     Template: 'resource:///org/gnome/Documents/ui/selection-toolbar.ui',
     InternalChildren: [ 'toolbarOpen',
                         'toolbarPrint',
@@ -848,14 +844,15 @@ var SelectionToolbar = new Lang.Class({
                         'toolbarShare',
                         'toolbarProperties',
                         'toolbarCollection' ],
+}, class SelectionToolbar extends Gtk.ActionBar {
 
-    _init: function(overview) {
+    _init(overview) {
         this._docToPrint = null;
         this._docBeginPrintId = 0;
         this._itemListeners = {};
         this._insideRefresh = false;
 
-        this.parent();
+        super._init();
 
         this._selectionModeAction = overview.getAction('selection-mode');
 
@@ -882,38 +879,38 @@ var SelectionToolbar = new Lang.Class({
             function() {
                 this._disconnectDocToPrint();
             }));
-    },
+    }
 
-    vfunc_hide: function() {
+    vfunc_hide() {
         this._disconnectDocToPrint();
-        this.parent();
-    },
+        super.vfunc_hide();
+    }
 
-    _disconnectDocToPrint: function() {
+    _disconnectDocToPrint() {
         if (this._docToPrint != null && this._docBeginPrintId != 0) {
             this._docToPrint.disconnect(this._docBeginPrintId);
             this._docToPrint = null;
             this._docBeginPrintId = 0;
         }
-    },
+    }
 
-    _updateCollectionsButton: function() {
+    _updateCollectionsButton() {
         let windowMode = Application.modeController.getWindowMode();
         let activeCollection = Application.documentManager.getActiveCollection();
         if (windowMode == WindowMode.WindowMode.COLLECTIONS && !activeCollection)
             this._toolbarCollection.hide();
         else
             this._toolbarCollection.show();
-    },
+    }
 
-    _onSelectionChanged: function() {
+    _onSelectionChanged() {
         let selection = Application.selectionController.getSelection();
         this._setItemListeners(selection);
 
         this._setItemVisibility();
-    },
+    }
 
-    _setItemListeners: function(selection) {
+    _setItemListeners(selection) {
         for (let idx in this._itemListeners) {
             let doc = this._itemListeners[idx];
             doc.disconnect(idx);
@@ -926,9 +923,9 @@ var SelectionToolbar = new Lang.Class({
                 let id = doc.connect('info-updated', Lang.bind(this, this._setItemVisibility));
                 this._itemListeners[id] = doc;
             }));
-    },
+    }
 
-    _setItemVisibility: function() {
+    _setItemVisibility() {
         let apps = [];
         let selection = Application.selectionController.getSelection();
         let hasSelection = (selection.length > 0);
@@ -991,9 +988,9 @@ var SelectionToolbar = new Lang.Class({
         this._toolbarCollection.set_sensitive(showCollection);
 
         this._insideRefresh = false;
-    },
+    }
 
-    _onToolbarCollection: function() {
+    _onToolbarCollection() {
         let toplevel = this.get_toplevel();
         if (!toplevel.is_toplevel())
             throw(new Error('Code should not be reached'));
@@ -1002,9 +999,9 @@ var SelectionToolbar = new Lang.Class({
         dialog.connect('destroy', Lang.bind(this, function() {
             this._selectionModeAction.change_state(GLib.Variant.new('b', false));
         }));
-    },
+    }
 
-    _onToolbarOpen: function(widget) {
+    _onToolbarOpen(widget) {
         let selection = Application.selectionController.getSelection();
         this._selectionModeAction.change_state(GLib.Variant.new('b', false));
 
@@ -1017,9 +1014,9 @@ var SelectionToolbar = new Lang.Class({
 
                 doc.open(toplevel, Gtk.get_current_event_time());
             }));
-    },
+    }
 
-    _onToolbarTrash: function(widget) {
+    _onToolbarTrash(widget) {
         let selection = Application.selectionController.getSelection();
         let docs = [];
 
@@ -1038,9 +1035,9 @@ var SelectionToolbar = new Lang.Class({
 
         let deleteNotification = new Notifications.DeleteNotification(docs);
         this._selectionModeAction.change_state(GLib.Variant.new('b', false));
-    },
+    }
 
-    _onToolbarProperties: function(widget) {
+    _onToolbarProperties(widget) {
         let selection = Application.selectionController.getSelection();
         let dialog = new Properties.PropertiesDialog(selection[0]);
 
@@ -1049,9 +1046,9 @@ var SelectionToolbar = new Lang.Class({
                 dialog.destroy();
                 this._selectionModeAction.change_state(GLib.Variant.new('b', false));
             }));
-    },
+    }
 
-   _onToolbarShare: function(widget) {
+   _onToolbarShare(widget) {
        let dialog = new Sharing.SharingDialog();
 
        dialog.connect('response', Lang.bind(this,
@@ -1059,9 +1056,9 @@ var SelectionToolbar = new Lang.Class({
                dialog.destroy();
                this._selectionModeAction.change_state(GLib.Variant.new('b', false));
            }));
-    },
+    }
 
-    _onToolbarPrint: function(widget) {
+    _onToolbarPrint(widget) {
         let selection = Application.selectionController.getSelection();
 
         if (selection.length != 1)
@@ -1076,5 +1073,5 @@ var SelectionToolbar = new Lang.Class({
             }));
 
         this._docToPrint.print(this.get_toplevel());
-    },
+    }
 });
diff --git a/src/sharing.js b/src/sharing.js
index 7f5d0f20..d7b7ed12 100644
--- a/src/sharing.js
+++ b/src/sharing.js
@@ -68,11 +68,10 @@ const DocumentUpdateType = {
     DELETE_SHARE_LINK: 4
 };
 
-var SharingDialog = new Lang.Class({
-    Name: 'SharingDialog',
-    Extends: Gtk.Dialog,
+var SharingDialog = GObject.registerClass(
+    class SharingDialog extends Gtk.Dialog {
 
-    _init: function() {
+    _init() {
         let urn = Application.selectionController.getSelection();
         this._doc = Application.documentManager.getItemById(urn);
 
@@ -98,7 +97,7 @@ var SharingDialog = new Lang.Class({
         this._changePermissionVisible = false;
 
         let toplevel = Application.application.get_windows()[0];
-        this.parent({ resizable: false,
+        super._init({ resizable: false,
                       transient_for: toplevel,
                       modal: true,
                       destroy_with_parent: true,
@@ -237,9 +236,9 @@ var SharingDialog = new Lang.Class({
 
         this.show_all();
         this._updatePermissionButtons();
-    },
+    }
 
-    _ensureTreeview: function() {
+    _ensureTreeview() {
         if (this._model) {
             this._model.clear();
             return;
@@ -271,9 +270,9 @@ var SharingDialog = new Lang.Class({
         if (child)
             child.destroy();
         this._scrolledWin.add(this._treeView);
-    },
+    }
 
-    _onPermissionsButtonClicked: function() {
+    _onPermissionsButtonClicked() {
         this._changePermissionVisible = !this._changePermissionVisible;
         if (!this._changePermissionVisible) {
             this._changeButton.set_sensitive(false);
@@ -281,15 +280,15 @@ var SharingDialog = new Lang.Class({
         }
 
         this._updatePermissionButtons();
-    },
+    }
 
-    _permissionChangeFinished: function() {
+    _permissionChangeFinished() {
         this._changePermissionVisible = false;
         this._changeButton.set_sensitive(true);
         this._updatePermissionButtons();
-    },
+    }
 
-    _updateSettingString: function() {
+    _updateSettingString() {
         let primary = '';
         let detail = '';
 
@@ -310,9 +309,9 @@ var SharingDialog = new Lang.Class({
 
         this._setting.label = primary;
         this._settingDetail.label = detail;
-    },
+    }
 
-    _updatePermissionButtons: function() {
+    _updatePermissionButtons() {
         if (this._changePermissionVisible) {
             this._changeButton.label = _("Save");
             this._setting.hide();
@@ -334,10 +333,10 @@ var SharingDialog = new Lang.Class({
             this._privateRadio.hide();
             this._publicBox.hide();
         }
-    },
+    }
 
     // Return a feed containing the acl related to the entry
-    _refreshEntryACL: function() {
+    _refreshEntryACL() {
         this._entry.get_rules_async(this._service, null, null, Lang.bind(this,
             function(entry, result) {
                 try {
@@ -347,9 +346,9 @@ var SharingDialog = new Lang.Class({
                     logError(e, 'Error getting ACL Feed');
                 }
             }));
-    },
+    }
 
-    _getAccountNames: function() {
+    _getAccountNames() {
         let retval = [];
         let sources = Application.sourceManager.getForProviderType('google');
 
@@ -360,10 +359,10 @@ var SharingDialog = new Lang.Class({
             }));
 
         return retval;
-    },
+    }
 
     // Get the roles, and make a new array containing strings that start with capital letters
-    _getUserRoleString: function(role) {
+    _getUserRoleString(role) {
         if (role.charAt(0) == 'o')
             return _("Owner"); // Owner permission for document user listed in treeview
 
@@ -374,10 +373,10 @@ var SharingDialog = new Lang.Class({
             return _("Can view"); // Reader permission for document user listed in treeview
 
         return '';
-    },
+    }
 
     // Get each entry (person) from the feed, and get the scope for each person, and then store the emails 
and values in an array
-    _getScopeRulesEntry: function() {
+    _getScopeRulesEntry() {
         let entries = this._feed.get_entries();
         let accountNames = this._getAccountNames();
 
@@ -436,10 +435,10 @@ var SharingDialog = new Lang.Class({
             this._noPermission.show();
             this._noPermission.set_text(_("You can ask %s for access").format(ownerId));
         }
-    },
+    }
 
     // Get the role for the new contact from the combobox
-    _getNewContactRule: function() {
+    _getNewContactRule() {
         let activeItem = this._comboBoxText.get_active();
         let role;
 
@@ -451,10 +450,10 @@ var SharingDialog = new Lang.Class({
         return new GData.AccessRule({ role: role,
                                       scope_type: GData.ACCESS_SCOPE_USER,
                                       scope_value: this._contactEntry.get_text() });
-    },
+    }
 
     // Send the new contact and its permissions to Google Docs
-    _onAddClicked: function() {
+    _onAddClicked() {
         let accessRule = this._getNewContactRule();
         let aclLink = this._entry.look_up_link(GData.LINK_ACCESS_CONTROL_LIST);
 
@@ -474,27 +473,27 @@ var SharingDialog = new Lang.Class({
                         this._showErrorDialog(_("The document was not updated"));
                     }
                 }));
-    },
+    }
 
     // Get the scope from the radiobuttons
-    _getNewScopeType: function() {
+    _getNewScopeType() {
         let scope = GData.ACCESS_SCOPE_USER;
         if (this._publicRadio.get_active())
             scope = GData.ACCESS_SCOPE_DEFAULT;
 
         return scope;
-    },
+    }
 
     // Get the role from the checkbox
-    _getNewRole: function() {
+    _getNewRole() {
         let role = GData.DOCUMENTS_ACCESS_ROLE_READER;
         if (this._pubEditCheck.get_active())
             role = GData.DOCUMENTS_ACCESS_ROLE_WRITER;
 
         return role;
-    },
+    }
 
-    _insertNewPermission: function(scopeType, role) {
+    _insertNewPermission(scopeType, role) {
         let aclLink = this._entry.look_up_link(GData.LINK_ACCESS_CONTROL_LIST);
         let accessRule = new GData.AccessRule({ scope_type: scopeType,
                                                 role: role });
@@ -512,9 +511,9 @@ var SharingDialog = new Lang.Class({
 
                     this._permissionChangeFinished();
                 }));
-    },
+    }
 
-    _sendNewDocumentRule: function() {
+    _sendNewDocumentRule() {
         let newScopeType = this._getNewScopeType();
         let newRole = this._getNewRole();
         let entries = this._feed.get_entries();
@@ -604,15 +603,15 @@ var SharingDialog = new Lang.Class({
                         }
                     }));
         }
-    },
+    }
 
-    _isValidEmail: function() {
+    _isValidEmail() {
         let emailString = this._contactEntry.get_text();
         // Use Ross Kendell's RegEx to check for valid email address
         return 
/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/.test(emailString);
-    },
+    }
 
-    _showErrorDialog: function(errorStr) {
+    _showErrorDialog(errorStr) {
         let errorDialog = new Gtk.MessageDialog ({ transient_for: this,
                                                    modal: true,
                                                    destroy_with_parent: true,
diff --git a/src/shellSearchProvider.js b/src/shellSearchProvider.js
index 02bac4e3..439e2dd0 100644
--- a/src/shellSearchProvider.js
+++ b/src/shellSearchProvider.js
@@ -25,6 +25,7 @@ const Signals = imports.signals;
 const GdPrivate = imports.gi.GdPrivate;
 const GdkPixbuf = imports.gi.GdkPixbuf;
 const Gio = imports.gi.Gio;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 const GLib = imports.gi.GLib;
 
@@ -119,17 +120,17 @@ function _createGIcon(cursor) {
     return gicon;
 }
 
-const CreateCollectionIconJob = new Lang.Class({
-    Name: 'CreateCollectionIconJob',
+const CreateCollectionIconJob = GObject.registerClass(
+    class CreateCollectionIconJob extends GObject.Object {
 
-    _init: function(id) {
+    _init(id) {
         this._id = id;
         this._itemIcons = [];
         this._itemIds = [];
         this._itemJobs = 0;
-    },
+    }
 
-    run: function(callback) {
+    run(callback) {
         this._callback = callback;
 
         let query = queryBuilder.buildCollectionIconQuery(this._id);
@@ -145,9 +146,9 @@ const CreateCollectionIconJob = new Lang.Class({
                     this._hasItemIds();
                 }
             }));
-    },
+    }
 
-    _createItemIcon: function(cursor) {
+    _createItemIcon(cursor) {
         let pixbuf = null;
         let icon = _createGIcon(cursor);
 
@@ -174,9 +175,9 @@ const CreateCollectionIconJob = new Lang.Class({
         }
 
         return pixbuf;
-    },
+    }
 
-    _onCursorNext: function(cursor, res) {
+    _onCursorNext(cursor, res) {
         let valid = false;
 
         try {
@@ -195,9 +196,9 @@ const CreateCollectionIconJob = new Lang.Class({
             cursor.close();
             this._hasItemIds();
         }
-    },
+    }
 
-    _hasItemIds: function() {
+    _hasItemIds() {
         if (this._itemIds.length == 0) {
             this._returnPixbuf();
             return;
@@ -215,36 +216,36 @@ const CreateCollectionIconJob = new Lang.Class({
                         this._itemJobCollector();
                     }));
             }));
-    },
+    }
 
-    _itemJobCollector: function() {
+    _itemJobCollector() {
         this._itemJobs--;
 
         if (this._itemJobs == 0)
             this._returnPixbuf();
-    },
+    }
 
-    _returnPixbuf: function() {
+    _returnPixbuf() {
         this._callback(GdPrivate.create_collection_icon(_SHELL_SEARCH_ICON_SIZE, this._itemIcons));
     }
 });
 
-const FetchMetasJob = new Lang.Class({
-    Name: 'FetchMetasJob',
+const FetchMetasJob = GObject.registerClass(
+    class FetchMetasJob extends GObject.Object {
 
-    _init: function(ids) {
+    _init(ids) {
         this._ids = ids;
         this._metas = [];
-    },
+    }
 
-    _jobCollector: function() {
+    _jobCollector() {
         this._activeJobs--;
 
         if (this._activeJobs == 0)
             this._callback(this._metas);
-    },
+    }
 
-    _createCollectionPixbuf: function(meta) {
+    _createCollectionPixbuf(meta) {
         let job = new CreateCollectionIconJob(meta.id);
         job.run(Lang.bind(this,
             function(icon) {
@@ -254,9 +255,9 @@ const FetchMetasJob = new Lang.Class({
                 this._metas.push(meta);
                 this._jobCollector();
             }));
-    },
+    }
 
-    run: function(callback) {
+    run(callback) {
         this._callback = callback;
         this._activeJobs = this._ids.length;
 
@@ -297,15 +298,15 @@ const FetchMetasJob = new Lang.Class({
     }
 });
 
-const FetchIdsJob = new Lang.Class({
-    Name: 'FetchIdsJob',
+const FetchIdsJob = GObject.registerClass(
+    class FetchIdsJob extends GObject.Object {
 
-    _init: function(terms) {
+    _init(terms) {
         this._terms = terms;
         this._ids = [];
-    },
+    }
 
-    run: function(callback, cancellable) {
+    run(callback, cancellable) {
         this._callback = callback;
         this._cancellable = cancellable;
         searchController.setString(this._terms.join(' '));
@@ -324,9 +325,9 @@ const FetchIdsJob = new Lang.Class({
                     callback(this._ids);
                 }
             }));
-    },
+    }
 
-    _onCursorNext: function(cursor, res) {
+    _onCursorNext(cursor, res) {
         let valid = false;
 
         try {
@@ -348,24 +349,24 @@ const FetchIdsJob = new Lang.Class({
     }
 });
 
-var ShellSearchProvider = new Lang.Class({
-    Name: 'ShellSearchProvider',
+var ShellSearchProvider = GObject.registerClass(
+    class ShellSearchProvider extends GObject.Object {
 
-    _init: function() {
+    _init() {
         this._impl = Gio.DBusExportedObject.wrapJSObject(SearchProviderIface, this);
         this._cache = {};
         this._cancellable = new Gio.Cancellable();
-    },
+    }
 
-    export: function(connection) {
+    export(connection) {
         return this._impl.export(connection, SEARCH_PROVIDER_PATH);
-    },
+    }
 
-    unexport: function(connection) {
+    unexport(connection) {
         return this._impl.unexport_from_connection(connection);
-    },
+    }
 
-    _returnMetasFromCache: function(ids, invocation) {
+    _returnMetasFromCache(ids, invocation) {
         let metas = [];
         for (let i = 0; i < ids.length; i++) {
             let id = ids[i];
@@ -383,9 +384,9 @@ var ShellSearchProvider = new Lang.Class({
 
         Application.application.release();
         invocation.return_value(GLib.Variant.new('(aa{sv})', [ metas ]));
-    },
+    }
 
-    GetInitialResultSetAsync: function(params, invocation) {
+    GetInitialResultSetAsync(params, invocation) {
         let terms = params[0];
         Application.application.hold();
 
@@ -398,9 +399,9 @@ var ShellSearchProvider = new Lang.Class({
                 Application.application.release();
                 invocation.return_value(GLib.Variant.new('(as)', [ ids ]));
             }), this._cancellable);
-    },
+    }
 
-    GetSubsearchResultSetAsync: function(params, invocation) {
+    GetSubsearchResultSetAsync(params, invocation) {
         let [previousResults, terms] = params;
         Application.application.hold();
 
@@ -413,9 +414,9 @@ var ShellSearchProvider = new Lang.Class({
                 Application.application.release();
                 invocation.return_value(GLib.Variant.new('(as)', [ ids ]));
             }), this._cancellable);
-    },
+    }
 
-    GetResultMetasAsync: function(params, invocation) {
+    GetResultMetasAsync(params, invocation) {
         let ids = params[0];
         Application.application.hold();
 
@@ -439,13 +440,13 @@ var ShellSearchProvider = new Lang.Class({
         } else {
             this._returnMetasFromCache(ids, invocation);
         }
-    },
+    }
 
-    ActivateResult: function(id, terms, timestamp) {
+    ActivateResult(id, terms, timestamp) {
         this.emit('activate-result', id, terms, timestamp);
-    },
+    }
 
-    LaunchSearch: function(terms, timestamp) {
+    LaunchSearch(terms, timestamp) {
         this.emit('launch-search', terms, timestamp);
     }
 });
diff --git a/src/trackerController.js b/src/trackerController.js
index e45f3a7f..f7f282f8 100644
--- a/src/trackerController.js
+++ b/src/trackerController.js
@@ -29,6 +29,7 @@ const WindowMode = imports.windowMode;
 
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const _ = imports.gettext.gettext;
 
 const QueryType = {
@@ -37,15 +38,15 @@ const QueryType = {
     UPDATE_BLANK: 2
 };
 
-var TrackerConnectionQueue = new Lang.Class({
-    Name: 'TrackerConnectionQueue',
+var TrackerConnectionQueue = GObject.registerClass(
+    class TrackerConnectionQueue extends GObject.Object {
 
-    _init: function() {
+    _init() {
         this._queue = [];
         this._running = false;
-    },
+    }
 
-    add: function(query, cancellable, callback) {
+    add(query, cancellable, callback) {
         let params = { query: query,
                        cancellable: cancellable,
                        callback: callback,
@@ -53,9 +54,9 @@ var TrackerConnectionQueue = new Lang.Class({
         this._queue.push(params);
 
         this._checkQueue();
-    },
+    }
 
-    update: function(query, cancellable, callback) {
+    update(query, cancellable, callback) {
         let params = { query: query,
                        cancellable: cancellable,
                        callback: callback,
@@ -63,9 +64,9 @@ var TrackerConnectionQueue = new Lang.Class({
         this._queue.push(params);
 
         this._checkQueue();
-    },
+    }
 
-    updateBlank: function(query, cancellable, callback) {
+    updateBlank(query, cancellable, callback) {
         let params = { query: query,
                        cancellable: cancellable,
                        callback: callback,
@@ -73,9 +74,9 @@ var TrackerConnectionQueue = new Lang.Class({
         this._queue.push(params);
 
         this._checkQueue();
-    },
+    }
 
-    _checkQueue: function() {
+    _checkQueue() {
         if (this._running)
             return;
 
@@ -94,9 +95,9 @@ var TrackerConnectionQueue = new Lang.Class({
         else if (params.queryType == QueryType.UPDATE_BLANK)
             Application.connection.update_blank_async(params.query, GLib.PRIORITY_DEFAULT, 
params.cancellable,
                                                  Lang.bind(this, this._queueCollector, params));
-    },
+    }
 
-    _queueCollector: function(connection, res, params) {
+    _queueCollector(connection, res, params) {
         params.callback(connection, res);
         this._running = false;
         this._checkQueue();
@@ -108,10 +109,10 @@ const RefreshFlags = {
     RESET_OFFSET: 1 << 0
 };
 
-const TrackerController = new Lang.Class({
-    Name: 'TrackerController',
+const TrackerController = GObject.registerClass(
+    class TrackerController extends GObject.Object {
 
-    _init: function(windowMode) {
+    _init(windowMode) {
         this._currentQuery = null;
         this._cancellable = new Gio.Cancellable();
         this._mode = windowMode;
@@ -139,13 +140,13 @@ const TrackerController = new Lang.Class({
 
         Application.settings.connect('changed::sort-by', Lang.bind(this, this._updateSortForSettings));
         this._updateSortForSettings();
-    },
+    }
 
-    getOffsetController: function() {
+    getOffsetController() {
         log('Error: TrackerController implementations must override getOffsetController');
-    },
+    }
 
-    _setQueryStatus: function(status) {
+    _setQueryStatus(status) {
         if (this._querying == status)
             return;
 
@@ -159,25 +160,25 @@ const TrackerController = new Lang.Class({
 
         this._querying = status;
         this.emit('query-status-changed', this._querying);
-    },
+    }
 
-    getQuery: function() {
+    getQuery() {
         log('Error: TrackerController implementations must override getQuery');
-    },
+    }
 
-    getQueryStatus: function() {
+    getQueryStatus() {
         return this._querying;
-    },
+    }
 
-    _onQueryError: function(exception) {
+    _onQueryError(exception) {
         if (exception.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
             return;
 
         let message = _("Unable to fetch the list of documents");
         this.emit('query-error', message, exception);
-    },
+    }
 
-    _onQueryFinished: function(exception) {
+    _onQueryFinished(exception) {
         this._setQueryStatus(false);
 
         if (exception)
@@ -189,9 +190,9 @@ const TrackerController = new Lang.Class({
             this._queryQueued = false;
             this._refreshInternal(this._queryQueuedFlags);
         }
-    },
+    }
 
-    _onCursorNext: function(cursor, res) {
+    _onCursorNext(cursor, res) {
         try {
             let valid = cursor.next_finish(res);
 
@@ -211,9 +212,9 @@ const TrackerController = new Lang.Class({
                     + (GLib.get_monotonic_time() - this._lastQueryTime) / 1000000);
         Application.documentManager.addDocumentFromCursor(cursor);
         cursor.next_async(this._cancellable, Lang.bind(this, this._onCursorNext));
-    },
+    }
 
-    _onQueryExecuted: function(object, res) {
+    _onQueryExecuted(object, res) {
         try {
             Utils.debug('Query Executed: '
                         + (GLib.get_monotonic_time() - this._lastQueryTime) / 1000000);
@@ -223,17 +224,17 @@ const TrackerController = new Lang.Class({
         } catch (e) {
             this._onQueryFinished(e);
         }
-    },
+    }
 
-    _performCurrentQuery: function() {
+    _performCurrentQuery() {
         this._currentQuery = this.getQuery();
         this._cancellable.reset();
 
         Application.connectionQueue.add(this._currentQuery.sparql,
                                         this._cancellable, Lang.bind(this, this._onQueryExecuted));
-    },
+    }
 
-    _refreshInternal: function(flags) {
+    _refreshInternal(flags) {
         if (!this._isStarted)
             throw(new Error('!this._isStarted'));
 
@@ -250,13 +251,13 @@ const TrackerController = new Lang.Class({
 
         this._setQueryStatus(true);
         this._performCurrentQuery();
-    },
+    }
 
-    refreshForObject: function(_object, _item) {
+    refreshForObject(_object, _item) {
         this._refreshInternal(RefreshFlags.RESET_OFFSET);
-    },
+    }
 
-    _refreshForSource: function() {
+    _refreshForSource() {
         // When a source is added or removed, refresh the model only if
         // the current source is All.
         // If it was the current source to be removed, we will get an
@@ -266,18 +267,18 @@ const TrackerController = new Lang.Class({
             this._refreshInternal(RefreshFlags.NONE);
 
         this._refreshPending = false;
-    },
+    }
 
-    _onSourceAddedRemoved: function(manager, item) {
+    _onSourceAddedRemoved(manager, item) {
         let mode = Application.modeController.getWindowMode();
 
         if (mode == this._mode)
             this._refreshForSource();
         else
             this._refreshPending = true;
-    },
+    }
 
-    _updateSortForSettings: function() {
+    _updateSortForSettings() {
         let sortBy = Application.settings.get_enum('sort-by');
 
         if(this.sortBy == sortBy)
@@ -289,9 +290,9 @@ const TrackerController = new Lang.Class({
             return;
 
         this._refreshInternal(RefreshFlags.RESET_OFFSET);
-    },
+    }
 
-    start: function() {
+    start() {
         if (this._isStarted)
             return;
 
@@ -301,12 +302,11 @@ const TrackerController = new Lang.Class({
 });
 Signals.addSignalMethods(TrackerController.prototype);
 
-var TrackerCollectionsController = new Lang.Class({
-    Name: 'TrackerCollectionsController',
-    Extends: TrackerController,
+var TrackerCollectionsController = GObject.registerClass(
+    class TrackerCollectionsController extends TrackerController {
 
-    _init: function() {
-        this.parent(WindowMode.WindowMode.COLLECTIONS);
+    _init() {
+        super._init(WindowMode.WindowMode.COLLECTIONS);
 
         Application.documentManager.connect('active-collection-changed', Lang.bind(this,
             function() {
@@ -314,13 +314,13 @@ var TrackerCollectionsController = new Lang.Class({
                 if (windowMode == WindowMode.WindowMode.COLLECTIONS)
                     this.refreshForObject();
             }));
-    },
+    }
 
-    getOffsetController: function() {
+    getOffsetController() {
         return Application.offsetCollectionsController;
-    },
+    }
 
-    getQuery: function() {
+    getQuery() {
         let flags;
         let activeCollection = Application.documentManager.getActiveCollection();
 
@@ -332,34 +332,32 @@ var TrackerCollectionsController = new Lang.Class({
         return Application.queryBuilder.buildGlobalQuery(flags,
                                                          Application.offsetCollectionsController,
                                                          this.sortBy);
-    },
+    }
 });
 
-var TrackerDocumentsController = new Lang.Class({
-    Name: 'TrackerDocumentsController',
-    Extends: TrackerController,
+var TrackerDocumentsController = GObject.registerClass(
+    class TrackerDocumentsController extends TrackerController {
 
-    _init: function() {
-        this.parent(WindowMode.WindowMode.DOCUMENTS);
-    },
+    _init() {
+        super._init(WindowMode.WindowMode.DOCUMENTS);
+    }
 
-    getOffsetController: function() {
+    getOffsetController() {
         return Application.offsetDocumentsController;
-    },
+    }
 
-    getQuery: function() {
+    getQuery() {
         return Application.queryBuilder.buildGlobalQuery(Query.QueryFlags.DOCUMENTS,
                                                          Application.offsetDocumentsController,
                                                          this.sortBy);
-    },
+    }
 });
 
-var TrackerSearchController = new Lang.Class({
-    Name: 'TrackerSearchController',
-    Extends: TrackerController,
+var TrackerSearchController = GObject.registerClass(
+    class TrackerSearchController extends TrackerController {
 
-    _init: function() {
-        this.parent(WindowMode.WindowMode.SEARCH);
+    _init() {
+        super._init(WindowMode.WindowMode.SEARCH);
 
         Application.documentManager.connect('active-collection-changed', Lang.bind(this,
             function() {
@@ -373,22 +371,22 @@ var TrackerSearchController = new Lang.Class({
         Application.searchTypeManager.connect('active-changed', Lang.bind(this, this.refreshForObject));
 
         Application.searchMatchManager.connect('active-changed', Lang.bind(this, 
this._onSearchMatchChanged));
-    },
+    }
 
-    _onSearchMatchChanged: function() {
+    _onSearchMatchChanged() {
         // when the "match" search setting changes, refresh only if
         // the search string is not empty
         if (Application.searchController.getString() != '')
             this.refreshForObject();
-    },
+    }
 
-    getOffsetController: function() {
+    getOffsetController() {
         return Application.offsetSearchController;
-    },
+    }
 
-    getQuery: function() {
+    getQuery() {
         return Application.queryBuilder.buildGlobalQuery(Query.QueryFlags.SEARCH,
                                                          Application.offsetSearchController,
                                                          this.sortBy);
-    },
+    }
 });
diff --git a/src/trackerUtils.js b/src/trackerUtils.js
index a1653fed..b059eba9 100644
--- a/src/trackerUtils.js
+++ b/src/trackerUtils.js
@@ -19,6 +19,7 @@
  *
  */
 
+const GObject = imports.gi.GObject;
 const Lang = imports.lang;
 
 const Application = imports.application;
@@ -40,16 +41,16 @@ function setEditedName(newTitle, docId, callback) {
 
 }
 
-var SingleItemJob = new Lang.Class({
-    Name: 'SingleItemJob',
+var SingleItemJob = GObject.registerClass(
+    class SingleItemJob extends GObject.Object {
 
-    _init: function(urn, queryBuilder) {
+    _init(urn, queryBuilder) {
         this._urn = urn;
         this._cursor = null;
         this._builder = queryBuilder;
-    },
+    }
 
-    run: function(flags, callback) {
+    run(flags, callback) {
         this._callback = callback;
 
         let query = this._builder.buildSingleQuery(flags, this._urn);
@@ -63,9 +64,9 @@ var SingleItemJob = new Lang.Class({
                     this._emitCallback();
                 }
             }));
-    },
+    }
 
-    _onCursorNext: function(cursor, res) {
+    _onCursorNext(cursor, res) {
         let valid = false;
 
         try {
@@ -84,9 +85,9 @@ var SingleItemJob = new Lang.Class({
         this._cursor = cursor;
         this._emitCallback();
         cursor.close();
-    },
+    }
 
-    _emitCallback: function() {
+    _emitCallback() {
         this._callback(this._cursor);
     }
 });
diff --git a/src/windowMode.js b/src/windowMode.js
index 9797528f..abe2dde7 100644
--- a/src/windowMode.js
+++ b/src/windowMode.js
@@ -19,6 +19,7 @@
  *
  */
 
+const GObject = imports.gi.GObject;
 const Lang = imports.lang;
 const Signals = imports.signals;
 
@@ -32,15 +33,15 @@ var WindowMode = {
     SEARCH: 6,
 };
 
-var ModeController = new Lang.Class({
-    Name: 'ModeController',
+var ModeController = GObject.registerClass(
+    class ModeController extends GObject.Object {
 
-    _init: function() {
+    _init() {
         this._mode = WindowMode.NONE;
         this._history = [];
-    },
+    }
 
-    goBack: function(steps) {
+    goBack(steps) {
         if (!steps)
             steps = 1;
 
@@ -67,9 +68,9 @@ var ModeController = new Lang.Class({
         this._mode = tmp;
 
         this.emit('window-mode-changed', this._mode, oldMode);
-    },
+    }
 
-    setWindowMode: function(mode) {
+    setWindowMode(mode) {
         let oldMode = this._mode;
 
         if (oldMode == mode)
@@ -79,9 +80,9 @@ var ModeController = new Lang.Class({
         this._mode = mode;
 
         this.emit('window-mode-changed', this._mode, oldMode);
-    },
+    }
 
-    getWindowMode: function() {
+    getWindowMode() {
         return this._mode;
     }
 });


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