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.
|
* what is really useable by the other extension code.
|
||||||
* It's basically a heavy wrapper around the box orders stored in the settings.
|
* 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 {
|
||||||
Signals: {
|
static {
|
||||||
"appIndicatorReady": {}
|
GObject.registerClass({
|
||||||
|
Signals: {
|
||||||
|
"appIndicatorReady": {}
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
}
|
}
|
||||||
}, class BoxOrderManager extends GObject.Object {
|
|
||||||
#appIndicatorReadyHandlerIdMap;
|
#appIndicatorReadyHandlerIdMap;
|
||||||
#appIndicatorItemApplicationRoleMap;
|
#appIndicatorItemApplicationRoleMap;
|
||||||
#settings;
|
#settings;
|
||||||
@ -267,6 +271,4 @@ const BoxOrderManager = GObject.registerClass({
|
|||||||
saveBoxOrderToSettings(boxOrders.center, "center");
|
saveBoxOrderToSettings(boxOrders.center, "center");
|
||||||
saveBoxOrderToSettings(boxOrders.right, "right");
|
saveBoxOrderToSettings(boxOrders.right, "right");
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
export default BoxOrderManager;
|
|
||||||
|
|||||||
@ -9,24 +9,28 @@ import { ExtensionPreferences } from "resource:///org/gnome/Shell/Extensions/js/
|
|||||||
import PrefsBoxOrderItemRow from "./PrefsBoxOrderItemRow.js";
|
import PrefsBoxOrderItemRow from "./PrefsBoxOrderItemRow.js";
|
||||||
import PrefsBoxOrderListEmptyPlaceholder from "./PrefsBoxOrderListEmptyPlaceholder.js";
|
import PrefsBoxOrderListEmptyPlaceholder from "./PrefsBoxOrderListEmptyPlaceholder.js";
|
||||||
|
|
||||||
const PrefsBoxOrderListBox = GObject.registerClass({
|
export default class PrefsBoxOrderListBox extends Gtk.ListBox {
|
||||||
GTypeName: "PrefsBoxOrderListBox",
|
static {
|
||||||
Template: GLib.uri_resolve_relative(import.meta.url, "../ui/prefs-box-order-list-box.ui", GLib.UriFlags.NONE),
|
GObject.registerClass({
|
||||||
Properties: {
|
GTypeName: "PrefsBoxOrderListBox",
|
||||||
BoxOrder: GObject.ParamSpec.string(
|
Template: GLib.uri_resolve_relative(import.meta.url, "../ui/prefs-box-order-list-box.ui", GLib.UriFlags.NONE),
|
||||||
"box-order",
|
Properties: {
|
||||||
"Box Order",
|
BoxOrder: GObject.ParamSpec.string(
|
||||||
"The box order this PrefsBoxOrderListBox is associated with.",
|
"box-order",
|
||||||
GObject.ParamFlags.READWRITE,
|
"Box Order",
|
||||||
""
|
"The box order this PrefsBoxOrderListBox is associated with.",
|
||||||
)
|
GObject.ParamFlags.READWRITE,
|
||||||
},
|
""
|
||||||
Signals: {
|
)
|
||||||
"row-move": {
|
},
|
||||||
param_types: [PrefsBoxOrderItemRow, GObject.TYPE_STRING]
|
Signals: {
|
||||||
}
|
"row-move": {
|
||||||
|
param_types: [PrefsBoxOrderItemRow, GObject.TYPE_STRING]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
}
|
}
|
||||||
}, class PrefsBoxOrderListBox extends Gtk.ListBox {
|
|
||||||
#settings;
|
#settings;
|
||||||
#rowSignalHandlerIds = new Map();
|
#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 GObject from "gi://GObject";
|
||||||
import GLib from "gi://GLib";
|
import GLib from "gi://GLib";
|
||||||
|
|
||||||
const PrefsBoxOrderListEmptyPlaceholder = GObject.registerClass({
|
export default class PrefsBoxOrderListEmptyPlaceholder extends Gtk.Box {
|
||||||
GTypeName: "PrefsBoxOrderListEmptyPlaceholder",
|
static {
|
||||||
Template: GLib.uri_resolve_relative(import.meta.url, "../ui/prefs-box-order-list-empty-placeholder.ui", GLib.UriFlags.NONE)
|
GObject.registerClass({
|
||||||
}, class PrefsBoxOrderListEmptyPlaceholder extends Gtk.Box {
|
GTypeName: "PrefsBoxOrderListEmptyPlaceholder",
|
||||||
|
Template: GLib.uri_resolve_relative(import.meta.url, "../ui/prefs-box-order-list-empty-placeholder.ui", GLib.UriFlags.NONE)
|
||||||
|
}, this);
|
||||||
|
}
|
||||||
|
|
||||||
// Handle a new drop on `this` properly.
|
// Handle a new drop on `this` properly.
|
||||||
// `value` is the thing getting dropped.
|
// `value` is the thing getting dropped.
|
||||||
onDrop(_target, value, _x, _y) {
|
onDrop(_target, value, _x, _y) {
|
||||||
@ -28,6 +32,4 @@ const PrefsBoxOrderListEmptyPlaceholder = GObject.registerClass({
|
|||||||
valueListBox.saveBoxOrderToSettings();
|
valueListBox.saveBoxOrderToSettings();
|
||||||
valueListBox.determineRowMoveActionEnable();
|
valueListBox.determineRowMoveActionEnable();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
export default PrefsBoxOrderListEmptyPlaceholder;
|
|
||||||
|
|||||||
@ -11,15 +11,19 @@ import PrefsBoxOrderListEmptyPlaceholder from "./PrefsBoxOrderListEmptyPlacehold
|
|||||||
// Imports to make UI file work.
|
// Imports to make UI file work.
|
||||||
import PrefsBoxOrderListBox from "./PrefsBoxOrderListBox.js";
|
import PrefsBoxOrderListBox from "./PrefsBoxOrderListBox.js";
|
||||||
|
|
||||||
const PrefsPage = GObject.registerClass({
|
export default class PrefsPage extends Adw.PreferencesPage {
|
||||||
GTypeName: "PrefsPage",
|
static {
|
||||||
Template: GLib.uri_resolve_relative(import.meta.url, "../ui/prefs-page.ui", GLib.UriFlags.NONE),
|
GObject.registerClass({
|
||||||
InternalChildren: [
|
GTypeName: "PrefsPage",
|
||||||
"left-box-order-list-box",
|
Template: GLib.uri_resolve_relative(import.meta.url, "../ui/prefs-page.ui", GLib.UriFlags.NONE),
|
||||||
"center-box-order-list-box",
|
InternalChildren: [
|
||||||
"right-box-order-list-box"
|
"left-box-order-list-box",
|
||||||
]
|
"center-box-order-list-box",
|
||||||
}, class PrefsPage extends Adw.PreferencesPage {
|
"right-box-order-list-box"
|
||||||
|
]
|
||||||
|
}, this);
|
||||||
|
}
|
||||||
|
|
||||||
constructor(params = {}) {
|
constructor(params = {}) {
|
||||||
super(params);
|
super(params);
|
||||||
|
|
||||||
@ -172,6 +176,4 @@ const PrefsPage = GObject.registerClass({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
export default PrefsPage;
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user