Skip to content

Commit

Permalink
Merge pull request #184 from gjsify/fix/missing-fields
Browse files Browse the repository at this point in the history
 Preparations for GNOME Shell 46 and 47
  • Loading branch information
JumpLink authored Jul 22, 2024
2 parents 5b037c7 + 5cf7760 commit 8b3ec80
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 25 deletions.
20 changes: 9 additions & 11 deletions packages/generator-typescript/src/module-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ export class ModuleGenerator extends FormatGenerator<string[]> {
girClass,
girClass.fields.filter((field) => field.isStatic),
),
`Static fields of ${girClass.namespace.namespace}.${girClass.name}`,
`Static fields`,
indentCount,
),
)
Expand All @@ -977,7 +977,7 @@ export class ModuleGenerator extends FormatGenerator<string[]> {
girClass,
girClass.fields.filter((field) => !field.isStatic),
),
`Own fields of ${girClass.namespace.namespace}.${girClass.name}`,
`Fields`,
indentCount,
),
)
Expand All @@ -1002,7 +1002,7 @@ export class ModuleGenerator extends FormatGenerator<string[]> {
def.push(
...this.generateProperties(
filterConflicts(girClass.namespace, girClass, girClass.props),
`Own properties of ${girClass.namespace.namespace}.${girClass.name}`,
`Properties`,
indentCount,
),
)
Expand All @@ -1024,7 +1024,7 @@ export class ModuleGenerator extends FormatGenerator<string[]> {
[],
),
indentCount,
`Own static methods of ${girClass.namespace.namespace}.${girClass.name}`,
`Static methods`,
),
)

Expand All @@ -1047,7 +1047,7 @@ export class ModuleGenerator extends FormatGenerator<string[]> {
[],
),
indentCount,
`Own methods of ${girClass.namespace.namespace}.${girClass.name}`,
`Methods`,
),
)

Expand Down Expand Up @@ -1088,9 +1088,7 @@ export class ModuleGenerator extends FormatGenerator<string[]> {
)

if (def.length) {
def.unshift(
...this.addInfoComment(`Constructors of ${girClass.namespace.namespace}.${girClass.name}`, indentCount),
)
def.unshift(...this.addInfoComment(`Constructors`, indentCount))
}

return def
Expand All @@ -1115,7 +1113,7 @@ export class ModuleGenerator extends FormatGenerator<string[]> {
[],
),
indentCount,
`Own virtual methods of ${girClass.namespace.namespace}.${girClass.name}`,
`Virtual methods`,
),
)

Expand Down Expand Up @@ -1253,7 +1251,7 @@ export class ModuleGenerator extends FormatGenerator<string[]> {

const signalDescs = this.generateSignals(girClass)

def.push(...this.mergeDescs(signalDescs, `Own signals of ${girClass.namespace.namespace}.${girClass.name}`, 1))
def.push(...this.mergeDescs(signalDescs, `Signals`, 1))

return def
}
Expand Down Expand Up @@ -1443,7 +1441,7 @@ export class ModuleGenerator extends FormatGenerator<string[]> {
// Static Properties
def.push(...this.generateClassProperties(girClass))

// Static Fields
// Static and member Fields
def.push(...this.generateClassFields(girClass))

// Constructors
Expand Down
2 changes: 2 additions & 0 deletions packages/lib/src/generics/clutter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ export const clutter10 = clutterTemplate("10");
export const clutter11 = clutterTemplate("11");
export const clutter12 = clutterTemplate("12");
export const clutter13 = clutterTemplate("13");
export const clutter14 = clutterTemplate("14");
export const clutter15 = clutterTemplate("15");
12 changes: 9 additions & 3 deletions packages/lib/src/generics/generify.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import gio from "./gio.js";
import glib from "./glib.js";
import { clutter10, clutter11, clutter12, clutter13 } from "./clutter.js";
import { st1, st12, st13 } from "./st.js";
import { meta10, meta11, meta12, meta13 } from "./meta.js";
import { clutter10, clutter11, clutter12, clutter13, clutter14, clutter15 } from "./clutter.js";
import { st1, st12, st13, st14, st15 } from "./st.js";
import { meta10, meta11, meta12, meta13, meta14, meta15 } from "./meta.js";

import { IntrospectedNamespace } from "../gir/namespace.js";
import { NSRegistry } from "../gir/registry.js";
Expand Down Expand Up @@ -38,13 +38,19 @@ export function generify(registry: NSRegistry, inferGenerics: boolean) {
$_(clutter11);
$_(clutter12);
$_(clutter13);
$_(clutter14);
$_(clutter15);
$_(st1);
$_(st12);
$_(st13);
$_(st14);
$_(st15);
$_(meta10);
$_(meta11);
$_(meta12);
$_(meta13);
$_(meta14);
$_(meta15);

const visitor = new GenericVisitor(registry, inferGenerics);

Expand Down
2 changes: 2 additions & 0 deletions packages/lib/src/generics/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ export const meta10 = metaTemplate("10");
export const meta11 = metaTemplate("11");
export const meta12 = metaTemplate("12");
export const meta13 = metaTemplate("13");
export const meta14 = metaTemplate("14");
export const meta15 = metaTemplate("15");
25 changes: 15 additions & 10 deletions packages/lib/src/generics/st.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const stTemplate = (version: string) => ({

const Actor = Clutter.assertClass("Actor");
const Content = Clutter.assertClass("Content");
const Container = Clutter.assertClass("Container");
// Container was removed in Clutter-14
const Container = Number(version) < 14 ? Clutter.assertClass("Container") : null;
const LayoutManager = Clutter.assertClass("LayoutManager");
const ClutterBoxLayout = Clutter.assertClass("BoxLayout");

Expand Down Expand Up @@ -50,16 +51,18 @@ const stTemplate = (version: string) => ({
constraint: Content.getType()
});

Container.addGeneric({
default: Actor.getType(),
constraint: Actor.getType()
});
if (Container) {
Container.addGeneric({
default: Actor.getType(),
constraint: Actor.getType()
});

StBoxLayout.addGeneric({
deriveFrom: Container.getType(),
default: Actor.getType(),
constraint: Actor.getType()
});
StBoxLayout.addGeneric({
deriveFrom: Container.getType(),
default: Actor.getType(),
constraint: Actor.getType()
});
}

if (StBoxLayout.superType) {
StBoxLayout.superType = new GenerifiedTypeIdentifier(
Expand Down Expand Up @@ -114,3 +117,5 @@ const stTemplate = (version: string) => ({
export const st1 = stTemplate("1.0");
export const st12 = stTemplate("12");
export const st13 = stTemplate("13");
export const st14 = stTemplate("14");
export const st15 = stTemplate("15");
2 changes: 1 addition & 1 deletion packages/lib/src/gir-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ export class GirModule {
const clazz = this.getClass(name)

if (!clazz) {
throw new Error(`Class ${name} does not exist in namespace ${this.namespace}.`)
throw new Error(`[${this.packageName}] Class ${name} does not exist in namespace ${this.namespace}.`)
}

return clazz
Expand Down

0 comments on commit 8b3ec80

Please sign in to comment.