Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

WIP: Refactor Value and Property handling #31

Closed
wants to merge 1 commit into from

Conversation

sdroege
Copy link
Member

@sdroege sdroege commented Nov 8, 2020

@sdroege
Copy link
Member Author

sdroege commented Nov 24, 2020

For signals we can probably have some associated trait function that passes in some kind of "signal creation context" plus a builder-style API on it for making it easier to create signals. I'll experiment with that too.

@sdroege
Copy link
Member Author

sdroege commented Nov 30, 2020

Initial WIP version of the Value traits refactoring is here now. Needs all the impls to be updated and to be confirmed that it actually works correctly everywhere.

Some feedback on the traits would be useful already.

@sdroege
Copy link
Member Author

sdroege commented Nov 30, 2020

Some feedback on the traits [in the last WIP commit] would be useful already.

@fengalin maybe from you? :)

@fengalin
Copy link
Contributor

I'll take a look later today (afk atm). It seems like a neat improvement indeed.

@sdroege
Copy link
Member Author

sdroege commented Nov 30, 2020

I'll take a look later today (afk atm). It seems like a neat improvement indeed.

Thanks, no need to hurry :) The goal is basically to have a direct mapping between types, param specs and the Value API. Based on that we can derive subclass property handling code (the pspecs and getters/setters just based on the type), signal handler code (automatic Value <-> Rust type conversion for the parameters) and other nice things that are currently not possible.

@sdroege sdroege force-pushed the value-property-refactoring branch 2 times, most recently from 76f00f2 to fc00c0b Compare November 30, 2020 19:15
@sdroege
Copy link
Member Author

sdroege commented Nov 30, 2020

src/value.rs should be finished now except for the TODO comments (implementing ownership transferring TryFrom<Value> for T and From<T> for Value).

Overall there is more code to implement per type now for working with Values, but at least the majority of the cases for this are going to be covered by the glib_wrapper! macro (objects, boxed, shared) and gir (src/auto/flags.rs and src/auto/enums.rs). Nonetheless, if someone has an idea how to simplify it, please let me know.

Copy link
Contributor

@fengalin fengalin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only looked rapidly so far. Will take a deeper dive tomorrow hopefully.

glib/src/value.rs Outdated Show resolved Hide resolved
glib/src/value.rs Show resolved Hide resolved
glib/src/value.rs Outdated Show resolved Hide resolved
glib/src/value.rs Outdated Show resolved Hide resolved
@sdroege
Copy link
Member Author

sdroege commented Dec 11, 2020

Ok, no further comments here so I proceed :)

@sdroege sdroege force-pushed the value-property-refactoring branch 4 times, most recently from e4cd478 to 792cd70 Compare December 13, 2020 17:03
@sdroege
Copy link
Member Author

sdroege commented Dec 13, 2020

Ok, next step is to update gir and then the other crates and then get all tests pass 😴

@sdroege
Copy link
Member Author

sdroege commented Jan 5, 2021

I wonder if I should split this PR so that part of it can already get in and doesn't bitrot while I need more time to finish the other parts.

The changes to the property handling can go in already and are useful and nice separately too. @bilelmoussaoui @GuillaumeGomez opinions?

@sdroege sdroege mentioned this pull request Jan 21, 2021
1 task
elmarco pushed a commit to elmarco/gtk-rs that referenced this pull request Feb 10, 2021
@sdroege sdroege added this to the 0.14.0 milestone Mar 30, 2021
@sdroege
Copy link
Member Author

sdroege commented Apr 12, 2021

I'm working currently on finishing this btw. The next PR is going to have the refactored traits but none of the new pspec-related traits yet (I think we'll want to keep them for the release afterwards).

@sdroege
Copy link
Member Author

sdroege commented Apr 14, 2021

I have glib compiling again, and gio and cairo and pango and pangocairo. gdk/gtk need some updates still, and atk is a bit annoying because it has an enum called ValueType which conflicts with the same-named trait from glib :)

@sdroege
Copy link
Member Author

sdroege commented Apr 15, 2021

Current WIP is at #454

@sdroege sdroege marked this pull request as ready for review April 18, 2021 09:41
@sdroege sdroege marked this pull request as draft April 18, 2021 09:42
@sdroege
Copy link
Member Author

sdroege commented Apr 28, 2021

Let's close this one for now.

@sdroege sdroege closed this Apr 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve glib::Value usage by merging FromValue/FromValueOptional traits
3 participants