[polari] cleanup: Use regular constructors in GObject subclasses



commit 33368ebac75a46d2ed053592d1d27d87903339a9
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Feb 15 00:25:23 2022 +0100

    cleanup: Use regular constructors in GObject subclasses
    
    As a side-effect of supporting class fields, regular constructors
    now work in GObject subclasses. Using _init() still works and
    there's no functional difference, but it's simply much nicer
    to use the same syntax for all classes.
    
    Part-of: <https://gitlab.gnome.org/GNOME/polari/-/merge_requests/243>

 src/accountsMonitor.js   | 11 +++++------
 src/appNotifications.js  | 40 ++++++++++++++++++++--------------------
 src/application.js       |  4 ++--
 src/chatView.js          | 25 +++++++++++--------------
 src/connections.js       | 29 +++++++++++++++--------------
 src/entryArea.js         | 26 ++++++++++++++------------
 src/initialSetup.js      |  4 ++--
 src/joinDialog.js        |  4 ++--
 src/mainWindow.js        | 40 ++++++++++++++++++++--------------------
 src/roomList.js          | 28 +++++++++++++++-------------
 src/roomStack.js         | 31 ++++++++++++++++---------------
 src/serverRoomManager.js | 10 +++++-----
 src/telepathyClient.js   | 12 ++++++------
 src/thumbnailer.js       |  6 +++---
 src/urlPreview.js        |  4 ++--
 src/userList.js          | 39 ++++++++++++++++++++-------------------
 src/userTracker.js       |  4 ++--
 17 files changed, 160 insertions(+), 157 deletions(-)
---
diff --git a/src/accountsMonitor.js b/src/accountsMonitor.js
index 685916d8..678e7acf 100644
--- a/src/accountsMonitor.js
+++ b/src/accountsMonitor.js
@@ -246,13 +246,12 @@ const PolariAccount = GObject.registerClass({
             Gio.Settings.$gtype),
     },
 }, class PolariAccount extends Tp.Account {
-    _init(params) {
-        this._visible = true;
-        this._reachable = undefined;
+    _visible = true;
+    _reachable = undefined;
+    _networksManager = NetworksManager.getDefault();
 
-        this._networksManager = NetworksManager.getDefault();
-
-        super._init(params);
+    constructor(params) {
+        super(params);
 
         this._settings = new Gio.Settings({
             schema_id: 'org.gnome.Polari.Account',
diff --git a/src/appNotifications.js b/src/appNotifications.js
index 374c5f71..9f9ad042 100644
--- a/src/appNotifications.js
+++ b/src/appNotifications.js
@@ -9,8 +9,8 @@ const COMMAND_OUTPUT_REVEAL_TIME = 3;
 const AppNotification = GObject.registerClass({
     GTypeFlags: GObject.TypeFlags.ABSTRACT,
 }, class AppNotification extends Gtk.Revealer {
-    _init() {
-        super._init({
+    constructor() {
+        super({
             reveal_child: true,
             transition_type: Gtk.RevealerTransitionType.SLIDE_DOWN,
         });
@@ -30,8 +30,8 @@ const AppNotification = GObject.registerClass({
 
 export const MessageNotification = GObject.registerClass(
 class MessageNotification extends AppNotification {
-    _init(label, iconName) {
-        super._init();
+    constructor(label, iconName) {
+        super();
 
         GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, TIMEOUT, this.close.bind(this));
 
@@ -75,8 +75,8 @@ export const UndoNotification = GObject.registerClass({
         undo: {},
     },
 }, class UndoNotification extends MessageNotification {
-    _init(label) {
-        super._init(label);
+    constructor(label) {
+        super(label);
 
         this._undo = false;
         this._closed = false;
@@ -99,8 +99,8 @@ export const UndoNotification = GObject.registerClass({
 const CommandOutputNotification = GObject.registerClass({
     GTypeFlags: GObject.TypeFlags.ABSTRACT,
 }, class CommandOutputNotification extends AppNotification {
-    _init() {
-        super._init();
+    constructor() {
+        super();
 
         this.transition_type = Gtk.RevealerTransitionType.SLIDE_UP;
         GLib.timeout_add_seconds(
@@ -112,8 +112,8 @@ const CommandOutputNotification = GObject.registerClass({
 
 export const SimpleOutput = GObject.registerClass(
 class SimpleOutput extends CommandOutputNotification {
-    _init(text) {
-        super._init();
+    constructor(text) {
+        super();
 
         let label = new Gtk.Label({
             label: text,
@@ -126,8 +126,8 @@ class SimpleOutput extends CommandOutputNotification {
 
 export const GridOutput = GObject.registerClass(
 class GridOutput extends CommandOutputNotification {
-    _init(header, items) {
-        super._init();
+    constructor(header, items) {
+        super();
 
         let numItems = items.length;
         let numCols = Math.min(numItems, 4);
@@ -157,8 +157,8 @@ class GridOutput extends CommandOutputNotification {
 
 export const NotificationQueue = GObject.registerClass(
 class NotificationQueue extends Gtk.Frame {
-    _init() {
-        super._init({
+    constructor() {
+        super({
             valign: Gtk.Align.START,
             halign: Gtk.Align.CENTER,
             margin_start: 24, margin_end: 24,
@@ -196,8 +196,8 @@ class NotificationQueue extends Gtk.Frame {
 
 export const CommandOutputQueue = GObject.registerClass(
 class CommandOutputQueue extends NotificationQueue {
-    _init() {
-        super._init();
+    constructor() {
+        super();
 
         this.valign = Gtk.Align.END;
         this.add_css_class('irc-feedback');
@@ -216,16 +216,16 @@ export const MessageInfoBar = GObject.registerClass({
             ''),
     },
 }, class MessageInfoBar extends Gtk.InfoBar {
-    _init(params) {
-        this._title = '';
-        this._subtitle = '';
+    _title = '';
+    _subtitle = '';
 
+    constructor(params) {
         let defaultParams = {
             show_close_button: true,
             revealed: false,
             valign: Gtk.Align.START,
         };
-        super._init(Object.assign(defaultParams, params));
+        super(Object.assign(defaultParams, params));
 
         let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
         this.add_child(box);
diff --git a/src/application.js b/src/application.js
index b61e2667..91bb3585 100644
--- a/src/application.js
+++ b/src/application.js
@@ -43,8 +43,8 @@ export default GObject.registerClass({
         'room-focus-changed': {},
     },
 }, class Application extends Gtk.Application {
-    _init() {
-        super._init({
+    constructor() {
+        super({
             application_id: 'org.gnome.Polari',
             flags: Gio.ApplicationFlags.HANDLES_OPEN,
         });
diff --git a/src/chatView.js b/src/chatView.js
index f6f7c5ea..9c0c4398 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -58,11 +58,11 @@ const TextView = GObject.registerClass({
             0, GLib.MAXUINT32, 0),
     },
 }, class TextView extends Gtk.TextView {
-    _init(params) {
-        this._indentWidthChars = 0;
-        this._indentSpacing = 0;
+    _indentWidthChars = 0;
+    _indentSpacing = 0;
 
-        super._init(params);
+    constructor(params) {
+        super(params);
 
         this.buffer.connect('mark-set', this._onMarkSet.bind(this));
         this.connect('notify::root', this._onScreenChanged.bind(this));
@@ -219,10 +219,7 @@ const ButtonTag = GObject.registerClass({
         'popup-menu': { param_types: [GObject.TYPE_DOUBLE, GObject.TYPE_DOUBLE] },
     },
 }, class ButtonTag extends Gtk.TextTag {
-    _init(params) {
-        this._hover = false;
-        super._init(params);
-    }
+    _hover = false;
 
     get hover() {
         return this._hover;
@@ -257,11 +254,11 @@ const HoverFilterTag = GObject.registerClass({
             0.0, 1.0, 1.0),
     },
 }, class HoverFilterTag extends ButtonTag {
-    _init(params) {
-        this._filteredTag = null;
-        this._hoverOpacity = 1.;
+    _filteredTag = null;
+    _hoverOpacity = 1.;
 
-        super._init(params);
+    constructor(params) {
+        super(params);
 
         this.connect('notify::hover', () => this._updateColor());
     }
@@ -319,8 +316,8 @@ export default GObject.registerClass({
             0, GLib.MAXUINT32, 0),
     },
 }, class ChatView extends Gtk.ScrolledWindow {
-    _init(room) {
-        super._init({ hscrollbar_policy: Gtk.PolicyType.NEVER, vexpand: true });
+    constructor(room) {
+        super({ hscrollbar_policy: Gtk.PolicyType.NEVER, vexpand: true });
 
         this.add_css_class('polari-chat-view');
 
diff --git a/src/connections.js b/src/connections.js
index 7d4144cb..92c1b92f 100644
--- a/src/connections.js
+++ b/src/connections.js
@@ -26,15 +26,16 @@ const ErrorHint = {
 
 const ConnectionRow = GObject.registerClass(
 class ConnectionRow extends Gtk.ListBoxRow {
-    _init(params) {
+    constructor(params) {
         if (!params || !params.id)
             throw new Error('No id in parameters');
 
-        this._id = params.id;
+        const { id } = params;
         delete params.id;
 
-        super._init(params);
+        super(params);
 
+        this._id = id;
         let name = NetworksManager.getDefault().getNetworkName(this._id);
         this.name = `ConnectionRow ${name}`;
 
@@ -84,10 +85,10 @@ export const ConnectionsList = GObject.registerClass({
         'account-selected': {},
     },
 }, class ConnectionsList extends Gtk.ScrolledWindow {
-    _init(params) {
-        this._favoritesOnly = false;
+    _favoritesOnly = false;
 
-        super._init(params);
+    constructor(params) {
+        super(params);
 
         this.hscrollbar_policy = Gtk.PolicyType.NEVER;
 
@@ -282,16 +283,16 @@ export const ConnectionDetails = GObject.registerClass({
         'account-created': { param_types: [Tp.Account.$gtype] },
     },
 }, class ConnectionDetails extends Gtk.Grid {
-    _init(params) {
-        this._networksManager = NetworksManager.getDefault();
+    _networksManager = NetworksManager.getDefault();
+    _account = null;
+
+    constructor(params) {
+        super(params);
+
         let id = this._networksManager.connect('changed', () => {
             this.notify('has-service');
         });
 
-        this._account = null;
-
-        super._init(params);
-
         this.connect('destroy', () => {
             this._networksManager.disconnect(id);
         });
@@ -508,9 +509,9 @@ export const ConnectionProperties = GObject.registerClass({
         'errorLabel',
     ],
 }, class ConnectionProperties extends Gtk.Dialog {
-    _init(account) {
+    constructor(account) {
         /* Translators: %s is a connection name */
-        super._init({
+        super({
             title: vprintf(_('“%s” Properties'), account.display_name),
             use_header_bar: 1,
         });
diff --git a/src/entryArea.js b/src/entryArea.js
index 36c99bfd..be058dec 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -28,8 +28,8 @@ export const ChatEntry = GObject.registerClass({
         'file-pasted': { param_types: [Gio.File.$gtype] },
     },
 }, class ChatEntry extends Gtk.Entry {
-    _init(params) {
-        super._init(params);
+    constructor(params) {
+        super(params);
 
         const delegate = this.get_delegate();
         this.addTargets(delegate);
@@ -108,10 +108,10 @@ export const NickPopover = GObject.registerClass({
         'nick-changed': {},
     },
 }, class NickPopover extends Gtk.Popover {
-    _init() {
-        this._nick = '';
+    _nick = '';
 
-        super._init();
+    constructor() {
+        super();
 
         this.set_default_widget(this._changeButton);
 
@@ -166,16 +166,18 @@ export default GObject.registerClass({
         return this.__nickPopover;
     }
 
-    _init(params) {
-        this._room = params.room;
+    _maxNickChars = MAX_NICK_CHARS;
+    _nickChangedId = 0;
+    _popoverClosedId = 0;
+
+    constructor(params) {
+        const { room } = params;
         delete params.room;
 
-        this._ircParser = new IrcParser(this._room);
-        this._maxNickChars = MAX_NICK_CHARS;
-        this._nickChangedId = 0;
-        this._popoverClosedId = 0;
+        super(params);
 
-        super._init(params);
+        this._room = room;
+        this._ircParser = new IrcParser(this._room);
 
         this.connect('destroy', this._onDestroy.bind(this));
         this.connect('notify::sensitive', this._onSensitiveChanged.bind(this));
diff --git a/src/initialSetup.js b/src/initialSetup.js
index e70de3eb..00372ab0 100644
--- a/src/initialSetup.js
+++ b/src/initialSetup.js
@@ -22,8 +22,8 @@ export default GObject.registerClass({
         'serverRoomList',
     ],
 }, class InitialSetupWindow extends Gtk.Window {
-    _init(params) {
-        super._init(params);
+    constructor(params) {
+        super(params);
 
         this._currentAccount = null;
 
diff --git a/src/joinDialog.js b/src/joinDialog.js
index 65963203..1d275a90 100644
--- a/src/joinDialog.js
+++ b/src/joinDialog.js
@@ -28,9 +28,9 @@ export default GObject.registerClass({
         'backButton',
     ],
 }, class JoinDialog extends Gtk.Dialog {
-    _init(params) {
+    constructor(params) {
         params['use-header-bar'] = 1;
-        super._init(params);
+        super(params);
 
         this._setupMainPage();
         this._setupConnectionPage();
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 32f29251..fcd0b081 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -26,11 +26,11 @@ export const FixedSizeFrame = GObject.registerClass({
             -1, GLib.MAXINT32, -1),
     },
 }, class FixedSizeFrame extends Gtk.Widget {
-    _init(params) {
-        this._height = -1;
-        this._width = -1;
+    _height = -1;
+    _width = -1;
 
-        super._init({
+    constructor(params) {
+        super({
             ...params,
             layout_manager: new Gtk.BinLayout(),
         });
@@ -126,28 +126,28 @@ export default GObject.registerClass({
         'active-room-state-changed': {},
     },
 }, class MainWindow extends Gtk.ApplicationWindow {
-    _init(params) {
-        this._subtitle = '';
-        params.show_menubar = false;
+    _subtitle = '';
 
-        this._room = null;
-        this._lastActiveRoom = null;
+    _room = null;
+    _lastActiveRoom = null;
 
-        this._displayNameChangedId = 0;
-        this._topicChangedId = 0;
-        this._membersChangedId = 0;
-        this._channelChangedId = 0;
+    _settings = new Gio.Settings({ schema_id: 'org.gnome.Polari' });
+    _gtkSettings = Gtk.Settings.get_default();
 
-        super._init(params);
+    _currentSize = [-1, -1];
+    _isMaximized = false;
+    _isFullscreen = false;
 
-        this._userListPopover.set_parent(this._showUserListButton);
+    _displayNameChangedId = 0;
+    _topicChangedId = 0;
+    _membersChangedId = 0;
+    _channelChangedId = 0;
 
-        this._settings = new Gio.Settings({ schema_id: 'org.gnome.Polari' });
-        this._gtkSettings = Gtk.Settings.get_default();
+    constructor(params) {
+        params.show_menubar = false;
+        super(params);
 
-        this._currentSize = [-1, -1];
-        this._isMaximized = false;
-        this._isFullscreen = false;
+        this._userListPopover.set_parent(this._showUserListButton);
 
         this._notificationQueue = new AppNotifications.NotificationQueue();
         this._commandOutputQueue = new AppNotifications.CommandOutputQueue();
diff --git a/src/roomList.js b/src/roomList.js
index d1a1eaa9..1dbad9e0 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -28,8 +28,8 @@ const RoomRow = GObject.registerClass({
         'eventStack',
     ],
 }, class RoomRow extends Gtk.ListBoxRow {
-    _init(room) {
-        super._init({
+    constructor(room) {
+        super({
             name: `RoomRow ${room.display_name}`,
         });
 
@@ -229,8 +229,8 @@ const RoomRow = GObject.registerClass({
 
 const RoomRowPopover = GObject.registerClass(
 class RoomRowPopover extends Gtk.PopoverMenu {
-    _init(row) {
-        super._init({
+    constructor(row) {
+        super({
             position: Gtk.PositionType.BOTTOM,
         });
         this.set_parent(row);
@@ -320,18 +320,20 @@ const RoomListHeader = GObject.registerClass({
         return klass;
     }
 
-    _init(params) {
-        this._account = params.account;
+    constructor(params) {
+        const { account } = params;
         delete params.account;
 
-        this._app = Gio.Application.get_default();
-        this._popover = null;
-
-        super._init({
+        super({
             ...params,
-            name: `RoomListHeader ${this._account.display_name}`,
+            name: `RoomListHeader ${account.display_name}`,
         });
 
+        this._account = account;
+
+        this._app = Gio.Application.get_default();
+        this._popover = null;
+
         this.connect('activate',
             () => this._popover?.popup());
 
@@ -568,8 +570,8 @@ const RoomListHeader = GObject.registerClass({
 
 export default GObject.registerClass(
 class RoomList extends Gtk.ListBox {
-    _init(params) {
-        super._init(params);
+    constructor(params) {
+        super(params);
 
         this.set_header_func(this._updateHeader.bind(this));
         this.set_sort_func(this._sort.bind(this));
diff --git a/src/roomStack.js b/src/roomStack.js
index f3828da2..07d77e23 100644
--- a/src/roomStack.js
+++ b/src/roomStack.js
@@ -22,8 +22,8 @@ export default GObject.registerClass({
             0, GLib.MAXUINT32, 0),
     },
 }, class RoomStack extends Gtk.Stack {
-    _init(params) {
-        super._init(params);
+    constructor(params) {
+        super(params);
 
         this._sizeGroup = new Gtk.SizeGroup({ mode: Gtk.SizeGroupMode.VERTICAL });
         this._rooms = new Map();
@@ -132,14 +132,14 @@ export default GObject.registerClass({
 
 const SavePasswordConfirmationBar = GObject.registerClass(
 class SavePasswordConfirmationBar extends MessageInfoBar {
-    _init(room) {
-        this._room = room;
-
+    constructor(room) {
         let title = _('Should the password be saved?');
         let subtitle = vprintf(
             _('Identification will happen automatically the next time you connect to %s'),
-            this._room.account.display_name);
-        super._init({ title, subtitle });
+            room.account.display_name);
+        super({ title, subtitle });
+
+        this._room = room;
 
         this.connect('destroy', this._onDestroy.bind(this));
 
@@ -171,10 +171,10 @@ class SavePasswordConfirmationBar extends MessageInfoBar {
 
 const ChannelErrorBar = GObject.registerClass(
 class ChannelErrorBar extends MessageInfoBar {
-    _init(room) {
-        this._room = room;
+    constructor(room) {
+        super({ title: _('Failed to join the room') });
 
-        super._init({ title: _('Failed to join the room') });
+        this._room = room;
 
         this.add_button(_('_Retry'), Gtk.ResponseType.ACCEPT).set({
             action_name: 'app.reconnect-room',
@@ -225,8 +225,10 @@ class ChannelErrorBar extends MessageInfoBar {
 
 const ChatPlaceholder = GObject.registerClass(
 class ChatPlaceholder extends Gtk.Overlay {
-    _init(sizeGroup) {
-        this._accountsMonitor = AccountsMonitor.getDefault();
+    _accountsMonitor = AccountsMonitor.getDefault();
+
+    constructor(sizeGroup) {
+        super();
 
         let image = new Gtk.Image({
             icon_name: 'org.gnome.Polari-symbolic',
@@ -252,7 +254,6 @@ class ChatPlaceholder extends Gtk.Overlay {
         let inputPlaceholder = new Gtk.Box({ valign: Gtk.Align.END });
         sizeGroup.add_widget(inputPlaceholder);
 
-        super._init();
         let grid = new Gtk.Grid({
             column_homogeneous: true,
             can_focus: false,
@@ -272,8 +273,8 @@ class ChatPlaceholder extends Gtk.Overlay {
 
 const RoomView = GObject.registerClass(
 class RoomView extends Gtk.Overlay {
-    _init(room, sizeGroup) {
-        super._init({ name: `RoomView ${room.display_name}` });
+    constructor(room, sizeGroup) {
+        super({ name: `RoomView ${room.display_name}` });
 
         let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
         this.set_child(box);
diff --git a/src/serverRoomManager.js b/src/serverRoomManager.js
index 88e342dd..c9a72917 100644
--- a/src/serverRoomManager.js
+++ b/src/serverRoomManager.js
@@ -125,12 +125,12 @@ export const ServerRoomList = GObject.registerClass({
             false),
     },
 }, class ServerRoomList extends Gtk.Box {
-    _init(params) {
-        this._account = null;
-        this._pendingInfos = [];
-        this._filterTerms = [];
+    _account = null;
+    _pendingInfos = [];
+    _filterTerms = [];
 
-        super._init(params);
+    constructor(params) {
+        super(params);
 
         this._list.model.set_visible_func((model, iter) => {
             let name = model.get_value(iter, RoomListColumn.NAME);
diff --git a/src/telepathyClient.js b/src/telepathyClient.js
index 8f4215c4..6c6cb29e 100644
--- a/src/telepathyClient.js
+++ b/src/telepathyClient.js
@@ -125,7 +125,12 @@ class SASLAuthHandler {
 
 export default GObject.registerClass(
 class TelepathyClient extends Tp.BaseClient {
-    _init(params) {
+    _pendingBotPasswords = new Map();
+    _pendingRequests = new Map();
+
+    constructor(params) {
+        super(params);
+
         this._app = Gio.Application.get_default();
         this._app.connect('prepare-shutdown', () => {
             [...this._pendingRequests.values()].forEach(r => r.cancel());
@@ -134,11 +139,6 @@ class TelepathyClient extends Tp.BaseClient {
         });
         this._app.hold();
 
-        this._pendingBotPasswords = new Map();
-        this._pendingRequests = new Map();
-
-        super._init(params);
-
         this.set_handler_bypass_approval(false);
         this.set_observer_recover(true);
 
diff --git a/src/thumbnailer.js b/src/thumbnailer.js
index ed6350ea..060ebb93 100644
--- a/src/thumbnailer.js
+++ b/src/thumbnailer.js
@@ -36,10 +36,10 @@ let PreviewWindow = GObject.registerClass({
         'snapshot-failed': {},
     },
 }, class PreviewWindow extends Gtk.Window {
-    _init(params) {
-        this._snapshot = null;
+    _snapshot = null;
 
-        super._init(params);
+    constructor(params) {
+        super(params);
 
         let settings = new WebKit2.Settings({
             hardware_acceleration_policy: WebKit2.HardwareAccelerationPolicy.NEVER,
diff --git a/src/urlPreview.js b/src/urlPreview.js
index 5f7931e4..f97fdef0 100644
--- a/src/urlPreview.js
+++ b/src/urlPreview.js
@@ -107,8 +107,8 @@ export default GObject.registerClass({
             null),
     },
 }, class URLPreview extends Gtk.Box {
-    _init(params) {
-        super._init(params);
+    constructor(params) {
+        super(params);
 
         this.set({
             orientation: Gtk.Orientation.VERTICAL,
diff --git a/src/userList.js b/src/userList.js
index 34846b9e..03a8a324 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -13,8 +13,8 @@ const MAX_USERS_WIDTH_CHARS = 17;
 
 export const UserListPopover = GObject.registerClass(
 class UserListPopover extends Gtk.Popover {
-    _init(params) {
-        super._init(params);
+    constructor(params) {
+        super(params);
 
         this._createWidget();
 
@@ -131,16 +131,16 @@ export const UserDetails = GObject.registerClass({
             false),
     },
 }, class UserDetails extends Gtk.Box {
-    _init(params = {}) {
+    _expanded = false;
+    _initialDetailsLoaded = false;
+    _notificationsEnabled = false;
+    _user = null;
+
+    constructor(params = {}) {
         let { user } = params;
         delete params.user;
 
-        this._expanded = false;
-        this._initialDetailsLoaded = false;
-        this._notificationsEnabled = false;
-        this._user = null;
-
-        super._init(params);
+        super(params);
 
         this.user = user;
 
@@ -318,17 +318,18 @@ export const UserPopover = GObject.registerClass({
         'userDetails',
     ],
 }, class UserPopover extends Gtk.Popover {
-    _init(params) {
-        this._room = params.room;
-        delete params.room;
+    _nickname = null;
+    _basenick = null;
 
-        this._userTracker = params.userTracker;
+    constructor(params) {
+        const { room, userTracker } = params;
+        delete params.room;
         delete params.userTracker;
 
-        this._nickname = null;
-        this._basenick = null;
+        super(params);
 
-        super._init(params);
+        this._room = room;
+        this._userTracker = userTracker;
 
         this._app = Gio.Application.get_default();
 
@@ -422,10 +423,10 @@ export const UserPopover = GObject.registerClass({
 
 const UserListRow = GObject.registerClass(
 class UserListRow extends Gtk.ListBoxRow {
-    _init(user) {
-        this._user = user;
+    constructor(user) {
+        super({ name: `UserListRow ${user.alias}` });
 
-        super._init({ name: `UserListRow ${user.alias}` });
+        this._user = user;
 
         this._createWidget();
 
diff --git a/src/userTracker.js b/src/userTracker.js
index 6b572ceb..1c0ecc69 100644
--- a/src/userTracker.js
+++ b/src/userTracker.js
@@ -78,8 +78,8 @@ const UserTracker = GObject.registerClass({
         },
     },
 }, class UserTracker extends GObject.Object {
-    _init(account) {
-        super._init();
+    constructor(account) {
+        super();
 
         this._account = account;
 


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