mirror of
https://gitlab.gnome.org/julianschacher/top-bar-organizer.git
synced 2025-10-27 15:19:09 +00:00
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:
parent
a77c6d2f2b
commit
5ea8f4aabe
@ -10,11 +10,15 @@ import * as Main from "resource:///org/gnome/shell/ui/main.js";
|
||||
* what is really useable by the other extension code.
|
||||
* It's basically a heavy wrapper around the box orders stored in the settings.
|
||||
*/
|
||||
const BoxOrderManager = GObject.registerClass({
|
||||
export default class BoxOrderManager extends GObject.Object {
|
||||
static {
|
||||
GObject.registerClass({
|
||||
Signals: {
|
||||
"appIndicatorReady": {}
|
||||
}
|
||||
}, class BoxOrderManager extends GObject.Object {
|
||||
}, this);
|
||||
}
|
||||
|
||||
#appIndicatorReadyHandlerIdMap;
|
||||
#appIndicatorItemApplicationRoleMap;
|
||||
#settings;
|
||||
@ -267,6 +271,4 @@ const BoxOrderManager = GObject.registerClass({
|
||||
saveBoxOrderToSettings(boxOrders.center, "center");
|
||||
saveBoxOrderToSettings(boxOrders.right, "right");
|
||||
}
|
||||
});
|
||||
|
||||
export default BoxOrderManager;
|
||||
}
|
||||
|
||||
@ -9,7 +9,9 @@ import { ExtensionPreferences } from "resource:///org/gnome/Shell/Extensions/js/
|
||||
import PrefsBoxOrderItemRow from "./PrefsBoxOrderItemRow.js";
|
||||
import PrefsBoxOrderListEmptyPlaceholder from "./PrefsBoxOrderListEmptyPlaceholder.js";
|
||||
|
||||
const PrefsBoxOrderListBox = GObject.registerClass({
|
||||
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: {
|
||||
@ -26,7 +28,9 @@ const PrefsBoxOrderListBox = GObject.registerClass({
|
||||
param_types: [PrefsBoxOrderItemRow, GObject.TYPE_STRING]
|
||||
}
|
||||
}
|
||||
}, class PrefsBoxOrderListBox extends Gtk.ListBox {
|
||||
}, this);
|
||||
}
|
||||
|
||||
#settings;
|
||||
#rowSignalHandlerIds = new Map();
|
||||
|
||||
@ -143,6 +147,4 @@ const PrefsBoxOrderListBox = GObject.registerClass({
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default PrefsBoxOrderListBox;
|
||||
}
|
||||
|
||||
@ -4,10 +4,14 @@ import Gtk from "gi://Gtk";
|
||||
import GObject from "gi://GObject";
|
||||
import GLib from "gi://GLib";
|
||||
|
||||
const PrefsBoxOrderListEmptyPlaceholder = GObject.registerClass({
|
||||
export default class PrefsBoxOrderListEmptyPlaceholder extends Gtk.Box {
|
||||
static {
|
||||
GObject.registerClass({
|
||||
GTypeName: "PrefsBoxOrderListEmptyPlaceholder",
|
||||
Template: GLib.uri_resolve_relative(import.meta.url, "../ui/prefs-box-order-list-empty-placeholder.ui", GLib.UriFlags.NONE)
|
||||
}, class PrefsBoxOrderListEmptyPlaceholder extends Gtk.Box {
|
||||
}, this);
|
||||
}
|
||||
|
||||
// Handle a new drop on `this` properly.
|
||||
// `value` is the thing getting dropped.
|
||||
onDrop(_target, value, _x, _y) {
|
||||
@ -28,6 +32,4 @@ const PrefsBoxOrderListEmptyPlaceholder = GObject.registerClass({
|
||||
valueListBox.saveBoxOrderToSettings();
|
||||
valueListBox.determineRowMoveActionEnable();
|
||||
}
|
||||
});
|
||||
|
||||
export default PrefsBoxOrderListEmptyPlaceholder;
|
||||
}
|
||||
|
||||
@ -11,7 +11,9 @@ import PrefsBoxOrderListEmptyPlaceholder from "./PrefsBoxOrderListEmptyPlacehold
|
||||
// Imports to make UI file work.
|
||||
import PrefsBoxOrderListBox from "./PrefsBoxOrderListBox.js";
|
||||
|
||||
const PrefsPage = GObject.registerClass({
|
||||
export default class PrefsPage extends Adw.PreferencesPage {
|
||||
static {
|
||||
GObject.registerClass({
|
||||
GTypeName: "PrefsPage",
|
||||
Template: GLib.uri_resolve_relative(import.meta.url, "../ui/prefs-page.ui", GLib.UriFlags.NONE),
|
||||
InternalChildren: [
|
||||
@ -19,7 +21,9 @@ const PrefsPage = GObject.registerClass({
|
||||
"center-box-order-list-box",
|
||||
"right-box-order-list-box"
|
||||
]
|
||||
}, class PrefsPage extends Adw.PreferencesPage {
|
||||
}, this);
|
||||
}
|
||||
|
||||
constructor(params = {}) {
|
||||
super(params);
|
||||
|
||||
@ -172,6 +176,4 @@ const PrefsPage = GObject.registerClass({
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default PrefsPage;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user