refactor: improve capsulation and safety of tui module public api

This commit is contained in:
CJ van den Berg 2025-01-23 16:45:04 +01:00
parent 4145460012
commit 1d947ab499
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
28 changed files with 239 additions and 198 deletions

View file

@ -34,7 +34,7 @@ pub fn create(allocator: std.mem.Allocator, parent: Plane, event_handler: ?Event
.on_event = event_handler,
};
logview.init(allocator);
try tui.current().message_filters.add(MessageFilter.bind(self, receive_log));
try tui.message_filters().add(MessageFilter.bind(self, receive_log));
try log.subscribe();
return Widget.to(self);
}
@ -47,7 +47,7 @@ pub fn deinit(self: *Self, allocator: std.mem.Allocator) void {
}
self.msg.deinit();
log.unsubscribe() catch {};
tui.current().message_filters.remove_ptr(self);
tui.message_filters().remove_ptr(self);
self.plane.deinit();
allocator.destroy(self);
}