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

Added vala example with constructor that does not work #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Added vala example with constructor that does not work #27

wants to merge 1 commit into from

Conversation

JumpLink
Copy link

@JumpLink JumpLink commented Aug 3, 2012

This example is forked from https://github.com/antono/vala-object
I've add an constructor to demonstrate that the constructor does not work.

@JumpLink
Copy link
Author

JumpLink commented Aug 3, 2012

I've tested the example with Gjs and Seed and there it does not work, too. So It seems like it is not a problem coming from node-gir.

Is this a design decision for gir on Javascript or is the problem the generated .gir file?

@antono
Copy link
Contributor

antono commented Aug 5, 2012

Hey, try GObject style constructor in vala. they worked for me:

https://live.gnome.org/Vala/Tutorial#GObject-Style_Construction

public class Person : Object {

    /* Construction properties */
    public string name { get; construct; }
    public int age { get; construct set; }

    public Person(string name) {
        Object(name: name);
    }

    public Person.with_age(string name, int years) {
        Object(name: name, age: years);
    }

    construct {
        // do anything else
        stdout.printf("Welcome %s\n", this.name);
    }
}

@JumpLink
Copy link
Author

JumpLink commented Aug 5, 2012

juergbi says me that some gir bindings support vala-instantiation using _new functions by treating them like a static function. For example in ruby-gir-ffi it works, I think. So it would be cool If node-gir would also be able to. The information should all be in the vala-generated .gir.

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.

2 participants