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

subclass/widget: Add vfuncs between child_notify and draw #864

Merged
merged 6 commits into from Aug 12, 2019

Conversation

@BrainBlasted
Copy link
Contributor

BrainBlasted commented Aug 10, 2019

Part of #862

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Aug 10, 2019

@BrainBlasted

This comment has been minimized.

Copy link
Contributor Author

BrainBlasted commented Aug 11, 2019

How do I translate a &Vec<&glib::ParamSpec> to *mut *mut GParamSpec?

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Aug 11, 2019

How do I translate a &Vec<&glib::ParamSpec> to *mut *mut GParamSpec?

to_glib_none() doesn't do that? Alternatively: vec.iter().map(|p| p.to_glib_none().0).collect::<Vec<_>>() and then as_ptr() on the result.

src/subclass/widget.rs Outdated Show resolved Hide resolved
src/subclass/widget.rs Outdated Show resolved Hide resolved
src/subclass/widget.rs Outdated Show resolved Hide resolved
@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Aug 11, 2019

Looks good to me otherwise

@BrainBlasted

This comment has been minimized.

Copy link
Contributor Author

BrainBlasted commented Aug 11, 2019

How do I translate a &Vec<&glib::ParamSpec> to *mut *mut GParamSpec?

to_glib_none() doesn't do that? Alternatively: vec.iter().map(|p| p.to_glib_none().0).collect::<Vec<_>>() and then as_ptr() on the result.

What's the right way to translate this back?

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Aug 11, 2019

What's the right way to translate this back?

You don't have to translate it back. It's an immutable array so it can't be changed anywhere along the call chain.

@BrainBlasted

This comment has been minimized.

Copy link
Contributor Author

BrainBlasted commented Aug 11, 2019

I need to translate it in order to call from the widget_dispatch_child_properties_changed trampoline

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Aug 11, 2019

I need to translate it in order to call from the widget_dispatch_child_properties_changed trampoline

Ah. FromGlibContainer::from_glib_none_num(ptr, num as usize) gives you a vector of pspecs. See glib/src/object.rs the list_properties() function for example.

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Aug 11, 2019

And install_properties() from glib/src/subclass/object.rs for the other way around

@BrainBlasted

This comment has been minimized.

Copy link
Contributor Author

BrainBlasted commented Aug 11, 2019

So ParamSpec should be owned instead of references?

@BrainBlasted

This comment has been minimized.

Copy link
Contributor Author

BrainBlasted commented Aug 11, 2019

Cleaned up everything according to suggestions.

@BrainBlasted BrainBlasted force-pushed the BrainBlasted:widget-subclassing-p2 branch from 63a18a9 to 7084b36 Aug 11, 2019
@BrainBlasted

This comment has been minimized.

Copy link
Contributor Author

BrainBlasted commented Aug 11, 2019

Rebased and formatted.

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Aug 11, 2019

So ParamSpec should be owned instead of references?

I'd say that it actually should be &[ParamSpec] instead of &Vec<ParamSpec> as that's more idiomatic Rust.

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Aug 11, 2019

Yeah looks all good apart from that, thanks :)

@BrainBlasted

This comment has been minimized.

Copy link
Contributor Author

BrainBlasted commented Aug 11, 2019

Updated to use slices.

@BrainBlasted BrainBlasted force-pushed the BrainBlasted:widget-subclassing-p2 branch from 260d93b to a35ead1 Aug 12, 2019
@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Aug 12, 2019

@GuillaumeGomez Good to go

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Aug 12, 2019

Thanks!

@GuillaumeGomez GuillaumeGomez merged commit 04ffa93 into gtk-rs:master Aug 12, 2019
0 of 2 checks passed
0 of 2 checks passed
continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build failed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.