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

Add class ensuring for WidgetTemplate #75

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

GeopJr
Copy link
Contributor

@GeopJr GeopJr commented Dec 21, 2024

Someone raised an issue with custom widgets and builder files, GeopJr/ultimate-gtk4-crystal-guide#9 (comment)

The issue is that we need to ensure that the class exists for GTK to bind them. I see gtk-rs does it on template_child, but in that issue's case, the user does not use template_child. This PR adds the following to WidgetTemplate:

@[Gtk::UiTemplate(resource: "/dev/ui/main.ui", ensure_classes: {MyButton})]

and calls LibGObject.g_type_ensure on every ensure_classes child

@hugopl hugopl merged commit f8e6c8f into hugopl:main Dec 23, 2024
1 check passed
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