Refactor: Move GObject.registerClass calls into static init. blocks

Do that since it standardizes the code and also is just cleaner.
This commit is contained in:
June 2023-10-04 03:56:33 +02:00
commit 5ea8f4aabe
No known key found for this signature in database
GPG key ID: 094C2AC34192FA11
4 changed files with 54 additions and 46 deletions

View file

@ -9,24 +9,28 @@ import { ExtensionPreferences } from "resource:///org/gnome/Shell/Extensions/js/
import PrefsBoxOrderItemRow from "./PrefsBoxOrderItemRow.js";
import PrefsBoxOrderListEmptyPlaceholder from "./PrefsBoxOrderListEmptyPlaceholder.js";
const PrefsBoxOrderListBox = GObject.registerClass({
GTypeName: "PrefsBoxOrderListBox",
Template: GLib.uri_resolve_relative(import.meta.url, "../ui/prefs-box-order-list-box.ui", GLib.UriFlags.NONE),
Properties: {
BoxOrder: GObject.ParamSpec.string(
"box-order",
"Box Order",
"The box order this PrefsBoxOrderListBox is associated with.",
GObject.ParamFlags.READWRITE,
""
)
},
Signals: {
"row-move": {
param_types: [PrefsBoxOrderItemRow, GObject.TYPE_STRING]
}
export default class PrefsBoxOrderListBox extends Gtk.ListBox {
static {
GObject.registerClass({
GTypeName: "PrefsBoxOrderListBox",
Template: GLib.uri_resolve_relative(import.meta.url, "../ui/prefs-box-order-list-box.ui", GLib.UriFlags.NONE),
Properties: {
BoxOrder: GObject.ParamSpec.string(
"box-order",
"Box Order",
"The box order this PrefsBoxOrderListBox is associated with.",
GObject.ParamFlags.READWRITE,
""
)
},
Signals: {
"row-move": {
param_types: [PrefsBoxOrderItemRow, GObject.TYPE_STRING]
}
}
}, this);
}
}, class PrefsBoxOrderListBox extends Gtk.ListBox {
#settings;
#rowSignalHandlerIds = new Map();
@ -143,6 +147,4 @@ const PrefsBoxOrderListBox = GObject.registerClass({
}
}
}
});
export default PrefsBoxOrderListBox;
}