gtk: rename and refactor Tab.deinit

This commit is contained in:
Thorsten Ball
2023-10-28 07:34:30 +02:00
committed by Mitchell Hashimoto
parent 34e4261210
commit fde6289880
2 changed files with 4 additions and 8 deletions

View File

@ -164,13 +164,9 @@ fn gtkTabCloseClick(_: *c.GtkButton, ud: ?*anyopaque) callconv(.C) void {
window.closeTab(tab);
}
pub fn close(self: *Tab) void {
pub fn deinit(self: *Tab) void {
switch (self.child) {
.none => return,
.surface => {
// TODO: I'm not 100% but I don't think we have to do something
return;
},
.none, .surface => return,
.paned => |paned| {
paned.deinit(self.window.app.core_app.alloc);
self.window.app.core_app.alloc.destroy(paned);

View File

@ -190,7 +190,7 @@ fn initActions(self: *Window) void {
pub fn deinit(self: *Window) void {
self.icon.deinit(self.app);
for (self.tabs.items) |tab| {
tab.close();
tab.deinit();
self.app.core_app.alloc.destroy(tab);
}
self.tabs.deinit(self.app.core_app.alloc);
@ -217,7 +217,7 @@ pub fn removeTab(self: *Window, tab: *Tab) !void {
if (tab_idx) |idx| _ = self.tabs.orderedRemove(idx) else return error.TabNotFound;
// Deallocate the tab
tab.close();
tab.deinit();
self.app.core_app.alloc.destroy(tab);
}