From b5bb3c7a2ad16804ac15c08a157c80f44ecb6aad Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Tue, 3 Jan 2023 23:01:40 +0530 Subject: Implement a hacky way to not let the user crash the app by clicking too many times --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'main.go') diff --git a/main.go b/main.go index 2441c6f..7bfcf69 100644 --- a/main.go +++ b/main.go @@ -83,7 +83,12 @@ func onActivate(app *gtk.Application) { var on = false var server *http.Server buttonSwitch.Connect("clicked", func() { - // TODO: validate dir and port + // clicking the button too fast too many times crashes the app + // this disables the button as long as the button is running + // user likely won't notice the button greying out or something + buttonSwitch.SetSensitive(false) + defer buttonSwitch.SetSensitive(true) + port, _ := portInput.GetText() dir := browseButton.GetFilename() if dir == "" { dir = DEFAULT_DIR } -- cgit v1.2.3