How link/wrap a no glib struct into a gobject ? (gtk4-rs)

Hello,
I like to use gtk to build a gui for an application.
Gtk will be used to display some elements of the application and interact with them, but these elements are not gobject.
So I need gobject to do the link between widget and theses elements.

But I not found how to do this in doc, book and examples.
In the book, the closest I have found is the simple-Todo with TodoData and TodoObject. But in this case, TodoData is managed by gtk/glib, and it’s not than I want. I want use gtk ad viewer of “data” managed otherwise.

Someone can help me or indicate where I can find an example ?
Thank you

You could use BoxedAnyObject in glib - Rust to wrap your rust structs into a GObject

Thank you @bilelmoussaoui.
I started some test, now I need to understand how to to use feature like properties, bind and signal with BoxedAnyObject, or found alternative.

If you need to define your own properties or signals then you will need to implement a new GObject subclass.

You could write a GObject subclass and have the state as an inner struct that would be one of your elements. Then you could map the property/set_property functions in ObjectImpl to modify the inner state struct.

Thank’s @sdroege & @bilelmoussaoui .
I’m experiment with this. I’ll see what I can do with it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.