From b0d902f265da7bab879f6620c86fa57f5a78eed5 Mon Sep 17 00:00:00 2001 From: Song Lim Date: Tue, 15 Aug 2023 11:00:39 +0800 Subject: [PATCH] fix bucket selected bug when rename bucket --- internal/gui/lib.go | 3 +++ internal/gui/state.go | 19 ++++++++++--------- internal/gui/view.go | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/internal/gui/lib.go b/internal/gui/lib.go index 3b85127..b17ccf4 100644 --- a/internal/gui/lib.go +++ b/internal/gui/lib.go @@ -61,6 +61,9 @@ func bindAllBuckets() error { // Clear key item list value keys.Set([]string{}) + + // Unselect bucket + bucketItemList.UnselectAll() return nil } diff --git a/internal/gui/state.go b/internal/gui/state.go index f760f4b..ff06128 100644 --- a/internal/gui/state.go +++ b/internal/gui/state.go @@ -10,13 +10,14 @@ import ( // Global variables for ui state var ( - a fyne.App - mw fyne.Window - db *core.Database - selBucket string - selKey string - filename binding.String - buckets binding.StringList - keys binding.StringList - keyItemList *widget.List + a fyne.App + mw fyne.Window + db *core.Database + selBucket string + selKey string + filename binding.String + buckets binding.StringList + keys binding.StringList + keyItemList *widget.List + bucketItemList *widget.List ) diff --git a/internal/gui/view.go b/internal/gui/view.go index 71ff9e2..0e1e710 100644 --- a/internal/gui/view.go +++ b/internal/gui/view.go @@ -22,7 +22,7 @@ func keyBox() *fyne.Container { // bucBox renders the bucket list container func bucBox() *fyne.Container { - bucketItemList := itemList(buckets, images.Bucket, cons.BucketEntity) + bucketItemList = itemList(buckets, images.Bucket, cons.BucketEntity) bucketItemList.OnSelected = bucketHandler eBucket := widget.NewEntry() eBucket.PlaceHolder = "Search for buckets..."