-
-
Notifications
You must be signed in to change notification settings - Fork 182
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
gtk4: Add convenience traits for binding template callbacks to classes #945
gtk4: Add convenience traits for binding template callbacks to classes #945
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good to me otherwise
Looks good to me, I was wondering if we could have some trait that is defined in glib that would roughly looks like this
and modify the |
IMO it's not a good idea to do that without having template specialization, there are too many other things to do in |
What I meant is to have something like the subclassing code where you have a trait with the default implementations and a trait for modifying that default behaviour. In some cases you don't even need to chain-up (like the dispose in ObjectImpl because it is automatically done for you). So something along that could work I guess while still allowing you to override class_init and do whatever other things you need to do. Except the bind_template/init_template will no longer be necessary because they are the default implementations (that would be generated with the CompositeTemplate macro). Note that is roughly an idea and it probably can't work for some technical reason I didn't thought of :) |
It can't work because subclasses always have to implement impl ObjectSubclassImpl for MyWidget {} Or something like that, to use the default impl there |
Indeed, completely forgot about that part. Maybe we could have some widget! macro in the future :) |
2f35ce3
to
5fafe1b
Compare
Finishes out the last part of #77
The old way of
Self::bind_template(klass)
still works, this PR shouldn't break any existing code