aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2023-01-03 23:01:40 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2023-01-03 23:01:40 +0530
commitb5bb3c7a2ad16804ac15c08a157c80f44ecb6aad (patch)
treea42a280f6bea6683915e5d1d28d625437aa9ea4c /main.go
parentd10d43468bf816fa9d58fab26ab99c1bd01bd635 (diff)
Implement a hacky way to not let the user crash the app by clicking too many times
Diffstat (limited to 'main.go')
-rw-r--r--main.go7
1 files changed, 6 insertions, 1 deletions
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 }