This repository has been archived by the owner on Jun 8, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 62
Migrate subclassing infrastructure to glib-rs #392
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
And fill it in by default with () in the macro to prevent existing code from failing to compile.
And keep the existing ones on ObjectExt as wrappers around ObjectClass
The object is destroyed already at that time
It is potentially unsafe as the object is not fully initialized yet and especially does not have its private struct created yet (we just do exactly that here!). It's better to use Object::constructed() for any initialization.
And add a test for properties
That way the users of the API don't have to cast.
…al method is actually called
EPashkin
suggested changes
Nov 19, 2018
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.
Great work
Global comments while I'm reviewing: can you add punctuation on your (doc) comments please? A lot of them are missing a dot at the end. |
Could you also add a section into the |
Thanks! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For an example see the unit test in
src/subclass/object.rs
at the bottom: https://github.com/sdroege/glib-rs/blob/3eee4c7da6e6947efa4c1970d7d36e17cbfca577/src/subclass/object.rs#L288-L379 . Another example can be found here gtk-rs/examples#205 (https://github.com/gtk-rs/examples/blob/4cf46ec7a6409b92ed726eaec74d4d983c84e386/src/bin/listbox_model.rs#L251-L401)This is a complete rewrite of
gobject-subclass
to be more flexible, lightweight, simple and to be usable with gnome-class too.I have a WIP port of
gst-plugin-rs
for this (need to migrate all the code to the bindings first) and it all works well.I also have a minimal change to gir (gtk-rs/gir#669) to add the Rust class type to the
glib_wrapper!
macro, which should be merged first. And then gtk-rs/gir#604 can be updated to actually generate quite a bit of the boilerplate code.This is now part of the proper bindings instead of an external crate because otherwise the API can't be made as nice as it is now due to not being able to implement traits for types defined in other crates, and generally more traits for marking all the relationships are needed.