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

Glade: Add connect object feature to the builder signal connection #129

Open
DBLouis opened this issue May 7, 2020 · 3 comments
Open

Glade: Add connect object feature to the builder signal connection #129

DBLouis opened this issue May 7, 2020 · 3 comments
Labels
enhancement New feature or request gtk

Comments

@DBLouis
Copy link

DBLouis commented May 7, 2020

Is passing user data to a signal handler supported? I load and XML generated by Glade and it panics here: https://github.com/gtk-rs/gtk/blob/master/src/builder.rs#L81. I am not sure if this failed assert means that I messed up somehow or if this is not supported.

@sdroege
Copy link
Member

sdroege commented May 7, 2020

Can you provide a complete code example that reproduces the problem? The connect object feature is not currently supported, but that also shouldn't usually be needed.

@DBLouis
Copy link
Author

DBLouis commented May 8, 2020

If you use the example repo, take the builder_signal program and add an object attribute to the button. It will panic with the same error.

I new to GTK, basically I wanted to have one function that called show() on any widget and pass the name of the widget via the userdata. But maybe that is not possible.

@sdroege
Copy link
Member

sdroege commented May 8, 2020

You will have to pass any context into the signal handler when creating the closures in there. I can't remember the details about the connect object feature, but if I remember correctly it was difficult/impossible to implement that safely.

@GuillaumeGomez GuillaumeGomez changed the title Glade: Passing user data to signal handler Glade: Add connect object feature to the builder signal connection May 8, 2020
@bilelmoussaoui bilelmoussaoui transferred this issue from gtk-rs/gtk Nov 10, 2020
@sdroege sdroege added the enhancement New feature or request label Nov 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request gtk
Projects
None yet
Development

No branches or pull requests

3 participants