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

Use connect instead of on #4

Open
vixalien opened this issue Dec 8, 2023 · 6 comments · May be fixed by #31
Open

Use connect instead of on #4

vixalien opened this issue Dec 8, 2023 · 6 comments · May be fixed by #31

Comments

@vixalien
Copy link
Contributor

vixalien commented Dec 8, 2023

Hello. Very lovely project!

I think it would be better if the project recommended the use of connect and disconnect instead of the archaic node-style on and off. This would make it more consistent with GObject signals and how they are handled in GJS.

@ahgilak
Copy link
Owner

ahgilak commented Dec 16, 2023

I added disconnect method so both styles are supported now, but I'm not sure if GJS style would be preferred way, since naming conversions are derived from node-gtk.

@vixalien
Copy link
Contributor Author

Thanks. I see.

I come from GJS so I am quite familiar to it's style.

Maybe you can consider about using the GJS style instead, as it is already quite similar to how other bindings work and there is no need to learn new patterns for people already familiar with Gtk.

The first concern is the use of on and off for signals, which reminds me of the old node EventEmitter which is really not found anywhere. As I mentioned connect and disconnect will feel more familiar to other Gtk users. And it's nice to have a consistent style.

Secondly, I wonder why properties and methods are in camelCase instead of snake_case, which is also more familiar in Gtk (eg gtk_widget_init_template)

@vixalien
Copy link
Contributor Author

Hello! If I create a PR implementing this change, would you merge it?

@ahgilak
Copy link
Owner

ahgilak commented Feb 1, 2024

Hello. Yes.
Since we're now using vfunc_ before virtual functions, it's kinda mix of node and gjs styles.
I agree with completely switching to gjs style (signals, name conversions and everything else)

@ahgilak
Copy link
Owner

ahgilak commented Feb 1, 2024

Also It's good to keep on, once and off methods as alternatives.
Just replace them in the examples.

@ahgilak
Copy link
Owner

ahgilak commented Feb 1, 2024

thank you in advance

@vixalien vixalien linked a pull request May 27, 2024 that will close this issue
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 a pull request may close this issue.

2 participants