apprt/gtk: if errors fixed, hide window

This commit is contained in:
Mitchell Hashimoto
2023-09-17 22:34:34 -07:00
parent 80e02c6c9f
commit 6df01b87c1
2 changed files with 7 additions and 1 deletions

View File

@ -178,8 +178,9 @@ fn updateConfigErrors(self: *App) !void {
try ConfigErrorsWindow.create(self); try ConfigErrorsWindow.create(self);
assert(self.config_errors_window != null); assert(self.config_errors_window != null);
} }
}
const window = self.config_errors_window.?; if (self.config_errors_window) |window| {
window.update(); window.update();
} }
} }

View File

@ -28,6 +28,11 @@ pub fn create(app: *App) !void {
} }
pub fn update(self: *ConfigErrors) void { pub fn update(self: *ConfigErrors) void {
if (self.app.config._errors.empty()) {
c.gtk_window_destroy(@ptrCast(self.window));
return;
}
self.view.update(&self.app.config); self.view.update(&self.app.config);
_ = c.gtk_window_present(self.window); _ = c.gtk_window_present(self.window);
_ = c.gtk_widget_grab_focus(@ptrCast(self.window)); _ = c.gtk_widget_grab_focus(@ptrCast(self.window));