Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose instance parameters of class methods #31

Merged
merged 6 commits into from
Dec 13, 2020

Conversation

realh
Copy link
Contributor

@realh realh commented Oct 17, 2020

Class methods have an instance parameter which needs to be exposed. Gjs accepts a GType, an object instance or a constructor for these.

@realh
Copy link
Contributor Author

realh commented Oct 17, 2020

Oops, only the last commit should belong to this PR, the others are for #30.

Copy link
Collaborator

@JumpLink JumpLink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also tested locally and also looks good.
Here is an example how the class "ContainerClass" in @types/Gjs/Gtk-3.0.d.ts looks like with these changes:

export abstract class ContainerClass {
    /* Fields of Gtk.ContainerClass */
    parent_class: WidgetClass
    add: (container: Container, widget: Widget) => void
    remove: (container: Container, widget: Widget) => void
    check_resize: (container: Container) => void
    forall: (container: Container, include_internals: boolean, callback: Callback) => void
    set_focus_child: (container: Container, child?: Widget | null) => void
    child_type: (container: Container) => GObject.Type
    composite_name: (container: Container, child: Widget) => string
    set_child_property: (container: Container, child: Widget, property_id: number, value: any, pspec: GObject.ParamSpec) => void
    get_child_property: (container: Container, child: Widget, property_id: number, value: any, pspec: GObject.ParamSpec) => void
    get_path_for_child: (container: Container, child: Widget) => WidgetPath
    /* Methods of Gtk.ContainerClass */
    find_child_property(cclass: Container | Function | GObject.Type, property_name: string): GObject.ParamSpec | null
    handle_border_width(klass: Container | Function | GObject.Type): void
    install_child_properties(cclass: Container | Function | GObject.Type, pspecs: GObject.ParamSpec[]): void
    install_child_property(cclass: Container | Function | GObject.Type, property_id: number, pspec: GObject.ParamSpec): void
    list_child_properties(cclass: Container | Function | GObject.Type): GObject.ParamSpec[]
    static name: string
}

@sammydre sammydre merged commit 4a8a1bf into gjsify:master Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants