[polari] cleanup: Use static fields instead of registerClass params



commit 8b9ed2aed76dd68cb6bc42f02f1bd6d63cb164e9
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Feb 27 22:26:30 2022 +0100

    cleanup: Use static fields instead of registerClass params
    
    Class fields look more standardized than an object literal passed
    to a wrapper function, and are hopefully closer to what a future
    decorator syntax will look like.
    
    Part-of: <https://gitlab.gnome.org/GNOME/polari/-/merge_requests/246>

 src/accountsMonitor.js   |  9 ++++----
 src/appNotifications.js  | 32 ++++++++++++++++-------------
 src/application.js       |  9 ++++----
 src/chatView.js          | 43 ++++++++++++++++++++++-----------------
 src/connections.js       | 46 +++++++++++++++++++++++------------------
 src/entryArea.js         | 53 +++++++++++++++++++++++++++---------------------
 src/initialSetup.js      | 11 +++++-----
 src/joinDialog.js        | 11 +++++-----
 src/mainWindow.js        | 30 +++++++++++++++------------
 src/pasteManager.js      | 16 ++++++++-------
 src/roomList.js          | 34 +++++++++++++++++--------------
 src/roomStack.js         |  9 ++++----
 src/serverRoomManager.js | 16 ++++++++-------
 src/thumbnailer.js       | 14 +++++++------
 src/urlPreview.js        |  9 ++++----
 src/userList.js          | 27 +++++++++++++-----------
 src/userTracker.js       |  9 ++++----
 17 files changed, 212 insertions(+), 166 deletions(-)
---
diff --git a/src/accountsMonitor.js b/src/accountsMonitor.js
index 678e7acf..3b0d9406 100644
--- a/src/accountsMonitor.js
+++ b/src/accountsMonitor.js
@@ -226,8 +226,9 @@ class ClientFactory extends Polari.ClientFactory {
     }
 });
 
-const PolariAccount = GObject.registerClass({
-    Properties: {
+const PolariAccount = GObject.registerClass(
+class PolariAccount extends Tp.Account {
+    static [GObject.properties] = {
         predefined: GObject.ParamSpec.boolean(
             'predefined', 'predefined', 'predefined',
             GObject.ParamFlags.READABLE,
@@ -244,8 +245,8 @@ const PolariAccount = GObject.registerClass({
             'settings', 'settings', 'settings',
             GObject.ParamFlags.READABLE,
             Gio.Settings.$gtype),
-    },
-}, class PolariAccount extends Tp.Account {
+    };
+
     _visible = true;
     _reachable = undefined;
     _networksManager = NetworksManager.getDefault();
diff --git a/src/appNotifications.js b/src/appNotifications.js
index 9f9ad042..f9a829c0 100644
--- a/src/appNotifications.js
+++ b/src/appNotifications.js
@@ -6,9 +6,10 @@ import Pango from 'gi://Pango';
 const TIMEOUT = 7;
 const COMMAND_OUTPUT_REVEAL_TIME = 3;
 
-const AppNotification = GObject.registerClass({
-    GTypeFlags: GObject.TypeFlags.ABSTRACT,
-}, class AppNotification extends Gtk.Revealer {
+const AppNotification = GObject.registerClass(
+class AppNotification extends Gtk.Revealer {
+    static [GObject.GTypeFlags] = GObject.TypeFlags.ABSTRACT;
+
     constructor() {
         super({
             reveal_child: true,
@@ -69,12 +70,13 @@ class MessageNotification extends AppNotification {
     }
 });
 
-export const UndoNotification = GObject.registerClass({
-    Signals: {
+export const UndoNotification = GObject.registerClass(
+class UndoNotification extends MessageNotification {
+    static [GObject.signals] = {
         closed: {},
         undo: {},
-    },
-}, class UndoNotification extends MessageNotification {
+    };
+
     constructor(label) {
         super(label);
 
@@ -96,9 +98,10 @@ export const UndoNotification = GObject.registerClass({
     }
 });
 
-const CommandOutputNotification = GObject.registerClass({
-    GTypeFlags: GObject.TypeFlags.ABSTRACT,
-}, class CommandOutputNotification extends AppNotification {
+const CommandOutputNotification = GObject.registerClass(
+class CommandOutputNotification extends AppNotification {
+    static [GObject.GTypeFlags] = GObject.TypeFlags.ABSTRACT;
+
     constructor() {
         super();
 
@@ -204,8 +207,9 @@ class CommandOutputQueue extends NotificationQueue {
     }
 });
 
-export const MessageInfoBar = GObject.registerClass({
-    Properties: {
+export const MessageInfoBar = GObject.registerClass(
+class MessageInfoBar extends Gtk.InfoBar {
+    static [GObject.properties] = {
         'title': GObject.ParamSpec.string(
             'title', 'title', 'title',
             GObject.ParamFlags.READWRITE,
@@ -214,8 +218,8 @@ export const MessageInfoBar = GObject.registerClass({
             'subtitle', 'subtitle', 'subtitle',
             GObject.ParamFlags.READWRITE,
             ''),
-    },
-}, class MessageInfoBar extends Gtk.InfoBar {
+    };
+
     _title = '';
     _subtitle = '';
 
diff --git a/src/application.js b/src/application.js
index 91bb3585..86c2a99f 100644
--- a/src/application.js
+++ b/src/application.js
@@ -37,12 +37,13 @@ const MAX_RETRIES = 3;
 
 const IRC_SCHEMA_REGEX = /^(irc?:\/\/)([\da-z.-]+):?(\d+)?\/(?:%23)?([\w.+-]+)/i;
 
-export default GObject.registerClass({
-    Signals: {
+export default GObject.registerClass(
+class Application extends Gtk.Application {
+    static [GObject.signals] = {
         'prepare-shutdown': {},
         'room-focus-changed': {},
-    },
-}, class Application extends Gtk.Application {
+    };
+
     constructor() {
         super({
             application_id: 'org.gnome.Polari',
diff --git a/src/chatView.js b/src/chatView.js
index 06cbc6ff..53da3931 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -46,8 +46,9 @@ const NICKTAG_PREFIX = 'nick';
 
 // Workaround for GtkTextView growing horizontally over time when
 // added to a GtkScrolledWindow with horizontal scrolling disabled
-const TextView = GObject.registerClass({
-    Properties: {
+const TextView = GObject.registerClass(
+class TextView extends Gtk.TextView {
+    static [GObject.properties] = {
         'indent-width-chars': GObject.ParamSpec.uint(
             'indent-width-chars', 'indent-width-chars', 'indent-width-chars',
             GObject.ParamFlags.READWRITE,
@@ -56,8 +57,8 @@ const TextView = GObject.registerClass({
             'indent-spacing', 'indent-spacing', 'indent-spacing',
             GObject.ParamFlags.READWRITE,
             0, GLib.MAXUINT32, 0),
-    },
-}, class TextView extends Gtk.TextView {
+    };
+
     _indentWidthChars = 0;
     _indentSpacing = 0;
 
@@ -207,18 +208,20 @@ const TextView = GObject.registerClass({
     }
 });
 
-const ButtonTag = GObject.registerClass({
-    Properties: {
+const ButtonTag = GObject.registerClass(
+class ButtonTag extends Gtk.TextTag {
+    static [GObject.properties] = {
         'hover': GObject.ParamSpec.boolean(
             'hover', 'hover', 'hover',
             GObject.ParamFlags.READWRITE,
             false),
-    },
-    Signals: {
+    };
+
+    static [GObject.signals] = {
         'clicked': { param_types: [GObject.TYPE_DOUBLE, GObject.TYPE_DOUBLE] },
         'popup-menu': { param_types: [GObject.TYPE_DOUBLE, GObject.TYPE_DOUBLE] },
-    },
-}, class ButtonTag extends Gtk.TextTag {
+    };
+
     _hover = false;
 
     get hover() {
@@ -242,8 +245,9 @@ const ButtonTag = GObject.registerClass({
     }
 });
 
-const HoverFilterTag = GObject.registerClass({
-    Properties: {
+const HoverFilterTag = GObject.registerClass(
+class HoverFilterTag extends ButtonTag {
+    static [GObject.properties] = {
         'filtered-tag': GObject.ParamSpec.object(
             'filtered-tag', 'filtered-tag', 'filtered-tag',
             GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
@@ -252,8 +256,8 @@ const HoverFilterTag = GObject.registerClass({
             'hover-opacity', 'hover-opacity', 'hover-opacity',
             GObject.ParamFlags.READWRITE,
             0.0, 1.0, 1.0),
-    },
-}, class HoverFilterTag extends ButtonTag {
+    };
+
     constructor(params) {
         super(params);
 
@@ -303,16 +307,17 @@ const HoverFilterTag = GObject.registerClass({
     }
 });
 
-export default GObject.registerClass({
-    Implements: [DropTargetIface],
-    Properties: {
+export default GObject.registerClass(
+class ChatView extends Gtk.ScrolledWindow {
+    static [GObject.interfaces] = [DropTargetIface];
+    static [GObject.properties] = {
         'can-drop': GObject.ParamSpec.override('can-drop', DropTargetIface),
         'max-nick-chars': GObject.ParamSpec.uint(
             'max-nick-chars', 'max-nick-chars', 'max-nick-chars',
             GObject.ParamFlags.READABLE,
             0, GLib.MAXUINT32, 0),
-    },
-}, class ChatView extends Gtk.ScrolledWindow {
+    };
+
     constructor(room) {
         super({ hscrollbar_policy: Gtk.PolicyType.NEVER, vexpand: true });
 
diff --git a/src/connections.js b/src/connections.js
index 92c1b92f..81bcfed3 100644
--- a/src/connections.js
+++ b/src/connections.js
@@ -73,18 +73,20 @@ class ConnectionRow extends Gtk.ListBoxRow {
     }
 });
 
-export const ConnectionsList = GObject.registerClass({
-    Properties: {
+export const ConnectionsList = GObject.registerClass(
+class ConnectionsList extends Gtk.ScrolledWindow {
+    static [GObject.properties] = {
         'favorites-only': GObject.ParamSpec.boolean(
             'favorites-only', 'favorites-only', 'favorites-only',
             GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
             false),
-    },
-    Signals: {
+    };
+
+    static [GObject.signals] = {
         'account-created': { param_types: [Tp.Account.$gtype] },
         'account-selected': {},
-    },
-}, class ConnectionsList extends Gtk.ScrolledWindow {
+    };
+
     _favoritesOnly = false;
 
     constructor(params) {
@@ -260,16 +262,18 @@ export const ConnectionsList = GObject.registerClass({
     }
 });
 
-export const ConnectionDetails = GObject.registerClass({
-    Template: 'resource:///org/gnome/Polari/ui/connection-details.ui',
-    InternalChildren: [
+export const ConnectionDetails = GObject.registerClass(
+class ConnectionDetails extends Gtk.Grid {
+    static [Gtk.template] = 'resource:///org/gnome/Polari/ui/connection-details.ui';
+    static [Gtk.internalChildren] = [
         'nameEntry',
         'serverEntry',
         'nickEntry',
         'realnameEntry',
         'sslCheckbox',
-    ],
-    Properties: {
+    ];
+
+    static [GObject.properties] = {
         'can-confirm': GObject.ParamSpec.boolean(
             'can-confirm', 'can-confirm', 'can-confirm',
             GObject.ParamFlags.READABLE,
@@ -278,11 +282,12 @@ export const ConnectionDetails = GObject.registerClass({
             'has-service', 'has-service', 'has-service',
             GObject.ParamFlags.READABLE,
             false),
-    },
-    Signals: {
+    };
+
+    static [GObject.signals] = {
         'account-created': { param_types: [Tp.Account.$gtype] },
-    },
-}, class ConnectionDetails extends Gtk.Grid {
+    };
+
     _networksManager = NetworksManager.getDefault();
     _account = null;
 
@@ -501,14 +506,15 @@ export const ConnectionDetails = GObject.registerClass({
 });
 
 
-export const ConnectionProperties = GObject.registerClass({
-    Template: 'resource:///org/gnome/Polari/ui/connection-properties.ui',
-    InternalChildren: [
+export const ConnectionProperties = GObject.registerClass(
+class ConnectionProperties extends Gtk.Dialog {
+    static [Gtk.template] = 'resource:///org/gnome/Polari/ui/connection-properties.ui';
+    static [Gtk.internalChildren] = [
         'details',
         'errorBox',
         'errorLabel',
-    ],
-}, class ConnectionProperties extends Gtk.Dialog {
+    ];
+
     constructor(account) {
         /* Translators: %s is a connection name */
         super({
diff --git a/src/entryArea.js b/src/entryArea.js
index be058dec..805754d0 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -17,17 +17,19 @@ const MAX_LINES = 5;
 Gio._promisify(Gio._LocalFilePrototype,
     'query_info_async', 'query_info_finish');
 
-export const ChatEntry = GObject.registerClass({
-    Implements: [DropTargetIface],
-    Properties: {
+export const ChatEntry = GObject.registerClass(
+class ChatEntry extends Gtk.Entry {
+    static [GObject.interfaces] = [DropTargetIface];
+    static [GObject.properties] = {
         'can-drop': GObject.ParamSpec.override('can-drop', DropTargetIface),
-    },
-    Signals: {
+    };
+
+    static [GObject.signals] = {
         'text-pasted': { param_types: [GObject.TYPE_STRING, GObject.TYPE_INT] },
         'image-pasted': { param_types: [GdkPixbuf.Pixbuf.$gtype] },
         'file-pasted': { param_types: [Gio.File.$gtype] },
-    },
-}, class ChatEntry extends Gtk.Entry {
+    };
+
     constructor(params) {
         super(params);
 
@@ -92,22 +94,25 @@ export const ChatEntry = GObject.registerClass({
     }
 });
 
-export const NickPopover = GObject.registerClass({
-    Template: 'resource:///org/gnome/Polari/ui/nick-popover.ui',
-    InternalChildren: [
+export const NickPopover = GObject.registerClass(
+class NickPopover extends Gtk.Popover {
+    static [Gtk.template] = 'resource:///org/gnome/Polari/ui/nick-popover.ui';
+    static [Gtk.internalChildren] = [
         'nickEntry',
         'changeButton',
-    ],
-    Properties: {
+    ];
+
+    static [GObject.properties] = {
         nick: GObject.ParamSpec.string(
             'nick', 'nick', 'nick',
             GObject.ParamFlags.READWRITE,
             ''),
-    },
-    Signals: {
+    };
+
+    static [GObject.signals] = {
         'nick-changed': {},
-    },
-}, class NickPopover extends Gtk.Popover {
+    };
+
     _nick = '';
 
     constructor() {
@@ -140,9 +145,10 @@ export const NickPopover = GObject.registerClass({
     }
 });
 
-export default GObject.registerClass({
-    Template: 'resource:///org/gnome/Polari/ui/entry-area.ui',
-    InternalChildren: [
+export default GObject.registerClass(
+class EntryArea extends Gtk.Stack {
+    static [Gtk.template] = 'resource:///org/gnome/Polari/ui/entry-area.ui';
+    static [Gtk.internalChildren] = [
         'chatEntry',
         'nickButton',
         'nickLabel',
@@ -152,14 +158,15 @@ export default GObject.registerClass({
         'uploadSpinner',
         'cancelButton',
         'pasteButton',
-    ],
-    Properties: {
+    ];
+
+    static [GObject.properties] = {
         'max-nick-chars': GObject.ParamSpec.uint(
             'max-nick-chars', 'max-nick-chars', 'max-nick-chars',
             GObject.ParamFlags.WRITABLE,
             0, GLib.MAXUINT32, 0),
-    },
-}, class EntryArea extends Gtk.Stack {
+    };
+
     static get _nickPopover() {
         if (!this.__nickPopover)
             this.__nickPopover = new NickPopover();
diff --git a/src/initialSetup.js b/src/initialSetup.js
index 00372ab0..d161a5f7 100644
--- a/src/initialSetup.js
+++ b/src/initialSetup.js
@@ -12,16 +12,17 @@ const SetupPage = {
     OFFLINE: 2,
 };
 
-export default GObject.registerClass({
-    Template: 'resource:///org/gnome/Polari/ui/initial-setup-window.ui',
-    InternalChildren: [
+export default GObject.registerClass(
+class InitialSetupWindow extends Gtk.Window {
+    static [Gtk.template] = 'resource:///org/gnome/Polari/ui/initial-setup-window.ui';
+    static [Gtk.internalChildren] = [
         'contentStack',
         'connectionsList',
         'nextButton',
         'prevButton',
         'serverRoomList',
-    ],
-}, class InitialSetupWindow extends Gtk.Window {
+    ];
+
     constructor(params) {
         super(params);
 
diff --git a/src/joinDialog.js b/src/joinDialog.js
index 1d275a90..9ccbcae2 100644
--- a/src/joinDialog.js
+++ b/src/joinDialog.js
@@ -10,9 +10,10 @@ const DialogPage = {
     CONNECTION: 1,
 };
 
-export default GObject.registerClass({
-    Template: 'resource:///org/gnome/Polari/ui/join-room-dialog.ui',
-    InternalChildren: [
+export default GObject.registerClass(
+class JoinDialog extends Gtk.Dialog {
+    static [Gtk.template] = 'resource:///org/gnome/Polari/ui/join-room-dialog.ui';
+    static [Gtk.internalChildren] = [
         'cancelButton',
         'joinButton',
         'mainStack',
@@ -26,8 +27,8 @@ export default GObject.registerClass({
         'addButton',
         'customToggle',
         'backButton',
-    ],
-}, class JoinDialog extends Gtk.Dialog {
+    ];
+
     constructor(params) {
         params['use-header-bar'] = 1;
         super(params);
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 62ff4e8f..3651034b 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -14,8 +14,9 @@ import RoomStack_ from './roomStack.js'; // used in template
 import * as UserList_ from './userList.js'; // used in template
 import * as Utils from './utils.js';
 
-export const FixedSizeFrame = GObject.registerClass({
-    Properties: {
+export const FixedSizeFrame = GObject.registerClass(
+class FixedSizeFrame extends Gtk.Widget {
+    static [GObject.properties] = {
         height: GObject.ParamSpec.int(
             'height', 'height', 'height',
             GObject.ParamFlags.READWRITE,
@@ -24,8 +25,8 @@ export const FixedSizeFrame = GObject.registerClass({
             'width', 'width', 'width',
             GObject.ParamFlags.READWRITE,
             -1, GLib.MAXINT32, -1),
-    },
-}, class FixedSizeFrame extends Gtk.Widget {
+    };
+
     _height = -1;
     _width = -1;
 
@@ -91,9 +92,10 @@ class ButtonBinLayout extends Gtk.BinLayout {
     }
 });
 
-export default GObject.registerClass({
-    Template: 'resource:///org/gnome/Polari/ui/main-window.ui',
-    InternalChildren: [
+export default GObject.registerClass(
+class MainWindow extends Gtk.ApplicationWindow {
+    static [Gtk.template] = 'resource:///org/gnome/Polari/ui/main-window.ui';
+    static [Gtk.internalChildren] = [
         'titlebarRight',
         'titlebarLeft',
         'joinButton',
@@ -103,8 +105,9 @@ export default GObject.registerClass({
         'offlineInfoBar',
         'overlay',
         'roomStack',
-    ],
-    Properties: {
+    ];
+
+    static [GObject.properties] = {
         subtitle: GObject.ParamSpec.string(
             'subtitle', 'subtitle', 'subtitle',
             GObject.ParamFlags.READABLE,
@@ -121,11 +124,12 @@ export default GObject.registerClass({
             'view-height', 'view-height', 'view-height',
             GObject.ParamFlags.READABLE,
             0, GLib.MAXUINT32, 0),
-    },
-    Signals: {
+    };
+
+    static [GObject.signals] = {
         'active-room-state-changed': {},
-    },
-}, class MainWindow extends Gtk.ApplicationWindow {
+    };
+
     _lastActiveRoom = null;
 
     _settings = new Gio.Settings({ schema_id: 'org.gnome.Polari' });
diff --git a/src/pasteManager.js b/src/pasteManager.js
index 36473de0..d95db77b 100644
--- a/src/pasteManager.js
+++ b/src/pasteManager.js
@@ -65,20 +65,22 @@ export default class PasteManager {
     }
 }
 
-export const DropTargetIface = GObject.registerClass({
-    Requires: [GObject.Object],
-    Properties: {
+export const DropTargetIface = GObject.registerClass(
+class DropTargetIface extends GObject.Interface {
+    static [GObject.requires] = [GObject.Object];
+    static [GObject.properties] = {
         'can-drop': GObject.ParamSpec.boolean(
             'can-drop', 'can-drop', 'can-drop',
             GObject.ParamFlags.READABLE,
             false),
-    },
-    Signals: {
+    };
+
+    static [GObject.signals] = {
         'text-dropped': { param_types: [GObject.TYPE_STRING] },
         'image-dropped': { param_types: [GdkPixbuf.Pixbuf] },
         'file-dropped': { param_types: [Gio.File] },
-    },
-}, class DropTargetIface extends GObject.Interface {
+    };
+
     addTargets(widget) {
         const imageTypes = [];
         for (const f of GdkPixbuf.Pixbuf.get_formats())
diff --git a/src/roomList.js b/src/roomList.js
index a6644a6b..8e45f578 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -18,16 +18,17 @@ function _onPopoverVisibleChanged(popover) {
         popover.get_parent().remove_css_class('has-open-popup');
 }
 
-const RoomRow = GObject.registerClass({
-    Template: 'resource:///org/gnome/Polari/ui/room-list-row.ui',
-    InternalChildren: [
+const RoomRow = GObject.registerClass(
+class RoomRow extends Gtk.ListBoxRow {
+    static [Gtk.template] = 'resource:///org/gnome/Polari/ui/room-list-row.ui';
+    static [Gtk.internalChildren] = [
         'box',
         'icon',
         'roomLabel',
         'counter',
         'eventStack',
-    ],
-}, class RoomRow extends Gtk.ListBoxRow {
+    ];
+
     constructor(room) {
         super({
             name: `RoomRow ${room.display_name}`,
@@ -285,10 +286,11 @@ class RoomRowPopover extends Gtk.PopoverMenu {
     }
 });
 
-const RoomListHeader = GObject.registerClass({
-    CssName: 'row',
-    Template: 'resource:///org/gnome/Polari/ui/room-list-header.ui',
-    InternalChildren: [
+const RoomListHeader = GObject.registerClass(
+class RoomListHeader extends Gtk.Widget {
+    static [Gtk.cssName] = 'row';
+    static [Gtk.template] = 'resource:///org/gnome/Polari/ui/room-list-header.ui';
+    static [Gtk.internalChildren] = [
         'label',
         'iconStack',
         'popoverStatus',
@@ -300,17 +302,19 @@ const RoomListHeader = GObject.registerClass({
         'popoverRemove',
         'popoverProperties',
         'spinner',
-    ],
-    Properties: {
+    ];
+
+    static [GObject.properties] = {
         'popover': GObject.ParamSpec.object(
             'popover', 'popover', 'popover',
             GObject.ParamFlags.READWRITE,
             Gtk.Popover.$gtype),
-    },
-    Signals: {
+    };
+
+    static [GObject.signals] = {
         'activate': { flags: GObject.SignalFlags.ACTION },
-    },
-}, class RoomListHeader extends Gtk.Widget {
+    };
+
     static _classInit(klass) {
         klass = Gtk.Widget._classInit(klass);
 
diff --git a/src/roomStack.js b/src/roomStack.js
index 07d77e23..caed350e 100644
--- a/src/roomStack.js
+++ b/src/roomStack.js
@@ -10,8 +10,9 @@ import EntryArea from './entryArea.js';
 import { MessageInfoBar } from './appNotifications.js';
 import RoomManager from './roomManager.js';
 
-export default GObject.registerClass({
-    Properties: {
+export default GObject.registerClass(
+class RoomStack extends Gtk.Stack {
+    static [GObject.properties] = {
         'entry-area-height': GObject.ParamSpec.uint(
             'entry-area-height', 'entry-area-height', 'entry-area-height',
             GObject.ParamFlags.READABLE,
@@ -20,8 +21,8 @@ export default GObject.registerClass({
             'view-height', 'view-height', 'view-height',
             GObject.ParamFlags.READABLE,
             0, GLib.MAXUINT32, 0),
-    },
-}, class RoomStack extends Gtk.Stack {
+    };
+
     constructor(params) {
         super(params);
 
diff --git a/src/serverRoomManager.js b/src/serverRoomManager.js
index c9a72917..ffa77660 100644
--- a/src/serverRoomManager.js
+++ b/src/serverRoomManager.js
@@ -109,22 +109,24 @@ function _strBaseEqual(str1, str2) {
     return str1.localeCompare(str2, {}, { sensitivity: 'base' }) === 0;
 }
 
-export const ServerRoomList = GObject.registerClass({
-    Template: 'resource:///org/gnome/Polari/ui/server-room-list.ui',
-    InternalChildren: [
+export const ServerRoomList = GObject.registerClass(
+class ServerRoomList extends Gtk.Box {
+    static [Gtk.template] = 'resource:///org/gnome/Polari/ui/server-room-list.ui';
+    static [Gtk.internalChildren] = [
         'filterEntry',
         'list',
         'spinner',
         'store',
         'toggleRenderer',
-    ],
-    Properties: {
+    ];
+
+    static [GObject.properties] = {
         'can-join': GObject.ParamSpec.boolean(
             'can-join', 'can-join', 'can-join',
             GObject.ParamFlags.READABLE,
             false),
-    },
-}, class ServerRoomList extends Gtk.Box {
+    };
+
     _account = null;
     _pendingInfos = [];
     _filterTerms = [];
diff --git a/src/thumbnailer.js b/src/thumbnailer.js
index 060ebb93..fdf6330b 100644
--- a/src/thumbnailer.js
+++ b/src/thumbnailer.js
@@ -24,18 +24,20 @@ const PREVIEW_WIDTH = 120;
 const PREVIEW_HEIGHT = 90;
 const FALLBACK_ICON_SIZE = 64;
 
-let PreviewWindow = GObject.registerClass({
-    Properties: {
+let PreviewWindow = GObject.registerClass(
+class PreviewWindow extends Gtk.Window {
+    static [GObject.properties] = {
         'uri': GObject.ParamSpec.string(
             'uri', 'uri', 'uri',
             GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
             null),
-    },
-    Signals: {
+    };
+
+    static [GObject.signals] = {
         'snapshot-ready': {},
         'snapshot-failed': {},
-    },
-}, class PreviewWindow extends Gtk.Window {
+    };
+
     _snapshot = null;
 
     constructor(params) {
diff --git a/src/urlPreview.js b/src/urlPreview.js
index f97fdef0..c58effaa 100644
--- a/src/urlPreview.js
+++ b/src/urlPreview.js
@@ -99,14 +99,15 @@ class Thumbnailer {
     }
 }
 
-export default GObject.registerClass({
-    Properties: {
+export default GObject.registerClass(
+class URLPreview extends Gtk.Box {
+    static [GObject.properties] = {
         'uri': GObject.ParamSpec.string(
             'uri', 'uri', 'uri',
             GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
             null),
-    },
-}, class URLPreview extends Gtk.Box {
+    };
+
     constructor(params) {
         super(params);
 
diff --git a/src/userList.js b/src/userList.js
index 03a8a324..ac048a7e 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -109,9 +109,10 @@ class UserListPopover extends Gtk.Popover {
     }
 });
 
-export const UserDetails = GObject.registerClass({
-    Template: 'resource:///org/gnome/Polari/ui/user-details.ui',
-    InternalChildren: [
+export const UserDetails = GObject.registerClass(
+class UserDetails extends Gtk.Box {
+    static [Gtk.template] = 'resource:///org/gnome/Polari/ui/user-details.ui';
+    static [Gtk.internalChildren] = [
         'spinnerBox',
         'spinner',
         'detailsGrid',
@@ -119,8 +120,9 @@ export const UserDetails = GObject.registerClass({
         'lastLabel',
         'notificationLabel',
         'messageButton',
-    ],
-    Properties: {
+    ];
+
+    static [GObject.properties] = {
         'expanded': GObject.ParamSpec.boolean(
             'expanded', 'expanded', 'expanded',
             GObject.ParamFlags.READWRITE,
@@ -129,8 +131,8 @@ export const UserDetails = GObject.registerClass({
             'notifications-enabled', 'notifications-enabled', 'notifications-enabled',
             GObject.ParamFlags.READWRITE,
             false),
-    },
-}, class UserDetails extends Gtk.Box {
+    };
+
     _expanded = false;
     _initialDetailsLoaded = false;
     _notificationsEnabled = false;
@@ -309,15 +311,16 @@ export const UserDetails = GObject.registerClass({
     }
 });
 
-export const UserPopover = GObject.registerClass({
-    Template: 'resource:///org/gnome/Polari/ui/user-popover.ui',
-    InternalChildren: [
+export const UserPopover = GObject.registerClass(
+class UserPopover extends Gtk.Popover {
+    static [Gtk.template] = 'resource:///org/gnome/Polari/ui/user-popover.ui';
+    static [Gtk.internalChildren] = [
         'nickLabel',
         'statusLabel',
         'notifyButton',
         'userDetails',
-    ],
-}, class UserPopover extends Gtk.Popover {
+    ];
+
     _nickname = null;
     _basenick = null;
 
diff --git a/src/userTracker.js b/src/userTracker.js
index 1c0ecc69..196cb3b7 100644
--- a/src/userTracker.js
+++ b/src/userTracker.js
@@ -62,8 +62,9 @@ export default class UserStatusMonitor {
 }
 
 
-const UserTracker = GObject.registerClass({
-    Signals: {
+const UserTracker = GObject.registerClass(
+class UserTracker extends GObject.Object {
+    static [GObject.signals] = {
         'status-changed': {
             flags: GObject.SignalFlags.DETAILED,
             param_types: [GObject.TYPE_STRING, GObject.TYPE_INT],
@@ -76,8 +77,8 @@ const UserTracker = GObject.registerClass({
             flags: GObject.SignalFlags.DETAILED,
             param_types: [GObject.TYPE_STRING],
         },
-    },
-}, class UserTracker extends GObject.Object {
+    };
+
     constructor(account) {
         super();
 


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