From 2b0edbefb6664fc7f54eb3c321d945a44fce1205 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sat, 31 Dec 2022 17:32:43 +0530 Subject: added folder picker --- main.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index 1a67787..1e2658f 100644 --- a/main.go +++ b/main.go @@ -57,6 +57,9 @@ func onActivate(app *gtk.Application) { dirInput, _ := gtk.EntryNew() dirInput.SetText(DEFAULT_DIR) dirBox.PackEnd(dirInput, false, false, 5) + + browseButton, _ := gtk.FileChooserButtonNew("Browse", gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER) + dirBox.PackEnd(browseButton, false, false, 5) box.PackStart(dirBox, false, false, 5) portBox, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0) @@ -76,6 +79,10 @@ func onActivate(app *gtk.Application) { statusLabel, _ := gtk.LabelNew("") box.PackStart(statusLabel, false, true, 10) + browseButton.Connect("selection-changed", func() { + dirInput.SetText(browseButton.GetFilename()) + }) + var on = false var server *http.Server buttonSwitch.Connect("toggled", func() { -- cgit v1.2.3