App is turning into callback hell #1794
Replies: 1 comment
-
Generally you'll probably get more replies on https://discourse.gnome.org (Note: I'm not a GTK developer) One way around that is to make use of subclassing because that way you would implement trait methods for most things where you get your "context" (your subclass with its state) passed in already, or go via template callbacks which also give you your subclass directly. No cloning etc needed in those cases. For the other cases this also still helps because instead of putting your state into And if all else fails, instead of passing 17 different I'd recommend taking a look at some of the existing Rust GTK4 apps, especially the ones on GNOME gitlab. |
Beta Was this translation helpful? Give feedback.
-
I need to pass state into callbacks when a button is clicked. I am finding my GTK4 app isn't scaling well due to the sheer number of Rc's that are being passed around and cloned. It feels like GTK4-RS is very callback driven, which takes a lot of work. Does anyone have advice for designing simpler GTK4-RS apps without callback architecture?
Beta Was this translation helpful? Give feedback.
All reactions