diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-09-06 09:33:06 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-06 09:33:06 +1000 |
commit | ce95e6771ad53760b31f9977d0b0784eb05a8c86 (patch) | |
tree | 785ac05a4af2f7183c3f6051be32e93ec0981a8a | |
parent | cf41338a9f6e7643a08ffc8092e69e0da48eb711 (diff) | |
parent | e9268d1828cb81021d14a55d4fdac4d0f082cd2b (diff) |
Merge pull request #263 from dawidd6/feature/confirm_quit
Add confirmOnQuit config option
-rw-r--r-- | docs/Config.md | 1 | ||||
-rw-r--r-- | pkg/config/app_config.go | 1 | ||||
-rw-r--r-- | pkg/gui/gui.go | 5 | ||||
-rw-r--r-- | pkg/i18n/dutch.go | 3 | ||||
-rw-r--r-- | pkg/i18n/english.go | 3 | ||||
-rw-r--r-- | pkg/i18n/polish.go | 3 |
6 files changed, 16 insertions, 0 deletions
diff --git a/docs/Config.md b/docs/Config.md index 76cf4bcc0..7f342df7f 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -20,6 +20,7 @@ method: prompt # can be: prompt | background | never days: 14 # how often an update is checked for reporting: 'undetermined' # one of: 'on' | 'off' | 'undetermined' + confirmOnQuit: false ``` ## Platform Defaults: diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go index ae713a212..7cde63de1 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -228,6 +228,7 @@ update: method: prompt # can be: prompt | background | never days: 14 # how often a update is checked for reporting: 'undetermined' # one of: 'on' | 'off' | 'undetermined' +confirmOnQuit: false `) } diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index bb395f9d2..413e48202 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -411,5 +411,10 @@ func (gui *Gui) quit(g *gocui.Gui, v *gocui.View) error { if gui.State.Updating { return gui.createUpdateQuitConfirmation(g, v) } + if gui.Config.GetUserConfig().GetBool("confirmOnQuit") { + return gui.createConfirmationPanel(g, v, "", gui.Tr.SLocalize("ConfirmQuit"), func(g *gocui.Gui, v *gocui.View) error { + return gocui.ErrQuit + }, nil) + } return gocui.ErrQuit } diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go index ff588b264..0ce156cd5 100644 --- a/pkg/i18n/dutch.go +++ b/pkg/i18n/dutch.go @@ -295,6 +295,9 @@ func addDutch(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "MergeAborted", Other: "Merge afgebroken", + }, &i18n.Message{ + ID: "ConfirmQuit", + Other: `Are you sure you want to quit?`, }, ) } diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 1d9e8b41e..f9707ced6 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -342,6 +342,9 @@ func addEnglish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "GitconfigParseErr", Other: `Gogit failed to parse your gitconfig file due to the presence of unquoted '\' characters. Removing these should fix the issue.`, + }, &i18n.Message{ + ID: "ConfirmQuit", + Other: `Are you sure you want to quit?`, }, ) } diff --git a/pkg/i18n/polish.go b/pkg/i18n/polish.go index 5364d3d8f..1de545274 100644 --- a/pkg/i18n/polish.go +++ b/pkg/i18n/polish.go @@ -287,6 +287,9 @@ func addPolish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "MergeAborted", Other: "Scalanie anulowane", + }, &i18n.Message{ + ID: "ConfirmQuit", + Other: `Na pewno chcesz wyjść z programu?`, }, ) } |