feat: refactor
This commit is contained in:
@@ -261,14 +261,14 @@ const Model = struct {
|
|||||||
}
|
}
|
||||||
fn createItems(
|
fn createItems(
|
||||||
ctx: vxfw.DrawContext,
|
ctx: vxfw.DrawContext,
|
||||||
items1: *locked(?std.ArrayList(Arc(*models.Item))),
|
locked_items: *locked(?std.ArrayList(Arc(*models.Item))),
|
||||||
current_full_name: ?models.FullName,
|
current_full_name: ?models.FullName,
|
||||||
) !?[]vxfw.Widget {
|
) !?[]vxfw.Widget {
|
||||||
const text_items = blk2: {
|
const text_items = blk: {
|
||||||
items1.mutex.lock();
|
locked_items.mutex.lock();
|
||||||
defer items1.mutex.unlock();
|
defer locked_items.mutex.unlock();
|
||||||
|
|
||||||
break :blk2 if (items1.data) |items| blk: {
|
const items = locked_items.data orelse return null;
|
||||||
const children = try ctx.arena.create(std.ArrayList(*vxfw.Text));
|
const children = try ctx.arena.create(std.ArrayList(*vxfw.Text));
|
||||||
children.* = std.ArrayList(*vxfw.Text).init(ctx.arena);
|
children.* = std.ArrayList(*vxfw.Text).init(ctx.arena);
|
||||||
|
|
||||||
@@ -320,9 +320,6 @@ const Model = struct {
|
|||||||
try children.append(text_element);
|
try children.append(text_element);
|
||||||
}
|
}
|
||||||
break :blk children;
|
break :blk children;
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const widgets = try ctx.arena.alloc(vxfw.Widget, text_items.items.len);
|
const widgets = try ctx.arena.alloc(vxfw.Widget, text_items.items.len);
|
||||||
|
|||||||
Reference in New Issue
Block a user