-
Notifications
You must be signed in to change notification settings - Fork 2
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
Support GObject.registerClass
#22
Draft
vixalien
wants to merge
7
commits into
ahgilak:main
Choose a base branch
from
vixalien:object-register-class
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
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
fix #20 |
c80bcc1
to
2268e83
Compare
df42873
to
c146f1e
Compare
c146f1e
to
3a9f895
Compare
3a9f895
to
c6847a9
Compare
This is currently in a working stage I'd say. More tests are required though, and some features are not yet implemented. These include:
And possibly more. For reference, these were the main sources of implementation: |
This runs JS constructors on objects that were not constructed from JavaScript. These are effectively objects constructed from GtkBuilder. This is done by tracking all objects currently being constructed in a variable named `ConstructContext`. If an object's `TypeInfo`'s `instance_init` method (see https://docs.gtk.org/gobject/struct.TypeInfo.html) while it's gType is not the currently being constructed type (i.e. the last element of `ConstructContext`), it is assumed that the object is being constructed from GtkBuilder and the object's constructor is called, but instead of creating a new `GObject`, the constructed object's `gi:ref` (pointer) is passed instead, and the javascript "construction" continues.
fixes cases like `error instanceof GLib.UriError`
A very good example is `GFile` as returned by `Gio.File.new_for_uri` which is an interface. However, since it's also an object, the unbox function will incorrectly set it to `GObject`.
I'm very sorry for this huge commit. It turns out I was working in an entirely different repo while I was waiting for other necessary PRs to get merged, and hence all the history was lost.
6a01679
to
bbc5af6
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Warning
The current code is incomplete and won't run; it is awaiting merge from other dependency pull requests. I'll push all the code after the required branches have been merged (so I can test against the
main
branch)This PR will include code that will allow the use of
GObject.registerClass
in a fashion similar to what GJS already does.GObject.registerClass
allows the following:GTypeFlags
.GParamSpec
sobj.connect("signal_name")
It also allows higher integration with
GtkWidget
:GtkWidget.set_css_name
.Things to do in the future possibly:
#
syntax. I am not sure if it's typescript-friendlyfix #20