1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-18 07:11:04 +02:00

refactor: recv_glib dependency arrays

Adds a dependency array system to `recv_glib` which internally clones the passed deps and then passes by reference to the callback.

This cleans up a lot of the big `{}` blocks full of `widget.clone()` and removes a lot of boilerplate. Yay!
This commit is contained in:
Jake Stanger 2025-05-26 22:17:26 +01:00
parent beab26a37e
commit 9d18ce52f5
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
31 changed files with 539 additions and 517 deletions

View file

@ -388,8 +388,7 @@ impl ModuleFactory for BarModuleFactory {
) where
TSend: Debug + Clone + Send + 'static,
{
let popup = self.popup.clone();
rx.recv_glib(move |ev| match ev {
rx.recv_glib(&self.popup, move |popup, ev| match ev {
ModuleUpdateEvent::Update(update) => {
tx.send_expect(update);
}
@ -464,10 +463,9 @@ impl ModuleFactory for PopupModuleFactory {
) where
TSend: Debug + Clone + Send + 'static,
{
let popup = self.popup.clone();
let button_id = self.button_id;
rx.recv_glib(move |ev| match ev {
rx.recv_glib(&self.popup, move |popup, ev| match ev {
ModuleUpdateEvent::Update(update) => {
tx.send_expect(update);
}