From 31869739f382f42528f8b0e90ed368b786b6a01e Mon Sep 17 00:00:00 2001 From: David Docampo Date: Sat, 27 Jan 2024 12:22:03 +0100 Subject: [PATCH] refactor key variable name in loop --- internal/ui/sys_tray_menu.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/ui/sys_tray_menu.go b/internal/ui/sys_tray_menu.go index 9639964..7a998ba 100644 --- a/internal/ui/sys_tray_menu.go +++ b/internal/ui/sys_tray_menu.go @@ -14,53 +14,53 @@ func CreateSysTrayMenu(a fyne.App, keys []*key.Key, config *config.Config) { for _, ageKey := range keys { - menuKey := *ageKey + selectedKey := *ageKey ageKeyEncryptionDecryptionMenuEntry := fyne.NewMenuItem("Encryption and decryption", func() { - menuKey.SetActiveDecryption() - menuKey.SetActiveEncryption() + selectedKey.SetActiveDecryption() + selectedKey.SetActiveEncryption() }) ageKeyEncryptionMenuEntry := fyne.NewMenuItem("Encryption", func() { - menuKey.SetActiveEncryption() + selectedKey.SetActiveEncryption() }) ageKeyDecryptionMenuEntry := fyne.NewMenuItem("Decryption", func() { - menuKey.SetActiveDecryption() + selectedKey.SetActiveDecryption() }) - if config.DecryptionKeyName == menuKey.Name && config.EncryptionKeyName == menuKey.Name { + if config.DecryptionKeyName == selectedKey.Name && config.EncryptionKeyName == selectedKey.Name { ageKeyEncryptionDecryptionMenuEntry.Checked = true } - if config.EncryptionKeyName == menuKey.Name && config.DecryptionKeyName != menuKey.Name { + if config.EncryptionKeyName == selectedKey.Name && config.DecryptionKeyName != selectedKey.Name { ageKeyEncryptionDecryptionMenuEntry.Checked = true } - if config.EncryptionKeyName != menuKey.Name && config.DecryptionKeyName == menuKey.Name { + if config.EncryptionKeyName != selectedKey.Name && config.DecryptionKeyName == selectedKey.Name { ageKeyEncryptionDecryptionMenuEntry.Checked = true } - ageKeyMenu := fyne.NewMenuItem(menuKey.Name, func() {}) - ageKeyMenu.ChildMenu = fyne.NewMenu("key options for "+menuKey.Name, + ageKeyMenu := fyne.NewMenuItem(selectedKey.Name, func() {}) + ageKeyMenu.ChildMenu = fyne.NewMenu("key options for "+selectedKey.Name, ageKeyEncryptionDecryptionMenuEntry, ageKeyEncryptionMenuEntry, ageKeyDecryptionMenuEntry, fyne.NewMenuItemSeparator(), fyne.NewMenuItem("Copy key name", func() { - err := clipboard.WriteAll(menuKey.Name) + err := clipboard.WriteAll(selectedKey.Name) if err != nil { log.Fatalf("could not set clipboard text: %v", err) } }), fyne.NewMenuItem("Copy public key", func() { - err := clipboard.WriteAll(menuKey.PublicKey) + err := clipboard.WriteAll(selectedKey.PublicKey) if err != nil { log.Fatalf("could not set clipboard text: %v", err) } }), fyne.NewMenuItem("Copy private key", func() { - err := clipboard.WriteAll(menuKey.PrivateKey) + err := clipboard.WriteAll(selectedKey.PrivateKey) if err != nil { log.Fatalf("could not set clipboard text: %v", err) }