From e9268d1828cb81021d14a55d4fdac4d0f082cd2b Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Wed, 5 Sep 2018 19:56:11 +0200 Subject: add confirmOnQuit config option --- docs/Config.md | 1 + pkg/config/app_config.go | 1 + pkg/gui/gui.go | 5 +++++ pkg/i18n/dutch.go | 3 +++ pkg/i18n/english.go | 3 +++ pkg/i18n/polish.go | 3 +++ 6 files changed, 16 insertions(+) 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?`, }, ) } -- cgit v1.2.3