Skip to content

Commit

Permalink
Fix js override for registerClass signature with a single argument
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnyp committed Oct 17, 2024
1 parent 5415728 commit 6c17350
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,23 @@ export function overrides() {
// https://gitlab.gnome.org/GNOME/glib/-/issues/2336
// https://gitlab.gnome.org/GNOME/glib/-/issues/667
GObject.registerClass = function registerWorkbenchClass(...args) {
const klass = args[0];
const GTypeName = klass.GTypeName || args[1]?.name;
let attrs;
let klass;

if (args.length === 1) {
attrs = {};
klass = args[0];
} else {
attrs = args[0];
klass = args[1];
}

const GTypeName = attrs.GTypeName || klass.name;
if (GTypeName) {
types[GTypeName] = increment(GTypeName);
klass.GTypeName = GTypeName + types[GTypeName];
attrs.GTypeName = GTypeName + types[GTypeName];
}
return registerClass(...args);
return registerClass(attrs, klass);
};
// This is used to tweak `workbench.template` in order to set the
// <template class="?"/> to something that will work next time
Expand Down

0 comments on commit 6c17350

Please sign in to comment.