apprt/gtk: add deinit for url widget

This commit is contained in:
Mitchell Hashimoto
2024-07-07 09:48:39 -07:00
parent 10a3214cb4
commit 45d0653f46

View File

@ -270,6 +270,11 @@ pub const URLWidget = struct {
};
}
pub fn deinit(self: *URLWidget, overlay: *c.GtkOverlay) void {
c.gtk_overlay_remove_overlay(@ptrCast(overlay), @ptrCast(self.left));
c.gtk_overlay_remove_overlay(@ptrCast(overlay), @ptrCast(self.right));
}
pub fn setText(self: *const URLWidget, str: [:0]const u8) void {
c.gtk_label_set_text(@ptrCast(self.left), str.ptr);
c.gtk_label_set_text(@ptrCast(self.right), str.ptr);
@ -982,7 +987,7 @@ pub fn setMouseVisibility(self: *Surface, visible: bool) void {
pub fn mouseOverLink(self: *Surface, uri_: ?[]const u8) void {
const uri = uri_ orelse {
if (self.url_widget) |widget| {
if (self.url_widget) |*widget| {
widget.deinit(self.overlay);
self.url_widget = null;
}